Patch from Bart Van Assche <bart.vanassche@gmail.com>:
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 20 May 2008 14:17:25 +0000 (14:17 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 20 May 2008 14:17:25 +0000 (14:17 +0000)
As discussed earlier today, GNU-style named initializers should be replaced
by C99-style named initializers. The patch below realizes this. The patch
below contains one additional change: double quotes are added around
a #warning message. These double qoutes are not required by the C89
or C99 language standards, but many tools expect these (e.g. checkpatch.pl).

This patch has been tested as follows:
* Verified that SCST still compiles and links (make scst iscsi && make -C srpt)
* Verified that checkpatch.pl does no longer complain on named initializers.
* Verified that the kernel patch generated by scripts/generate-kernel-patch
   applies cleanly to the 2.6.25.4 kernel, that the patched kernel compiles
   cleanly, installs properly and that it was possible after reboot to load
   the modules scst, iscsi-scst and ib_srpt load.

Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com>
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@379 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/dev_handlers/scst_cdrom.c
scst/src/dev_handlers/scst_changer.c
scst/src/dev_handlers/scst_disk.c
scst/src/dev_handlers/scst_modisk.c
scst/src/dev_handlers/scst_processor.c
scst/src/dev_handlers/scst_raid.c
scst/src/dev_handlers/scst_tape.c
scst/src/dev_handlers/scst_user.c
scst/src/dev_handlers/scst_vdisk.c
scst/src/scst_main.c

index a4199ae..f69acf9 100644 (file)
 
 #define CDROM_NAME     "dev_cdrom"
 
-#define CDROM_TYPE {          \
-  name:     CDROM_NAME,       \
-  type:     TYPE_ROM,         \
-  parse_atomic:     1,        \
-  dev_done_atomic:  1,        \
-  attach:   cdrom_attach,     \
-  detach:   cdrom_detach,     \
-  parse:    cdrom_parse,      \
-  dev_done: cdrom_done,       \
+#define CDROM_TYPE {                           \
+       .name =                 CDROM_NAME,     \
+       .type =                 TYPE_ROM,       \
+       .parse_atomic =         1,              \
+       .dev_done_atomic =      1,              \
+       .attach =               cdrom_attach,   \
+       .detach =               cdrom_detach,   \
+       .parse =                cdrom_parse,    \
+       .dev_done =             cdrom_done,     \
 }
 
 #define CDROM_SMALL_TIMEOUT  (3 * HZ)
index fed5749..4076a6d 100644 (file)
 
 #define CHANGER_NAME   "dev_changer"
 
-#define CHANGER_TYPE {         \
-  name:     CHANGER_NAME,      \
-  type:     TYPE_MEDIUM_CHANGER,\
-  parse_atomic:     1,         \
-/*  dev_done_atomic:  1,*/      \
-  attach:   changer_attach,    \
-/*  detach:   changer_detach,*/ \
-  parse:    changer_parse,     \
-/*  dev_done: changer_done*/    \
+#define CHANGER_TYPE {                         \
+       .name = CHANGER_NAME,                   \
+       .type = TYPE_MEDIUM_CHANGER,            \
+       .parse_atomic = 1,                      \
+/*     .dev_done_atomic =      1, */           \
+       .attach =       changer_attach,         \
+/*     .detach =       changer_detach, */      \
+       .parse =        changer_parse,          \
+/*     .dev_done =     changer_done */         \
 }
 
 #define CHANGER_RETRIES       2
index 908be0e..0ff5611 100644 (file)
 # define DISK_NAME           "dev_disk"
 # define DISK_PERF_NAME      "dev_disk_perf"
 
-#define DISK_TYPE {          \
-  name:     DISK_NAME,      \
-  type:     TYPE_DISK,       \
-  parse_atomic:     1,       \
-  dev_done_atomic:  1,       \
-  exec_atomic:      1,       \
-  attach:   disk_attach,     \
-  detach:   disk_detach,     \
-  parse:    disk_parse,      \
-  dev_done: disk_done,       \
+#define DISK_TYPE {                                    \
+       .name =                 DISK_NAME,              \
+       .type =                 TYPE_DISK,              \
+       .parse_atomic =         1,                      \
+       .dev_done_atomic =      1,                      \
+       .exec_atomic =          1,                      \
+       .attach =               disk_attach,            \
+       .detach =               disk_detach,            \
+       .parse =                disk_parse,             \
+       .dev_done =             disk_done,              \
 }
 
