move all procfs code to scsi_proc.c
PATCH 1/1 move all procfs code to scsi_proc.c
scsi.c gets really far too big, and having all code that depends on CONFIG_PROC_FS in scsi_proc.c is a nice cleanup. Note that much of the procfs code is really really ugly and wants a rewrite to at least use the seq_file interface and probably moving to sysfs.
(the patch was much nicer before Pat's dynamic blacklist changes,
now I need to de-privatize two symbols)
===== drivers/scsi/Makefile 1.31 vs edited =====
drivers/scsi/Makefile +6 -3
@@ -18,7 +18,7 @@ CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS CFLAGS_seagate.o = -DARBITRATE -DPARITY -DSEAGATE_USE_ASM -export-objs := scsi_syms.o 53c700.o +export-objs := scsi_syms.o scsi_proc.o 53c700.o subdir-$(CONFIG_PCMCIA) += pcmcia
@@ -123,8 +123,11 @@ obj-$(CONFIG_CHR_DEV_SG) += sg.o scsi_mod-objs := scsi.o hosts.o scsi_ioctl.o constants.o scsicam.o \ - scsi_proc.o scsi_error.o scsi_lib.o scsi_scan.o \ - scsi_syms.o + scsi_error.o scsi_lib.o scsi_scan.o scsi_syms.o + +ifdef CONFIG_PROC_FS +scsi_mod-objs += scsi_proc.o +endif sd_mod-objs := sd.o sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o
===== drivers/scsi/hosts.c 1.27 vs edited =====
drivers/scsi/hosts.c +0 -9
@@ -352,11 +352,7 @@ shost->hostt->present--;/* Cleanup proc and driverfs */ -#ifdef CONFIG_PROC_FS scsi_proc_host_rm (shost); -if (!shost->hostt->present) -remove_proc_entry (shost->hostt->proc_name, proc_scsi); -#endif device_unregister (&shost->host_driverfs_dev);kfree (shost);
@@ -470,12 +466,7 @@ found:spin_unlock (&scsi_host_list_lock); -#ifdef CONFIG_PROC_FS -/* Add the new driver to /proc/scsi if not already there */ -if (!shost_tp->proc_dir) -scsi_proc_host_mkdir (shost_tp);scsi_proc_host_add (shost); -#endif strncpy (shost->host_driverfs_dev.name, shost_tp->proc_name,DEVICE_NAME_SIZE -1 );
===== drivers/scsi/hosts.h 1.36 vs edited =====
drivers/scsi/hosts.h +0 -4
@@ -509,10 +509,6 @@unsigned short host_registered; } Scsi_Host_Name; -extern void scsi_proc_host_mkdir (Scsi_Host_Template *); -extern void scsi_proc_host_add (struct Scsi_Host *); -extern void scsi_proc_host_rm (struct Scsi_Host *); -extern void scsi_register_blocked_host (struct Scsi_Host *);extern void scsi_deregister_blocked_host (struct Scsi_Host *);
===== drivers/scsi/scsi.c 1.61 vs edited =====
drivers/scsi/scsi.c +4 -494
552 lines not on this page · raw message
===== drivers/scsi/scsi.h 1.40 vs edited =====
drivers/scsi/scsi.h +21 -1
@@ -391,6 +391,11 @@#include "scsi_obsolete.h" /* +* Forward-declaration of structs for prototypes. +*/ +struct Scsi_Host ; + +/* * Add some typedefs so that we can prototyope a bunch of the functions. */ typedef struct scsi_device Scsi_Device ;
@@ -496,8 +501,21 @@/* * Prototypes for functions in scsi_proc.c */ -extern void proc_print_scsidevice (Scsi_Device *,char *,int *,int ); +#ifdef CONFIG_PROC_FS +extern int scsi_init_procfs (void ); +extern void scsi_exit_procfs (void ); + +extern void scsi_proc_host_add (struct Scsi_Host *); +extern void scsi_proc_host_rm (struct Scsi_Host *); +extern struct proc_dir_entry *proc_scsi; +#else +static inline int scsi_init_procfs (void ) {return 0 ; }; +static inline void scsi_exit_procfs (void ) { }; + +static inline void scsi_proc_host_add (struct Scsi_Host *); +static inline void scsi_proc_host_rm (struct Scsi_Host *); +#endif /* CONFIG_PROC_FS */ /* * Prototypes for functions in constants.c
@@ -536,6 +554,8 @@unsigned flags;unsigned compatible;/* for use with scsi_static_device_list entries */ }; +extern struct list_head scsi_dev_info_list; +extern int scsi_dev_info_list_add_str (char *);/* * The scsi_device struct contains what we know about each given scsi
===== drivers/scsi/scsi_proc.c 1.7 vs edited =====
drivers/scsi/scsi_proc.c +552 -220
871 lines not on this page · raw message
===== drivers/scsi/scsi_syms.c 1.18 vs edited =====
drivers/scsi/scsi_syms.c +0 -3
@@ -74,9 +74,6 @@EXPORT_SYMBOL (scsi_sleep); -EXPORT_SYMBOL (proc_print_scsidevice); -EXPORT_SYMBOL (proc_scsi); -EXPORT_SYMBOL (scsi_io_completion);EXPORT_SYMBOL (scsi_end_request);
Quoted 6 lines · Christoph Hellwig
drivers/scsi/scsi.h +5
-1-extern void proc_print_scsidevice (Scsi_Device *,char *,int *,int ); +#ifdef CONFIG_PROC_FS +extern int scsi_init_procfs (void ); +extern void scsi_exit_procfs (void ); + +extern void scsi_proc_host_add (struct Scsi_Host *);
drivers/scsi/scsi.h line 518
Quoted 10 lines
drivers/scsi/scsi.h +9
-0+extern void scsi_proc_host_rm (struct Scsi_Host *); +extern struct proc_dir_entry *proc_scsi; +#else +static inline int scsi_init_procfs (void ) {return 0 ; }; +static inline void scsi_exit_procfs (void ) { }; + +static inline void scsi_proc_host_add (struct Scsi_Host *); +static inline void scsi_proc_host_rm (struct Scsi_Host *); +#endif /* CONFIG_PROC_FS */
Where are the calls to scsi_init_procfs and scsi_exit_procfs?
-- Patrick Mansfield
Quoted 1 line · Patrick Mansfield
Where are the calls to
scsi_init_procfsandscsi_exit_procfs?
Left between the previous and the final version of that patch. Here's the right diff:
drivers/scsi/Makefile +6 -3
@@ -18,7 +18,7 @@ CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS CFLAGS_seagate.o = -DARBITRATE -DPARITY -DSEAGATE_USE_ASM -export-objs := scsi_syms.o 53c700.o +export-objs := scsi_syms.o scsi_proc.o 53c700.o subdir-$(CONFIG_PCMCIA) += pcmcia
@@ -123,8 +123,11 @@ obj-$(CONFIG_CHR_DEV_SG) += sg.o scsi_mod-objs := scsi.o hosts.o scsi_ioctl.o constants.o scsicam.o \ - scsi_proc.o scsi_error.o scsi_lib.o scsi_scan.o \ - scsi_syms.o + scsi_error.o scsi_lib.o scsi_scan.o scsi_syms.o + +ifdef CONFIG_PROC_FS +scsi_mod-objs += scsi_proc.o +endif sd_mod-objs := sd.o sr_mod-objs := sr.o sr_ioctl.o sr_vendor.o
===== drivers/scsi/hosts.c 1.27 vs edited =====
drivers/scsi/hosts.c +0 -9
@@ -352,11 +359,7 @@ shost->hostt->present--;/* Cleanup proc and driverfs */ -#ifdef CONFIG_PROC_FS scsi_proc_host_rm (shost); -if (!shost->hostt->present) -remove_proc_entry (shost->hostt->proc_name, proc_scsi); -#endif device_unregister (&shost->host_driverfs_dev);kfree (shost);
@@ -470,12 +473,7 @@ found:spin_unlock (&scsi_host_list_lock); -#ifdef CONFIG_PROC_FS -/* Add the new driver to /proc/scsi if not already there */ -if (!shost_tp->proc_dir) -scsi_proc_host_mkdir (shost_tp);scsi_proc_host_add (shost); -#endif strncpy (shost->host_driverfs_dev.name, shost_tp->proc_name,DEVICE_NAME_SIZE -1 );
===== drivers/scsi/hosts.h 1.36 vs edited =====
drivers/scsi/hosts.h +0 -4
@@ -509,10 +509,6 @@unsigned short host_registered; } Scsi_Host_Name; -extern void scsi_proc_host_mkdir (Scsi_Host_Template *); -extern void scsi_proc_host_add (struct Scsi_Host *); -extern void scsi_proc_host_rm (struct Scsi_Host *); -extern void scsi_register_blocked_host (struct Scsi_Host *);extern void scsi_deregister_blocked_host (struct Scsi_Host *);
===== drivers/scsi/scsi.c 1.61 vs edited =====
drivers/scsi/scsi.c +6 -494
554 lines not on this page · raw message
===== drivers/scsi/scsi.h 1.40 vs edited =====
drivers/scsi/scsi.h +21 -1
@@ -391,6 +391,11 @@#include "scsi_obsolete.h" /* +* Forward-declaration of structs for prototypes. +*/ +struct Scsi_Host ; + +/* * Add some typedefs so that we can prototyope a bunch of the functions. */ typedef struct scsi_device Scsi_Device ;
@@ -496,8 +501,21 @@/* * Prototypes for functions in scsi_proc.c */ -extern void proc_print_scsidevice (Scsi_Device *,char *,int *,int ); +#ifdef CONFIG_PROC_FS +extern int scsi_init_procfs (void ); +extern void scsi_exit_procfs (void ); + +extern void scsi_proc_host_add (struct Scsi_Host *); +extern void scsi_proc_host_rm (struct Scsi_Host *); +extern struct proc_dir_entry *proc_scsi; +#else +static inline int scsi_init_procfs (void ) {return 0 ; }; +static inline void scsi_exit_procfs (void ) { }; + +static inline void scsi_proc_host_add (struct Scsi_Host *); +static inline void scsi_proc_host_rm (struct Scsi_Host *); +#endif /* CONFIG_PROC_FS */ /* * Prototypes for functions in constants.c
@@ -536,6 +554,8 @@unsigned flags;unsigned compatible;/* for use with scsi_static_device_list entries */ }; +extern struct list_head scsi_dev_info_list; +extern int scsi_dev_info_list_add_str (char *);/* * The scsi_device struct contains what we know about each given scsi
===== drivers/scsi/scsi_proc.c 1.7 vs edited =====
drivers/scsi/scsi_proc.c +552 -220
871 lines not on this page · raw message
===== drivers/scsi/scsi_syms.c 1.18 vs edited =====
drivers/scsi/scsi_syms.c +0 -3
@@ -74,9 +74,6 @@EXPORT_SYMBOL (scsi_sleep); -EXPORT_SYMBOL (proc_print_scsidevice); -EXPORT_SYMBOL (proc_scsi); -EXPORT_SYMBOL (scsi_io_completion);EXPORT_SYMBOL (scsi_end_request);