Skip to contentSkip to conversation

Remove procfs support

PATCH In review Bart Van Assche 5 participants 16 messages Aug 12, 2022 – Aug 16, 2022

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

cover Remove procfs support

Hi Martin,

The SCSI sysfs interface made the procfs interface superfluous. sysfs support was added in the most prominent user of the procfs interface (sg3_utils) in 2008. The implementation of the procfs interface makes it harder than necessary to constify the SCSI host templates. Hence this patch series that removes the procfs interface.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Bart Van Assche (4):
scsi: esas2r: Rename two functions and two variables
scsi: esas2r: Remove procfs support
scsi: core: Remove procfs support
scsi: core: Update a source code comment

 drivers/scsi/Kconfig               |  11 -
 drivers/scsi/Makefile              |   1 -
 drivers/scsi/esas2r/esas2r.h       |   4 +-
 drivers/scsi/esas2r/esas2r_ioctl.c |   2 +-
 drivers/scsi/esas2r/esas2r_main.c  |  43 +--
 drivers/scsi/hosts.c               |   5 -
 drivers/scsi/scsi.c                |   8 +-
 drivers/scsi/scsi_devinfo.c        | 146 ---------
 drivers/scsi/scsi_priv.h           |  17 -
 drivers/scsi/scsi_proc.c           | 477 -----------------------------
 drivers/scsi/sg.c                  | 358 ----------------------
 include/scsi/scsi_host.h           |   8 +-
 12 files changed, 14 insertions(+), 1066 deletions(-)
 delete mode 100644 drivers/scsi/scsi_proc.c
#1 lore raw

PATCH 1/4 scsi: esas2r: Rename two functions and two variables

Perform the following renames to make the names better reflect the purpose of these functions and variables:
* esas2r_ioctl() -> esas2r_sdev_ioctl().
* esas2r_proc_ioctl() -> esas2r_host_ioctl().
* esas2r_proc_fops -> esas2r_fops.
* esas2r_proc_host -> esas2r_scsi_host.

This patch does not change any functionality.

---
 drivers/scsi/esas2r/esas2r.h       |  4 ++--
 drivers/scsi/esas2r/esas2r_ioctl.c |  2 +-
 drivers/scsi/esas2r/esas2r_main.c  | 20 ++++++++++----------
 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/scsi/esas2r/esas2r.h +2 -2
index ed63f7a9ea54..890e8cd60069 100644
@@ -966,12 +966,12 @@ const char *esas2r_info(struct Scsi_Host *);
 int esas2r_write_params(struct esas2r_adapter *a, struct esas2r_request *rq,
 			struct esas2r_sas_nvram *data);
 int esas2r_ioctl_handler(void *hostdata, unsigned int cmd, void __user *arg);
-int esas2r_ioctl(struct scsi_device *dev, unsigned int cmd, void __user *arg);
+int esas2r_sdev_ioctl(struct scsi_device *dev, unsigned int cmd, void __user *arg);
 u8 handle_hba_ioctl(struct esas2r_adapter *a,
 		    struct atto_ioctl *ioctl_hba);
 int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd);
 int esas2r_show_info(struct seq_file *m, struct Scsi_Host *sh);
-long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
+long esas2r_host_ioctl(struct file *fp, unsigned int cmd, unsigned long arg);
 
 /* SCSI error handler (eh) functions */
 int esas2r_eh_abort(struct scsi_cmnd *cmd);
drivers/scsi/esas2r/esas2r_ioctl.c +1 -1
index 08f4e43c7d9e..5a76fc1ae038 100644
@@ -1525,7 +1525,7 @@ int esas2r_ioctl_handler(void *hostdata, unsigned int cmd, void __user *arg)
 	return 0;
 }
 
-int esas2r_ioctl(struct scsi_device *sd, unsigned int cmd, void __user *arg)
+int esas2r_sdev_ioctl(struct scsi_device *sd, unsigned int cmd, void __user *arg)
 {
 	return esas2r_ioctl_handler(sd->host->hostdata, cmd, arg);
 }