-#define DISK_PERF_TYPE {     \
-  name:     DISK_PERF_NAME,  \
-  type:     TYPE_DISK,       \
-  parse_atomic:     1,       \
-  dev_done_atomic:  1,       \
-  exec_atomic:      1,       \
-  attach:   disk_attach,     \
-  detach:   disk_detach,     \
-  parse:    disk_parse,      \
-  dev_done: disk_done,       \
-  exec:     disk_exec,       \
+#define DISK_PERF_TYPE {                               \
+       .name =                 DISK_PERF_NAME,         \
+       .type =                 TYPE_DISK,              \
+       .parse_atomic =         1,                      \
+       .dev_done_atomic =      1,                      \
+       .exec_atomic =          1,                      \
+       .attach =               disk_attach,            \
+       .detach =               disk_detach,            \
+       .parse =                disk_parse,             \
+       .dev_done =             disk_done,              \
+       .exec =                 disk_exec,              \
 }
 
 #define DISK_SMALL_TIMEOUT  (3 * HZ)
index 4f98a2c..a244633 100644 (file)
 # define MODISK_NAME           "dev_modisk"
 # define MODISK_PERF_NAME      "dev_modisk_perf"
 
-#define MODISK_TYPE {          \
-  name:     MODISK_NAME,       \
-  type:     TYPE_MOD,          \
-  parse_atomic:     1,         \
-  dev_done_atomic:  1,         \
-  exec_atomic:      1,         \
-  attach:   modisk_attach,     \
-  detach:   modisk_detach,     \
-  parse:    modisk_parse,      \
-  dev_done: modisk_done,       \
+#define MODISK_TYPE {                          \
+       .name =                 MODISK_NAME,    \
+       .type =                 TYPE_MOD,       \
+       .parse_atomic =         1,              \
+       .dev_done_atomic =      1,              \
+       .exec_atomic =          1,              \
+       .attach =               modisk_attach,  \
+       .detach =               modisk_detach,  \
+       .parse =                modisk_parse,   \
+       .dev_done =             modisk_done,    \
 }
 
-#define MODISK_PERF_TYPE {     \
-  name:     MODISK_PERF_NAME,  \
-  type:     TYPE_MOD,          \
-  parse_atomic:     1,         \
-  dev_done_atomic:  1,         \
-  exec_atomic:      1,         \
-  attach:   modisk_attach,     \
-  detach:   modisk_detach,     \
-  parse:    modisk_parse,      \
-  dev_done: modisk_done,       \
-  exec:     modisk_exec,       \
+#define MODISK_PERF_TYPE {                             \
+       .name =                 MODISK_PERF_NAME,       \
+       .type =                 TYPE_MOD,               \
+       .parse_atomic =         1,                      \
+       .dev_done_atomic =      1,                      \
+       .exec_atomic =          1,                      \
+       .attach =               modisk_attach,          \
+       .detach =               modisk_detach,          \
+       .parse =                modisk_parse,           \
+       .dev_done =             modisk_done,            \
+       .exec =                 modisk_exec,            \
 }
 
 #define MODISK_SMALL_TIMEOUT  (3 * HZ)
index 02d1095..5695166 100644 (file)
 
 #define PROCESSOR_NAME "dev_processor"
 
-#define PROCESSOR_TYPE {       \
-  name:     PROCESSOR_NAME,    \
-  type:     TYPE_PROCESSOR,    \
-  parse_atomic:     1,         \
-/*  dev_done_atomic:  1,*/             \
-  attach:   processor_attach,  \
-/*  detach:   processor_detach,*/ \
-  parse:    processor_parse,   \
-/*  dev_done: processor_done*/ \
+#define PROCESSOR_TYPE {                               \
+       .name =                 PROCESSOR_NAME,         \
+       .type =                 TYPE_PROCESSOR,         \
+       .parse_atomic =         1,                      \
+/*     .dev_done_atomic =      1,*/                    \
+       .attach =               processor_attach,       \
+/*     .detach =               processor_detach,*/     \
+       .parse =                processor_parse,        \
+/*     .dev_done =             processor_done*/        \
 }
 
 #define PROCESSOR_RETRIES       2
index c39439b..e12ae8e 100644 (file)
 
 #define RAID_NAME      "dev_raid"
 
-#define RAID_TYPE {            \
-  name:     RAID_NAME,         \
-  type:     TYPE_RAID,          \
-  parse_atomic:     1,         \
-/*  dev_done_atomic:  1,*/      \
-  attach:   raid_attach,       \
-/*  detach:   raid_detach,*/   \
-  parse:    raid_parse,        \
-/*  dev_done: raid_done*/      \
+#define RAID_TYPE {                            \
+       .name =                 RAID_NAME,      \
+       .type =                 TYPE_RAID,      \
+       .parse_atomic =         1,              \
+/*     .dev_done_atomic =      1,*/            \
+       .attach =               raid_attach,    \
+/*     .detach =               raid_detach,*/  \
+       .parse =                raid_parse,     \
+/*     .dev_done =             raid_done*/     \
 }
 
 #define RAID_RETRIES       2
