Skip to contentSkip to conversation

Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate devices.

PATCH In review Peter Jones 4 participants 6 messages Jul 21, 2009 – Jul 22, 2009

lore
Share & tools
lore
#0 lore raw

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
index b7c9fe8..5377a8e 100644
@@ -5,6 +5,7 @@ SUBDIRS = \
 	cdrom_id \
 	edd_id \
 	path_id \
+	fc_id \
 	firmware \
 	collect \
 	floppy \
extras/fc_id/.gitignore new file +1 -0
new file mode 100644
index 0000000..1d7d107
@@ -0,0 +1 @@
+fc_id
extras/fc_id/Makefile.am new file +13 -0
new file mode 100644
index 0000000..ae90d3c
@@ -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
#1 lore raw

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
index b7c9fe8..5377a8e 100644
@@ -5,6 +5,7 @@ SUBDIRS = \
 	cdrom_id \
 	edd_id \
 	path_id \
+	fc_id \
 	firmware \
 	collect \
 	floppy \
extras/fc_id/.gitignore new file +1 -0
new file mode 100644
index 0000000..1d7d107
@@ -0,0 +1 @@
+fc_id
extras/fc_id/Makefile.am new file +13 -0
new file mode 100644
index 0000000..6d4c8d1
@@ -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
#2 lore raw

Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on

In reply to Peter Jones

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_HBA instead of ID_HDA?

David

#3 lore raw

Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on appropriate

In reply to Peter Jones
Quoted 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_HBA instead of ID_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
#4 lore raw

Re: [PATCH] Add fc_id, which gives ID_PORT_NAME and ID_LUN on

In reply to Peter Jones

extras/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š�â�úÿ†Ù¥

#5 lore raw
In reply to Peter Jones
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.