drivers/scsi/esas2r/esas2r_main.c +10 -10
index 7a4eadad23d7..ed6b66594ee6 100644
@@ -236,7 +236,7 @@ static struct scsi_host_template driver_template = {
 	.show_info			= esas2r_show_info,
 	.name				= ESAS2R_LONGNAME,
 	.info				= esas2r_info,
-	.ioctl				= esas2r_ioctl,
+	.ioctl				= esas2r_sdev_ioctl,
 	.queuecommand			= esas2r_queuecommand,
 	.eh_abort_handler		= esas2r_eh_abort,
 	.eh_device_reset_handler	= esas2r_device_reset,
@@ -610,25 +610,25 @@ static int __init esas2r_init(void)
 }
 
 /* Handle ioctl calls to "/proc/scsi/esas2r/ATTOnode" */
-static const struct file_operations esas2r_proc_fops = {
+static const struct file_operations esas2r_fops = {
 	.compat_ioctl	= compat_ptr_ioctl,
-	.unlocked_ioctl = esas2r_proc_ioctl,
+	.unlocked_ioctl = esas2r_host_ioctl,
 };
 
 static const struct proc_ops esas2r_proc_ops = {
 	.proc_lseek		= default_llseek,
-	.proc_ioctl		= esas2r_proc_ioctl,
+	.proc_ioctl		= esas2r_host_ioctl,
 #ifdef CONFIG_COMPAT
 	.proc_compat_ioctl	= compat_ptr_ioctl,
 #endif
 };
 
-static struct Scsi_Host *esas2r_proc_host;
+static struct Scsi_Host *esas2r_scsi_host;
 static int esas2r_proc_major;
 
-long esas2r_proc_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
+long esas2r_host_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
 {
-	return esas2r_ioctl_handler(esas2r_proc_host->hostdata,
+	return esas2r_ioctl_handler(esas2r_scsi_host->hostdata,
 				    cmd, (void __user *)arg);
 }
 
@@ -640,7 +640,7 @@ static void __exit esas2r_exit(void)
 		esas2r_log(ESAS2R_LOG_INFO, "unregister proc");
 
 		remove_proc_entry(ATTONODE_NAME,
-				  esas2r_proc_host->hostt->proc_dir);
+				  esas2r_scsi_host->hostt->proc_dir);
 		unregister_chrdev(esas2r_proc_major, ESAS2R_DRVR_NAME);
 
 		esas2r_proc_major = 0;
@@ -720,10 +720,10 @@ const char *esas2r_info(struct Scsi_Host *sh)
 	 */
 
 	if (esas2r_proc_major <= 0) {
-		esas2r_proc_host = sh;
+		esas2r_scsi_host = sh;
 
 		esas2r_proc_major = register_chrdev(0, ESAS2R_DRVR_NAME,
-						    &esas2r_proc_fops);
+						    &esas2r_fops);
 
 		esas2r_log_dev(ESAS2R_LOG_DEBG, &(sh->shost_gendev),
 			       "register_chrdev (major %d)",
#2 lore raw

PATCH 2/4 scsi: esas2r: Remove procfs support

In reply to Bart Van Assche

Prepare for removing procfs support from the SCSI core by removing procfs support from the esas2r driver. I think it is safe to remove /proc/scsi/esas2r/ATTOnode because I have not found any public source code that uses this endpoint and also because the most recent change from @attotech.com for the esas2r driver happened nine years ago (October 2013).

---
 drivers/scsi/esas2r/esas2r_main.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)
drivers/scsi/esas2r/esas2r_main.c +1 -26
index ed6b66594ee6..e347b843a6a2 100644
@@ -609,20 +609,12 @@ static int __init esas2r_init(void)
 	return pci_register_driver(&esas2r_pci_driver);
 }
 
-/* Handle ioctl calls to "/proc/scsi/esas2r/ATTOnode" */
+/* Handle ioctl calls to "/dev/esas2r" */
 static const struct file_operations esas2r_fops = {
 	.compat_ioctl	= compat_ptr_ioctl,
 	.unlocked_ioctl = esas2r_host_ioctl,
 };
 
-static const struct proc_ops esas2r_proc_ops = {
-	.proc_lseek		= default_llseek,
-	.proc_ioctl		= esas2r_host_ioctl,
-#ifdef CONFIG_COMPAT
-	.proc_compat_ioctl	= compat_ptr_ioctl,
-#endif
-};
-
 static struct Scsi_Host *esas2r_scsi_host;
 static int esas2r_proc_major;
 
@@ -639,8 +631,6 @@ static void __exit esas2r_exit(void)
 	if (esas2r_proc_major > 0) {
 		esas2r_log(ESAS2R_LOG_INFO, "unregister proc");
 
-		remove_proc_entry(ATTONODE_NAME,
-				  esas2r_scsi_host->hostt->proc_dir);
 		unregister_chrdev(esas2r_proc_major, ESAS2R_DRVR_NAME);
 
 		esas2r_proc_major = 0;
@@ -728,21 +718,6 @@ const char *esas2r_info(struct Scsi_Host *sh)
 		esas2r_log_dev(ESAS2R_LOG_DEBG, &(sh->shost_gendev),
 			       "register_chrdev (major %d)",
 			       esas2r_proc_major);
-
-		if (esas2r_proc_major > 0) {
-			struct proc_dir_entry *pde;
-
-			pde = proc_create(ATTONODE_NAME, 0,
-					  sh->hostt->proc_dir,
-					  &esas2r_proc_ops);
-
-			if (!pde) {
-				esas2r_log_dev(ESAS2R_LOG_WARN,
-					       &(sh->shost_gendev),
-					       "failed to create_proc_entry");
-				esas2r_proc_major = -1;
-			}
-		}
 	}
 
 	sprintf(esas2r_info_str,
#3 lore raw

PATCH 3/4 scsi: core: Remove procfs support

In reply to Bart Van Assche

There are equivalents for all /proc/scsi functionality in sysfs. The most prominent user of /proc/scsi is the sg3_utils software package. Support for systems without /proc/scsi was added to sg3_utils in 2008. Hence remove procfs support from the SCSI core.

Cc Christoph Hellwig <[email protected]>
Cc Ming Lei <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc John Garry <[email protected]>
Cc Mike Christie <[email protected]>
---
 drivers/scsi/Kconfig        |  11 -
 drivers/scsi/Makefile       |   1 -
 drivers/scsi/hosts.c        |   5 -
 drivers/scsi/scsi.c         |   8 +-
 drivers/scsi/scsi_devinfo.c | 146 -----------
 drivers/scsi/scsi_priv.h    |  17 --
 drivers/scsi/scsi_proc.c    | 477 ------------------------------------
 drivers/scsi/sg.c           | 358 ---------------------------
 include/scsi/scsi_host.h    |   6 -
 9 files changed, 1 insertion(+), 1028 deletions(-)
 delete mode 100644 drivers/scsi/scsi_proc.c
drivers/scsi/Kconfig +0 -11
index 955cb69a5418..4c04c3856f1c 100644
@@ -55,17 +55,6 @@ config SCSI_NETLINK
 	default	n
 	depends on NET
 
-config SCSI_PROC_FS
-	bool "legacy /proc/scsi/ support"
-	depends on SCSI && PROC_FS
-	default y
-	help
-	  This option enables support for the various files in
-	  /proc/scsi.  In Linux 2.6 this has been superseded by
-	  files in sysfs but many legacy applications rely on this.
-
-	  If unsure say Y.
-
 comment "SCSI support type (disk, tape, CD-ROM)"
 	depends on SCSI
 
drivers/scsi/Makefile +0 -1
index f055bfd54a68..1946172282dd 100644
@@ -161,7 +161,6 @@ scsi_mod-$(CONFIG_SCSI_DMA)	+= scsi_lib_dma.o
 scsi_mod-y			+= scsi_scan.o scsi_sysfs.o scsi_devinfo.o
 scsi_mod-$(CONFIG_SCSI_NETLINK)	+= scsi_netlink.o
 scsi_mod-$(CONFIG_SYSCTL)	+= scsi_sysctl.o
-scsi_mod-$(CONFIG_SCSI_PROC_FS)	+= scsi_proc.o
 scsi_mod-$(CONFIG_BLK_DEBUG_FS)	+= scsi_debugfs.o
 scsi_mod-y			+= scsi_trace.o scsi_logging.o
 scsi_mod-$(CONFIG_PM)		+= scsi_pm.o
drivers/scsi/hosts.c +0 -5
index 26bf3b153595..ea4818d498f0 100644
@@ -180,7 +180,6 @@ void scsi_remove_host(struct Scsi_Host *shost)
 	flush_workqueue(shost->tmf_work_q);
 	scsi_forget_host(shost);
 	mutex_unlock(&shost->scan_mutex);
-	scsi_proc_host_rm(shost);
 
 	spin_lock_irqsave(shost->host_lock, flags);
 	if (scsi_host_set_state(shost, SHOST_DEL))
@@ -295,7 +294,6 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 	if (error)
 		goto out_del_dev;
 
-	scsi_proc_host_add(shost);
 	scsi_autopm_put_host(shost);
 	return error;
 
@@ -327,8 +325,6 @@ static void scsi_host_dev_release(struct device *dev)
 	struct Scsi_Host *shost = dev_to_shost(dev);
 	struct device *parent = dev->parent;
 
-	scsi_proc_hostdir_rm(shost->hostt);
-
 	/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
 	rcu_barrier();
 
@@ -509,7 +505,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
 			     "failed to create tmf workq\n");
 		goto fail;
 	}