index ea1a12d..79b5dca 100644 (file)
 # define TAPE_NAME           "dev_tape"
 # define TAPE_PERF_NAME      "dev_tape_perf"
 
-#define TAPE_TYPE {         \
-  name:     TAPE_NAME,     \
-  type:     TYPE_TAPE,      \
-  parse_atomic:     1,      \
-  dev_done_atomic:  1,      \
-  exec_atomic:      1,      \
-  attach:   tape_attach,    \
-  detach:   tape_detach,    \
-  parse:    tape_parse,     \
-  dev_done: tape_done,      \
+#define TAPE_TYPE {                            \
+       .name =                 TAPE_NAME,      \
+       .type =                 TYPE_TAPE,      \
+       .parse_atomic =         1,              \
+       .dev_done_atomic =      1,              \
+       .exec_atomic =          1,              \
+       .attach =               tape_attach,    \
+       .detach =               tape_detach,    \
+       .parse =                tape_parse,     \
+       .dev_done =             tape_done,      \
 }
 
-#define TAPE_PERF_TYPE {    \
-  name:     TAPE_PERF_NAME, \
-  type:     TYPE_TAPE,      \
-  parse_atomic:     1,      \
-  dev_done_atomic:  1,      \
-  exec_atomic:      1,      \
-  attach:   tape_attach,    \
-  detach:   tape_detach,    \
-  parse:    tape_parse,     \
-  dev_done: tape_done,      \
-  exec:     tape_exec,      \
+#define TAPE_PERF_TYPE {                       \
+       .name =                 TAPE_PERF_NAME, \
+       .type =                 TYPE_TAPE,      \
+       .parse_atomic =         1,              \
+       .dev_done_atomic =      1,              \
+       .exec_atomic =          1,              \
+       .attach =               tape_attach,    \
+       .detach =               tape_detach,    \
+       .parse =                tape_parse,     \
+       .dev_done =             tape_done,      \
+       .exec =                 tape_exec,      \
 }
 
 #define TAPE_RETRIES        2
index a83680d..55e18f6 100644 (file)
 #include "scst_dev_handler.h"
 
 #if defined(CONFIG_HIGHMEM4G) || defined(CONFIG_HIGHMEM64G)
-#warning HIGHMEM kernel configurations are not supported by this module, \
+#warning "HIGHMEM kernel configurations are not supported by this module, \
        because nowadays it doesn't worth the effort. Consider change \
        VMSPLIT option or use 64-bit configuration instead. See README file \
-       for details.
+       for details."
 #endif
 
 #define DEV_USER_MAJOR                 237
@@ -2910,10 +2910,10 @@ static int dev_usr_parse(struct scst_cmd *cmd)
 }
 
 /* Needed only for /proc support */
-#define USR_TYPE {             \
-  name:     DEV_USER_NAME,     \
-  type:     -1,                        \
-  parse:    dev_usr_parse,     \
+#define USR_TYPE {                     \
+       .name =         DEV_USER_NAME,  \
+       .type =         -1,             \
+       .parse =        dev_usr_parse,  \
 }
 
 static struct scst_dev_type dev_user_devtype = USR_TYPE;
index 8e6fef5..ec741a0 100644 (file)
@@ -254,59 +254,59 @@ static int vcdrom_write_proc(char *buffer, char **start, off_t offset,
 static int vdisk_task_mgmt_fn(struct scst_mgmt_cmd *mcmd,
        struct scst_tgt_dev *tgt_dev);
 
-#define VDISK_TYPE {                   \
-  name:         VDISK_NAME,            \
-  type:         TYPE_DISK,             \
-  exec_sync:   1,                      \
-  threads_num: -1,                     \
-  parse_atomic: 1,                     \
-  exec_atomic:  0,                     \
-  dev_done_atomic: 1,                  \
-  attach:       vdisk_attach,          \
-  detach:       vdisk_detach,          \
-  attach_tgt:   vdisk_attach_tgt,      \
-  detach_tgt:   vdisk_detach_tgt,      \
-  parse:        vdisk_parse,           \
-  exec:         vdisk_do_job,          \
-  read_proc:    vdisk_read_proc,       \
-  write_proc:   vdisk_write_proc,      \
-  task_mgmt_fn: vdisk_task_mgmt_fn,    \
+#define VDISK_TYPE {                                   \
+       .name =                 VDISK_NAME,             \
+       .type =                 TYPE_DISK,              \
+       .exec_sync =            1,                      \
+       .threads_num =          -1,                     \
+       .parse_atomic =         1,                      \
+       .exec_atomic =          0,                      \
+       .dev_done_atomic =      1,                      \
+       .attach =               vdisk_attach,           \
+       .detach =               vdisk_detach,           \
+       .attach_tgt =           vdisk_attach_tgt,       \
+       .detach_tgt =           vdisk_detach_tgt,       \
+       .parse =                vdisk_parse,            \
+       .exec =                 vdisk_do_job,           \
+       .read_proc =            vdisk_read_proc,        \
+       .write_proc =           vdisk_write_proc,       \
+       .task_mgmt_fn =         vdisk_task_mgmt_fn,     \
 }
 
-#define VDISK_BLK_TYPE {               \
-  name:         VDISK_NAME "_blk",     \
-  type:         TYPE_DISK,             \
-  threads_num: 0,                      \
-  parse_atomic: 1,                     \
-  exec_atomic:  0,                     \
-  dev_done_atomic: 1,                  \
-  no_proc: 1,                          \
-  attach:       vdisk_attach,          \
-  detach:       vdisk_detach,          \
-  attach_tgt:   vdisk_attach_tgt,      \
-  detach_tgt:   vdisk_detach_tgt,      \
-  parse:        vdisk_parse,           \
-  exec:         vdisk_do_job,          \
-  task_mgmt_fn: vdisk_task_mgmt_fn,    \
+#define VDISK_BLK_TYPE {                               \
+       .name =                 VDISK_NAME "_blk",      \
+       .type =                 TYPE_DISK,              \
+       .threads_num =          0,                      \
+       .parse_atomic =         1,                      \
+       .exec_atomic =          0,                      \
+       .dev_done_atomic =      1,                      \
+       .no_proc =              1,                      \
+       .attach =               vdisk_attach,           \
+       .detach =               vdisk_detach,           \
+       .attach_tgt =           vdisk_attach_tgt,       \
+       .detach_tgt =           vdisk_detach_tgt,       \
+       .parse =                vdisk_parse,            \
+       .exec =                 vdisk_do_job,           \
+       .task_mgmt_fn =         vdisk_task_mgmt_fn,     \
 }
 
-#define VCDROM_TYPE {                  \
-  name:         VCDROM_NAME,           \
-  type:         TYPE_ROM,              \
-  exec_sync:   1,                      \
-  threads_num: -1,                     \
-  parse_atomic: 1,                     \
-  exec_atomic:  0,                     \
-  dev_done_atomic: 1,                  \
-  attach:       vdisk_attach,          \
-  detach:       vdisk_detach,          \
-  attach_tgt:   vdisk_attach_tgt,      \
-  detach_tgt:   vdisk_detach_tgt,      \
-  parse:        vcdrom_parse,          \
-  exec:         vcdrom_exec,           \
-  read_proc:    vcdrom_read_proc,      \
-  write_proc:   vcdrom_write_proc,     \
-  task_mgmt_fn: vdisk_task_mgmt_fn,    \
+#define VCDROM_TYPE {                                  \
+       .name =                 VCDROM_NAME,            \
+       .type =                 TYPE_ROM,               \
+       .exec_sync =            1,                      \
+       .threads_num =          -1,                     \
+       .parse_atomic =         1,                      \
+       .exec_atomic =          0,                      \
+       .dev_done_atomic =      1,                      \
+       .attach =               vdisk_attach,           \
+       .detach =               vdisk_detach,           \
+       .attach_tgt =           vdisk_attach_tgt,       \
+       .detach_tgt =           vdisk_detach_tgt,       \
+       .parse =                vcdrom_parse,           \
+       .exec =                 vcdrom_exec,            \
+       .read_proc =            vcdrom_read_proc,       \
+       .write_proc =           vcdrom_write_proc,      \
+       .task_mgmt_fn =         vdisk_task_mgmt_fn,     \
 }
 
 static DEFINE_MUTEX(scst_vdisk_mutex);
index 3ddbb9b..3ec5133 100644 (file)
@@ -149,7 +149,7 @@ MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by "
 
 struct scst_dev_type scst_null_devtype =
 {
-  name:     "none",
+       .name = "none",
 };
 
 int __scst_register_target_template(struct scst_tgt_template *vtt,