Skip to content

Commit 1e7da86

Browse files
Colin Ian Kingaxboe
authored andcommitted
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: Colin Ian King <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent f5bbbbe commit 1e7da86

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

drivers/block/DAC960.c

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,16 +2428,20 @@ static bool DAC960_V2_ReportDeviceConfiguration(DAC960_Controller_T
24282428
{
24292429
DAC960_V2_LogicalDeviceInfo_T *LogicalDeviceInfo =
24302430
Controller->V2.LogicalDeviceInformation[LogicalDriveNumber];
2431-
unsigned char *ReadCacheStatus[] = { "Read Cache Disabled",
2432-
"Read Cache Enabled",
2433-
"Read Ahead Enabled",
2434-
"Intelligent Read Ahead Enabled",
2435-
"-", "-", "-", "-" };
2436-
unsigned char *WriteCacheStatus[] = { "Write Cache Disabled",
2437-
"Logical Device Read Only",
2438-
"Write Cache Enabled",
2439-
"Intelligent Write Cache Enabled",
2440-
"-", "-", "-", "-" };
2431+
static const unsigned char *ReadCacheStatus[] = {
2432+
"Read Cache Disabled",
2433+
"Read Cache Enabled",
2434+
"Read Ahead Enabled",
2435+
"Intelligent Read Ahead Enabled",
2436+
"-", "-", "-", "-"
2437+
};
2438+
static const unsigned char *WriteCacheStatus[] = {
2439+
"Write Cache Disabled",
2440+
"Logical Device Read Only",
2441+
"Write Cache Enabled",
2442+
"Intelligent Write Cache Enabled",
2443+
"-", "-", "-", "-"
2444+
};
24412445
unsigned char *GeometryTranslation;
24422446
if (LogicalDeviceInfo == NULL) continue;
24432447
switch (LogicalDeviceInfo->DriveGeometry)
@@ -4339,14 +4343,16 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
43394343
static void DAC960_V2_ReadWriteError(DAC960_Command_T *Command)
43404344
{
43414345
DAC960_Controller_T *Controller = Command->Controller;
4342-
unsigned char *SenseErrors[] = { "NO SENSE", "RECOVERED ERROR",
4343-
"NOT READY", "MEDIUM ERROR",
4344-
"HARDWARE ERROR", "ILLEGAL REQUEST",
4345-
"UNIT ATTENTION", "DATA PROTECT",
4346-
"BLANK CHECK", "VENDOR-SPECIFIC",
4347-
"COPY ABORTED", "ABORTED COMMAND",
4348-
"EQUAL", "VOLUME OVERFLOW",
4349-
"MISCOMPARE", "RESERVED" };
4346+
static const unsigned char *SenseErrors[] = {
4347+
"NO SENSE", "RECOVERED ERROR",
4348+
"NOT READY", "MEDIUM ERROR",
4349+
"HARDWARE ERROR", "ILLEGAL REQUEST",
4350+
"UNIT ATTENTION", "DATA PROTECT",
4351+
"BLANK CHECK", "VENDOR-SPECIFIC",
4352+
"COPY ABORTED", "ABORTED COMMAND",
4353+
"EQUAL", "VOLUME OVERFLOW",
4354+
"MISCOMPARE", "RESERVED"
4355+
};
43504356
unsigned char *CommandName = "UNKNOWN";
43514357
switch (Command->CommandType)
43524358
{

0 commit comments

Comments
 (0)