Skip to contentSkip to conversation

Staging: hv: storvsc: Show the modulename in /sys/class/scsi_host/*/proc_name

PATCH In review Olaf Hering 3 participants 8 messages Sep 8, 2011 – Sep 9, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: hv: storvsc: Show the modulename in /sys/class/scsi_host/*/proc_name

mkinitrd relies on /sys/class/scsi_host/*/proc_name instead of /sys/block/sd*/device/../../../moalias to get the scsi driver module name.
As a fallback the sysfs driver name could be used, which does not match the module name either ('storvsc' vs. 'hv_storvsc').

---
 drivers/staging/hv/storvsc_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/hv/storvsc_drv.c +2 -1
@@ -1333,7 +1333,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"storvsc_host_t",
+	.name =			"hv_storvsc",
+	.proc_name =		"hv_storvsc",
 	.bios_param =		storvsc_get_chs,
 	.queuecommand =		storvsc_queuecommand,
 	.eh_host_reset_handler =	storvsc_host_reset_handler,
Acked-by on v1 1/1
#1 lore raw
Quoted 27 lines

-----Original Message-----
From: Olaf Hering [mailto:[email protected]]
Sent: Thursday, September 08, 2011 12:27 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH] Staging: hv: storvsc: Show the modulename in /sys/class/scsi_host/*/proc_name

mkinitrd relies on /sys/class/scsi_host/*/proc_name instead of /sys/block/sd*/device/../../../moalias to get the scsi driver module name.
As a fallback the sysfs driver name could be used, which does not match the module name either ('storvsc' vs. 'hv_storvsc').

---
 drivers/staging/hv/storvsc_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

drivers/staging/hv/storvsc_drv.c static DEF_SCSI_QCMD(storvsc_queuecomman · line 1340

Quoted 9 lines
drivers/staging/hv/storvsc_drv.c +2 -1
@@ -1333,7 +1333,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"storvsc_host_t",
+	.name =			"hv_storvsc",
+	.proc_name =		"hv_storvsc",
 	.bios_param =		storvsc_get_chs,
 	.queuecommand =		storvsc_queuecommand,
 	.eh_host_reset_handler =	storvsc_host_reset_handler,
#2 lore raw
In reply to Olaf Hering
Quoted 16 lines · Olaf Hering

mkinitrd relies on /sys/class/scsi_host/*/proc_name instead of /sys/block/sd*/device/../../../moalias to get the scsi driver module name.
As a fallback the sysfs driver name could be used, which does not match the module name either ('storvsc' vs. 'hv_storvsc').

---
 drivers/staging/hv/storvsc_drv.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

drivers/staging/hv/storvsc_drv.c static DEF_SCSI_QCMD(storvsc_queuecomman · line 1337

Quoted 6 lines
drivers/staging/hv/storvsc_drv.c +2 -1
@@ -1333,7 +1333,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"storvsc_host_t",
+	.name =			"hv_storvsc",
+	.proc_name =		"hv_storvsc",

Shouldn't this be MODULE_NAME so it handles any potential name change in the future and makes it a bit more obvious as to what is going on here?

thanks,

greg k-h

#3 lore raw
Quoted 13 lines · Greg KH

drivers/staging/hv/storvsc_drv.c static DEF_SCSI_QCMD(storvsc_queuecomman · line 1337

Quoted 8 lines · Olaf Hering

+++ b/drivers/staging/hv/storvsc_drv.c

drivers/staging/hv/storvsc_drv.c +2 -1
@@ -1333,7 +1333,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"storvsc_host_t",
+	.name =			"hv_storvsc",
+	.proc_name =		"hv_storvsc",

Shouldn't this be MODULE_NAME so it handles any potential name change in the future and makes it a bit more obvious as to what is going on here?

MODULE_NAME is just another define and appearently not used to assemble a kernel module. Is DRV_NAME depreciated?

I think hv_storvsc and hv_netvsc should advertise their module names as sysfs driver names. Digging into the hv history it could be that the initial implementation had a storvsc.ko, and c3260cfe8f08ca4564df61950cbebbb693aee292 introduced the hv_storvsc.ko

I will send a patch on top of that.

Olaf

#4 lore raw
Quoted 16 lines · Olaf Hering
Quoted 13 lines · Greg KH

drivers/staging/hv/storvsc_drv.c static DEF_SCSI_QCMD(storvsc_queuecomman · line 1337

Quoted 8 lines · Olaf Hering

+++ b/drivers/staging/hv/storvsc_drv.c

drivers/staging/hv/storvsc_drv.c +2 -1
@@ -1333,7 +1333,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"storvsc_host_t",
+	.name =			"hv_storvsc",
+	.proc_name =		"hv_storvsc",

Shouldn't this be MODULE_NAME so it handles any potential name change in the future and makes it a bit more obvious as to what is going on here?

Quoted 2 lines

MODULE_NAME is just another define and appearently not used to assemble a kernel module. Is DRV_NAME depreciated?

Sorry, I should have said KBUILD_MODNAME, that will give you what you want here.

greg k-h

#5 lore raw

PATCH 1/1 Staging: hv: storvsc: advertise hv_storvsc instead of storvsc as driver name

In reply to Olaf Hering
drivers/staging/hv/storvsc_drv.c +6 -4
@@ -42,6 +42,8 @@
 
 #include "hyperv.h"
 
+#define MODULE_NAME "hv_storvsc"
+
 #define STORVSC_RING_BUFFER_SIZE			(20*PAGE_SIZE)
 static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;
 
@@ -1164,7 +1166,7 @@ static void storvsc_command_completion(s
 	if (scmnd->result) {
 		if (scsi_normalize_sense(scmnd->sense_buffer,
 				SCSI_SENSE_BUFFERSIZE, &sense_hdr))
-			scsi_print_sense_hdr("storvsc", &sense_hdr);
+			scsi_print_sense_hdr(MODULE_NAME, &sense_hdr);
 	}
 
 	scsi_set_resid(scmnd,
@@ -1333,8 +1335,8 @@ static DEF_SCSI_QCMD(storvsc_queuecomman
 /* Scsi driver */
 static struct scsi_host_template scsi_driver = {
 	.module	=		THIS_MODULE,
-	.name =			"hv_storvsc",
-	.proc_name =		"hv_storvsc",
+	.name =			MODULE_NAME,
+	.proc_name =		MODULE_NAME,
 	.bios_param =		storvsc_get_chs,
 	.queuecommand =		storvsc_queuecommand,
 	.eh_host_reset_handler =	storvsc_host_reset_handler,
@@ -1468,7 +1470,7 @@ err_out:
 /* The one and only one */
 
 static struct hv_driver storvsc_drv = {
-	.name = "storvsc",
+	.name = MODULE_NAME,
 	.id_table = id_table,
 	.probe = storvsc_probe,
 	.remove = storvsc_remove,
#6 lore raw

Re: [PATCH] Staging: hv: storvsc: advertise hv_storvsc instead of storvsc as driver name

drivers/staging/hv/storvsc_drv.c line 45

Quoted 10 lines · Olaf Hering
drivers/staging/hv/storvsc_drv.c +1 -0
@@ -42,6 +42,8 @@
 
 #include "hyperv.h"
 
+#define MODULE_NAME "hv_storvsc"

No, just use KBUILD_MODNAME, it's already there and correct. Care to fix this one, and your other patch, to use it instead?

thanks,

greg k-h

#7 lore raw

PATCH 1/1 Staging: hv: netvsc: advertise hv_netvsc instead of netvsc as driver name

In reply to Olaf Hering
drivers/staging/hv/netvsc_drv.c +4 -2
@@ -41,6 +41,8 @@
 #include "hyperv.h"
 #include "hyperv_net.h"
 
+#define MODULE_NAME "hv_netvsc"
+
 struct net_device_context {
 	/* point back to our device context */
 	struct hv_device *device_ctx;
@@ -291,7 +293,7 @@ int netvsc_recv_callback(struct hv_devic
 static void netvsc_get_drvinfo(struct net_device *net,
 			       struct ethtool_drvinfo *info)
 {
-	strcpy(info->driver, "hv_netvsc");
+	strcpy(info->driver, MODULE_NAME);
 	strcpy(info->version, HV_DRV_VERSION);
 	strcpy(info->fw_version, "N/A");
 }
@@ -420,7 +422,7 @@ MODULE_DEVICE_TABLE(vmbus, id_table);
 
 /* The one and only one */
 static struct  hv_driver netvsc_drv = {
-	.name = "netvsc",
+	.name = MODULE_NAME,
 	.id_table = id_table,
 	.probe = netvsc_probe,
 	.remove = netvsc_remove,