Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate devices.
PATCH 1/1 Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate devices.
This makes it easier for consumers to use the individual pieces of information instead of having to parse path_id's output.
--- extras/Makefile.am | 1 + extras/fc_id/.gitignore | 1 + extras/fc_id/Makefile.am | 13 +++ extras/fc_id/fc_id.c | 271 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 286 insertions(+), 0 deletions(-) create mode 100644 extras/fc_id/.gitignore create mode 100644 extras/fc_id/Makefile.am create mode 100644 extras/fc_id/fc_id.c
extras/Makefile.am +1 -0
@@ -5,6 +5,7 @@ SUBDIRS = \ cdrom_id \ edd_id \ path_id \ + fc_id \ firmware \ collect \ floppy \
extras/fc_id/.gitignore new file +1 -0
@@ -0,0 +1 @@ +fc_id
extras/fc_id/Makefile.am new file +13 -0
@@ -0,0 +1,13 @@ +include $(top_srcdir)/Makefile.am.inc + +libexec_PROGRAMS = \ + fc_id + +path_id_SOURCES = \ + fc_id.c \ + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c
extras/fc_id/fc_id.c new file +271 -0
271 lines not on this page · raw message
Signature · 1 line
1.6.2.2
PATCH 1/1 Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate devices.
This makes it easier for consumers to use the individual pieces of information instead of having to parse path_id's output.
(this version fixes Makefile.am)
--- extras/Makefile.am | 1 + extras/fc_id/.gitignore | 1 + extras/fc_id/Makefile.am | 13 +++ extras/fc_id/fc_id.c | 271 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 286 insertions(+), 0 deletions(-) create mode 100644 extras/fc_id/.gitignore create mode 100644 extras/fc_id/Makefile.am create mode 100644 extras/fc_id/fc_id.c
extras/Makefile.am +1 -0
@@ -5,6 +5,7 @@ SUBDIRS = \ cdrom_id \ edd_id \ path_id \ + fc_id \ firmware \ collect \ floppy \
extras/fc_id/.gitignore new file +1 -0
@@ -0,0 +1 @@ +fc_id
extras/fc_id/Makefile.am new file +13 -0
@@ -0,0 +1,13 @@ +include $(top_srcdir)/Makefile.am.inc + +libexec_PROGRAMS = \ + fc_id + +fc_id_SOURCES = \ + fc_id.c \ + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c
extras/fc_id/fc_id.c new file +271 -0
271 lines not on this page · raw message
Signature · 1 line
1.6.2.2
Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on
In reply to Peter Jonesextras/fc_id/fc_id.c line 161
Quoted 3 lines · Peter Jones
extras/fc_id/fc_id.c new file +3
-0+ hba_id =udev_device_get_sysattr_value (scsi_dev,"hba_id" ); +if (hba_id !=NULL ) +printf ("ID_HDA=%s\n" , hba_id);
Did you mean ID_HBA instead of ID_HDA?
David
Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate
In reply to Peter JonesQuoted 6 lines · David Zeuthen
extras/fc_id/fc_id.c line 161
Quoted 3 lines · Peter Jones
extras/fc_id/fc_id.c new file +3
-0+ hba_id =udev_device_get_sysattr_value (scsi_dev,"hba_id" ); +if (hba_id !=NULL ) +printf ("ID_HDA=%s\n" , hba_id);Did you mean
ID_HBAinstead ofID_HDA?
I did.
Signature · 5 lines
Peter Computers have already beaten communists at chess. The next thing you know, they'll be beating humans. -- Dale
Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on
In reply to Peter Jonesextras/fc_id/fc_id.c line 103
Quoted 10 lines · Peter Jones
extras/fc_id/fc_id.c new file +10
-0+static struct udev_device *handle_scsi_sas (struct udev_device *parent) +{ + Â Â Â return NULL; +} + +static struct udev_device *handle_scsi_iscsi (struct udev_device *parent) +{ + Â Â Â return NULL; +} +
Why are you copying all the stuff, and not even the latest version, if you think that is useful?
Quoted 10 lines
+ Â Â Â Â Â Â Â subsys =
udev_device_get_subsystem(parent);(quoted diff) +9
-0+ + Â Â Â Â Â Â Â if (subsys = NULL) { + Â Â Â Â Â Â Â Â Â Â Â ; + Â Â Â Â Â Â Â } else if (strcmp(subsys, "scsi") = 0) { + Â Â Â Â Â Â Â Â Â Â Â parent = handle_scsi(parent); + Â Â Â Â Â Â Â } else if (strcmp(subsys, "cciss") = 0) { + Â Â Â Â Â Â Â Â Â Â Â handle_cciss(parent); + Â Â Â Â Â Â Â } else if (strcmp(subsys, "serio") = 0) { + Â Â Â Â Â Â Â Â Â Â Â parent = skip_subsystem(parent, "serio");
Review
Quoted 10 lines
(quoted diff) +10
-0+ Â Â Â Â Â Â Â } else if (strcmp(subsys, "pci") = 0) { + Â Â Â Â Â Â Â Â Â Â Â parent = skip_subsystem(parent, "pci"); + Â Â Â Â Â Â Â } else if (strcmp(subsys, "platform") = 0) { + Â Â Â Â Â Â Â Â Â Â Â parent = skip_subsystem(parent, "platform"); + Â Â Â Â Â Â Â } else if (strcmp(subsys, "xen") = 0) { + Â Â Â Â Â Â Â Â Â Â Â parent = skip_subsystem(parent, "xen"); + Â Â Â Â Â Â Â } + + Â Â Â Â Â Â Â parent = udev_device_get_parent(parent); + Â Â Â }
What's the point of this loop? It does nothing but lookup the SCSI device which can be a single line, right?
Thanks,
Kay
ÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±ş-¦[ ş)í…æèw*jg¬±¨¶‰š�Šİ¢jÿ¾«şG«�éÿ¢¸¢·¦j:+v‰¨ŠwèjØm¶Ÿÿşø¯ù®w¥şŠàşf£¢·hš�â�úÿ†Ù¥
Quoted 4 lines · On Tuesday 21 of July 2009 23:23:46 Peter Jones wrote:
This makes it easier for consumers to use the individual pieces of information instead of having to parse path_id's output.
+ * report Fibre Channel Path Name and Lun
Path?
Review
Quoted 2 lines
(quoted diff) +2
-0+ + printf("ID_PORT_NAME=%s\n", port);
Could it be made ID_WWPN? In this case anyone working with SAN immediately knows what it means. PORT_NAME is less widespread.
ID_WWNN could potentially be useful as well if we already has utility to parse it.