-	scsi_proc_hostdir_add(shost->hostt);
 	return shost;
  fail:
 	/*
drivers/scsi/scsi.c +1 -7
index c59eac7a32f2..8c2f441c3159 100644
@@ -797,12 +797,9 @@ static int __init init_scsi(void)
 {
 	int error;
 
-	error = scsi_init_procfs();
-	if (error)
-		goto cleanup_queue;
 	error = scsi_init_devinfo();
 	if (error)
-		goto cleanup_procfs;
+		goto cleanup_queue;
 	error = scsi_init_hosts();
 	if (error)
 		goto cleanup_devlist;
@@ -824,8 +821,6 @@ static int __init init_scsi(void)
 	scsi_exit_hosts();
 cleanup_devlist:
 	scsi_exit_devinfo();
-cleanup_procfs:
-	scsi_exit_procfs();
 cleanup_queue:
 	scsi_exit_queue();
 	printk(KERN_ERR "SCSI subsystem failed to initialize, error = %d\n",
@@ -840,7 +835,6 @@ static void __exit exit_scsi(void)
 	scsi_exit_sysctl();
 	scsi_exit_hosts();
 	scsi_exit_devinfo();
-	scsi_exit_procfs();
 	scsi_exit_queue();
 }
 
drivers/scsi/scsi_devinfo.c +0 -146

170 lines not on this page · raw message

drivers/scsi/scsi_priv.h +0 -17
index 429663bd78ec..e58f0922bf32 100644
@@ -98,23 +98,6 @@ extern void scsi_mq_destroy_tags(struct Scsi_Host *shost);
 extern void scsi_exit_queue(void);
 extern void scsi_evt_thread(struct work_struct *work);
 
-/* scsi_proc.c */
-#ifdef CONFIG_SCSI_PROC_FS
-extern void scsi_proc_hostdir_add(struct scsi_host_template *);
-extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
-extern void scsi_proc_host_add(struct Scsi_Host *);
-extern void scsi_proc_host_rm(struct Scsi_Host *);
-extern int scsi_init_procfs(void);
-extern void scsi_exit_procfs(void);
-#else
-# define scsi_proc_hostdir_add(sht)	do { } while (0)
-# define scsi_proc_hostdir_rm(sht)	do { } while (0)
-# define scsi_proc_host_add(shost)	do { } while (0)
-# define scsi_proc_host_rm(shost)	do { } while (0)
-# define scsi_init_procfs()		(0)
-# define scsi_exit_procfs()		do { } while (0)
-#endif /* CONFIG_PROC_FS */
-
 /* scsi_scan.c */
 void scsi_enable_async_suspend(struct device *dev);
 extern int scsi_complete_async_scans(void);
