Commit 1e7da865 authored by Colin Ian King's avatar Colin Ian King Committed by Jens Axboe

block/DAC960.c: make some arrays static const, shrinks object size

Don't populate the arrays ReadCacheStatus, WriteCacheStatus and
SenseErrors on the stack but instead make them static const. Makes
the object code smaller by 47 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
 160974	  34628	    832	 196434	  2ff52	drivers/block/DAC960.o

After:
   text	   data	    bss	    dec	    hex	filename
 160671	  34884	    832	 196387	  2ff23	drivers/block/DAC960.o

(gcc version 8.2.0 x86_64)
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f5bbbbe4
...@@ -2428,16 +2428,20 @@ static bool DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T ...@@ -2428,16 +2428,20 @@ static bool DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T
{ {
DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo = DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo =
Controller->V2.LogicalDeviceInformation[LogicalDriveNumber]; Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
unsigned char *ReadCacheStatus[] = { "Read Cache Disabled", static const unsigned char *ReadCacheStatus[] = {
"Read Cache Disabled",
"Read Cache Enabled", "Read Cache Enabled",
"Read Ahead Enabled", "Read Ahead Enabled",
"Intelligent Read Ahead Enabled", "Intelligent Read Ahead Enabled",
"-", "-", "-", "-" }; "-", "-", "-", "-"
unsigned char *WriteCacheStatus[] = { "Write Cache Disabled", };
static const unsigned char *WriteCacheStatus[] = {
"Write Cache Disabled",
"Logical Device Read Only", "Logical Device Read Only",
"Write Cache Enabled", "Write Cache Enabled",
"Intelligent Write Cache Enabled", "Intelligent Write Cache Enabled",
"-", "-", "-", "-" }; "-", "-", "-", "-"
};
unsigned char *GeometryTranslation; unsigned char *GeometryTranslation;
if (LogicalDeviceInfo == NULL) continue; if (LogicalDeviceInfo == NULL) continue;
switch (LogicalDeviceInfo->DriveGeometry) switch (LogicalDeviceInfo->DriveGeometry)
...@@ -4339,14 +4343,16 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command) ...@@ -4339,14 +4343,16 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
static void DAC960_V2_ReadWriteError(DAC960_Command_T *Command) static void DAC960_V2_ReadWriteError(DAC960_Command_T *Command)
{ {
DAC960_Controller_T *Controller = Command->Controller; DAC960_Controller_T *Controller = Command->Controller;
unsigned char *SenseErrors[] = { "NO SENSE", "RECOVERED ERROR", static const unsigned char *SenseErrors[] = {
"NO SENSE", "RECOVERED ERROR",
"NOT READY", "MEDIUM ERROR", "NOT READY", "MEDIUM ERROR",
"HARDWARE ERROR", "ILLEGAL REQUEST", "HARDWARE ERROR", "ILLEGAL REQUEST",
"UNIT ATTENTION", "DATA PROTECT", "UNIT ATTENTION", "DATA PROTECT",
"BLANK CHECK", "VENDOR-SPECIFIC", "BLANK CHECK", "VENDOR-SPECIFIC",
"COPY ABORTED", "ABORTED COMMAND", "COPY ABORTED", "ABORTED COMMAND",
"EQUAL", "VOLUME OVERFLOW", "EQUAL", "VOLUME OVERFLOW",
"MISCOMPARE", "RESERVED" }; "MISCOMPARE", "RESERVED"
};
unsigned char *CommandName = "UNKNOWN"; unsigned char *CommandName = "UNKNOWN";
switch (Command->CommandType) switch (Command->CommandType)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment