[Stgt-devel] target.c and tgtadm.c need some more consistency

Albert Pauw albert.pauw
Mon Apr 28 21:46:55 CEST 2008

In target.c the following list is defined:

static struct {
        int value;
        char *name;
} disk_type_names[] = {
        {TYPE_DISK, "disk"},
        {TYPE_TAPE, "tape"},
        {TYPE_PRINTER, "printer"},
        {TYPE_PROCESSOR, "processor"},
        {TYPE_WORM, "worm"},
        {TYPE_ROM, "cd/dvd"},
        {TYPE_SCANNER, "scanner"},
        {TYPE_MOD, "optical"},
        {TYPE_MEDIUM_CHANGER, "changer"},
        {TYPE_COMM, "communication"},
        {TYPE_RAID, "controller"},
        {TYPE_ENCLOSURE, "enclosure"},
        {TYPE_RBC, "rbc"},
        {TYPE_OSD, "osd"},
        {TYPE_NO_LUN, "No LUN"}

In tgtadm.c the following function is defined:

static int str_to_device_type(char *str)
        if (!strcmp(str, "disk"))
                return TYPE_DISK;
        else if (!strcmp(str, "tape")) {
                eprintf("type emulation isn't supported yet\n");
        } else if (!strcmp(str, "cd"))
                return TYPE_ROM;
        else if (!strcmp(str, "changer"))
                return TYPE_MEDIUM_CHANGER;
        else if (!strcmp(str, "osd"))
                return TYPE_OSD;
        else if (!strcmp(str, "pt"))
                return TYPE_SPT;
        else {
                eprintf("unknown target type: %s\n", str);

First, there is the difference  of defining "cd/dvd" (in target,c) and "cd"
(in tgtadm.c).
There is also the difference of "printer" (in target.c) and "pt" (tgtadm.c).

Wouldn't it be better to define this in one of the header files (e.g.
target.h) and include the
header file in both files?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/stgt-devel/attachments/20080428/0b4e94ae/attachment.html 

More information about the stgt mailing list