drivers/scsi/scsi_proc.c deleted +0 -477

477 lines not on this page · raw message

drivers/scsi/sg.c +0 -358

387 lines not on this page · raw message

include/scsi/scsi_host.h +0 -6
index b6e41ee3d566..44af60cc19f3 100644
@@ -357,12 +357,6 @@ struct scsi_host_template {
 	 */
 	const char *proc_name;
 
-	/*
-	 * Used to store the procfs directory if a driver implements the
-	 * show_info method.
-	 */
-	struct proc_dir_entry *proc_dir;
-
 	/*
 	 * This determines if we will use a non-interrupt driven
 	 * or an interrupt driven scheme.  It is set to the maximum number
maintainer
#4 lore raw

Re: [PATCH 3/4] scsi: core: Remove procfs support

Quoted 4 lines · Bart Van Assche

There are equivalents for all /proc/scsi functionality in sysfs. The most prominent user of /proc/scsi is the sg3_utils software package. Support for systems without /proc/scsi was added to sg3_utils in 2008. Hence remove procfs support from the SCSI core.

Perhaps it is just me but I find 'cat /proc/scsi/sg/debug' very useful when something goes wrong with the sg driver or something that it depends on. Part of my sg driver rewrite (3 years and still pending) was to transfer the output that formerly went to /proc/scsi/sg/debug to debugfs instead (or as well).

The most recent version of that procfs-->debugfs work for the sg driver can be found in a post to this list titled: "[PATCH v24 35/46] sg: first debugfs support" on 20220410.

Put another way, there are many hours of debugging experience that will be lost by:

  drivers/scsi/sg.c           | 358 ---------------------------

Doug Gilbert

Quoted 19 lines
Cc Christoph Hellwig <[email protected]>
Cc Ming Lei <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc John Garry <[email protected]>
Cc Mike Christie <[email protected]>
---
  drivers/scsi/Kconfig        |  11 -
  drivers/scsi/Makefile       |   1 -
  drivers/scsi/hosts.c        |   5 -
  drivers/scsi/scsi.c         |   8 +-
  drivers/scsi/scsi_devinfo.c | 146 -----------
  drivers/scsi/scsi_priv.h    |  17 --
  drivers/scsi/scsi_proc.c    | 477 ------------------------------------
  drivers/scsi/sg.c           | 358 ---------------------------
  include/scsi/scsi_host.h    |   6 -
  9 files changed, 1 insertion(+), 1028 deletions(-)

delete mode 100644 drivers/scsi/scsi_proc.c

<snip>

#5 lore raw

Re: [PATCH 3/4] scsi: core: Remove procfs support

Quoted 12 lines · Douglas Gilbert
Quoted 4 lines · Bart Van Assche

There are equivalents for all /proc/scsi functionality in sysfs. The most prominent user of /proc/scsi is the sg3_utils software package. Support for systems without /proc/scsi was added to sg3_utils in 2008. Hence remove procfs support from the SCSI core.

Perhaps it is just me but I find 'cat /proc/scsi/sg/debug' very useful when something goes wrong with the sg driver or something that it depends on. Part of my sg driver rewrite (3 years and still pending) was to transfer the output that formerly went to /proc/scsi/sg/debug to debugfs instead (or as well).

Quoted 7 lines

The most recent version of that procfs-->debugfs work for the sg driver can be found in a post to this list titled: "[PATCH v24 35/46] sg: first debugfs support" on 20220410.

Put another way, there are many hours of debugging experience that will be lost by:

   drivers/scsi/sg.c           | 358 ---------------------------

Hi Doug,

How about extracting patch "[PATCH v24 35/46] sg: first debugfs support" from that 46 patch series and including it in this patch series?

Thanks,

Bart.

#6 lore raw

PATCH 4/4 scsi: core: Update a source code comment

In reply to Bart Van Assche

Make sure that the 'proc_name' comment correctly reflects its new role.

Cc Christoph Hellwig <[email protected]>
Cc Ming Lei <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc John Garry <[email protected]>
Cc Mike Christie <[email protected]>
---
 include/scsi/scsi_host.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/scsi/scsi_host.h +1 -1
index 44af60cc19f3..6be7bfb037eb 100644
@@ -353,7 +353,7 @@ struct scsi_host_template {
 
 
 	/*
-	 * Name of proc directory
+	 * Name reported via the proc_name SCSI host attribute.
 	 */
 	const char *proc_name;
 
#7 lore raw
In reply to Bart Van Assche
Quoted 4 lines

Hi Martin,

The SCSI sysfs interface made the procfs interface superfluous. sysfs support

Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx Where should they look for that now?

Thanks,
Avri

#8 lore raw
Quoted 4 lines · Avri Altman
Quoted 1 line

The SCSI sysfs interface made the procfs interface superfluous. sysfs support

Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx Where should they look for that now?

Hi Avri,

Please take a look at the output of the following command:

find /sys -name inquiry | xargs grep -aH .

Thanks,

Bart.

maintainer
#9 lore raw
Quoted 11 lines · Bart Van Assche
Quoted 4 lines · Avri Altman
Quoted 1 line

The SCSI sysfs interface made the procfs interface superfluous. sysfs support

Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx Where should they look for that now?

Hi Avri,

Please take a look at the output of the following command:

find /sys -name inquiry | xargs grep -aH .

# find /sys -name inquiry | xargs grep -aH .
/sys/devices/pseudo_0/adapter1/host1/target1:0:0/1:0:0:0/inquiry:[
/sys/devices/pseudo_0/adapter1/host1/target1:0:0/1:0:0:0/inquiry:Linux scsi_debug      019120210520��!
/sys/devices/pseudo_0/adapter2/host2/target2:0:0/2:0:0:0/inquiry:[
/sys/devices/pseudo_0/adapter2/host2/target2:0:0/2:0:0:0/inquiry:Linux scsi_debug      019120210520��!
/sys/devices/pseudo_0/adapter0/host0/target0:0:0/0:0:0:0/inquiry:[
/sys/devices/pseudo_0/adapter0/host0/target0:0:0/0:0:0:0/inquiry:Linux scsi_debug      019120210520��!

That is on Fedora 36, lk 5.18.16-200.fc36.x86_64 . Not exactly informative unless you already know what you are looking for.

How about lsscsi ?

# lsscsi
[0:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sda
[1:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdb
[2:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdc
[N:0:1:1]    disk    SKHynix_HFS512GDE9X081N__1                 /dev/nvme0n1

I plan to add JSON output to lsscsi in the near future.

Doug Gilbert

#10 lore raw
Quoted 8 lines · Douglas Gilbert

How about lsscsi ?

# lsscsi
[0:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sda
[1:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdb
[2:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdc
[N:0:1:1]    disk    SKHynix_HFS512GDE9X081N__1                 /dev/nvme0n1

I plan to add JSON output to lsscsi in the near future.

Hi Doug,

It was not clear to me whether or not Avri needs to retrieve the version information on an Android system. Neither /proc/scsi nor lsscsi are available on recent Android systems. I will see whether I can include the sg3_utils package in Android.

Thanks,

Bart.

maintainer
#11 lore raw
Quoted 8 lines · Bart Van Assche
Quoted 7 lines · Douglas Gilbert

How about lsscsi ?

# lsscsi
[0:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sda
[1:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdb
[2:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdc
[N:0:1:1]    disk    SKHynix_HFS512GDE9X081N__1 /dev/nvme0n1
Quoted 5 lines
Quoted 1 line

I plan to add JSON output to lsscsi in the near future.

Hi Doug,

It was not clear to me whether or not Avri needs to retrieve the version information on an Android system. Neither /proc/scsi nor lsscsi are available on recent Android systems. I will see whether I can include the sg3_utils package in Android.

The lsscsi utility is in a package by itself. It is Linux specific and does sysfs datamining so it does not need:
- root access,
- to issue SCSI commands, nor
- any support from libsgutils

Adding JSON complicates that picture a little as I use a slightly modified
https://github.com/json-parser/json-builder (license: BSD-2-Clause) in sg3_utils. Smaller bits of libsgutils have been spun off (e.g. sg_unaligned.h is used as-is in smartmontools) and I will probably do something similar for JSON support in lsscsi.

Doug Gilbert

#12 lore raw
In reply to Bart Van Assche
Quoted 13 lines · Douglas Gilbert
Quoted 9 lines

How about lsscsi ?

# lsscsi
[0:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sda
[1:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdb
[2:0:0:0]    disk    Linux    scsi_debug       0191  /dev/sdc
[N:0:1:1]    disk    SKHynix_HFS512GDE9X081N__1
/dev/nvme0n1

I plan to add JSON output to lsscsi in the near future.

Hi Doug,

Quoted 8 lines

It was not clear to me whether or not Avri needs to retrieve the version information on an Android system. Neither /proc/scsi nor lsscsi are available on recent Android systems. I will see whether I can include the sg3_utils package in Android.

Thanks,

Bart.

Either way Bart, the solution you proposed works for us, As well as other ways to obtain that info.

Thanks,
Avri

#13 lore raw
In reply to Bart Van Assche
Quoted 12 lines · Bart Van Assche
Quoted 4 lines · Avri Altman
Quoted 1 line

The SCSI sysfs interface made the procfs interface superfluous. sysfs support

Field application engineers are using #cat /proc/scsi/scsi to get the devices's fw version - Rev: xxx Where should they look for that now?

Hi Avri,

Please take a look at the output of the following command:

find /sys -name inquiry | xargs grep -aH .

The canonical method would 'lsscsi'; _slightly_ more convenient :-)

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman
#14 lore raw
In reply to Bart Van Assche

You want to *remove* a user-visible interface that has been there for decades (granted, /proc has its issues and sysfs could replace it) because you want to make a kernel data structure a const structure?

Many other things in the kernel still provide a procfs interface.

-Ewan

Quoted 35 lines · Bart Van Assche

Hi Martin,

The SCSI sysfs interface made the procfs interface superfluous. sysfs support was added in the most prominent user of the procfs interface (sg3_utils) in 2008. The implementation of the procfs interface makes it harder than necessary to constify the SCSI host templates. Hence this patch series that removes the procfs interface.

Please consider this patch series for the next merge window.

Thanks,

Bart.

Bart Van Assche (4):
scsi: esas2r: Rename two functions and two variables
scsi: esas2r: Remove procfs support
scsi: core: Remove procfs support
scsi: core: Update a source code comment

 drivers/scsi/Kconfig               |  11 -
 drivers/scsi/Makefile              |   1 -
 drivers/scsi/esas2r/esas2r.h       |   4 +-
 drivers/scsi/esas2r/esas2r_ioctl.c |   2 +-
 drivers/scsi/esas2r/esas2r_main.c  |  43 +--
 drivers/scsi/hosts.c               |   5 -
 drivers/scsi/scsi.c                |   8 +-
 drivers/scsi/scsi_devinfo.c        | 146 ---------
 drivers/scsi/scsi_priv.h           |  17 -
 drivers/scsi/scsi_proc.c           | 477 -----------------------------
 drivers/scsi/sg.c                  | 358 ----------------------
 include/scsi/scsi_host.h           |   8 +-
 12 files changed, 14 insertions(+), 1066 deletions(-)
 delete mode 100644 drivers/scsi/scsi_proc.c
#15 lore raw
Quoted 3 lines · Ewan Milne

You want to *remove* a user-visible interface that has been there for decades (granted, /proc has its issues and sysfs could replace it) because you want to make a kernel data structure a const structure?

Hi Ewan,

I want to remove this interface because this interface is obsolete, because there is a better alternative (sysfs) and because the primary user of this interface (sg3_utils) gained sysfs support 14 years ago.

Thanks,

Bart.