From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Kagan Date: Wed, 16 Feb 2005 11:07:52 +0000 Subject: Re: [ANNOUNCE] hotplug-ng 001 release Message-Id: <20050216110752.GC2360@katya> List-Id: References: <20050211004033.GA26624@suse.de> In-Reply-To: <20050211004033.GA26624@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Below is the promised patch dealing with scsi module loading (can't compile-test it at the moment, sorry). It has two caveats (I suspect you'll find more :) : 1) I'm not particularly certain about the "scsi-type-" prefix: it may resemble cases where request_module() is used; 2) TYPE_* macros in include/linux/scsi.h are in hex and can't be conveniently __stringify()-ed, so I've hardcoded the values and inserted comments next to them referring to those macros. It handles only st, sd_mod and sr_mod cases (as hotplug-ng-001/module_scsi.c did). Are there any other? Cheers, Roman. diff -ruNp -x '*~' linux-2.6.11-rc4.hotplug.orig/drivers/scsi/scsi_sysfs.c linux-2.6.11-rc4.hotplug/drivers/scsi/scsi_sysfs.c --- linux-2.6.11-rc4.hotplug.orig/drivers/scsi/scsi_sysfs.c 2005-02-13 06:05:41.000000000 +0300 +++ linux-2.6.11-rc4.hotplug/drivers/scsi/scsi_sysfs.c 2005-02-16 04:19:07.000000000 +0300 @@ -202,9 +202,29 @@ static int scsi_bus_match(struct device return (sdp->inq_periph_qual = SCSI_INQ_PQ_CON)? 1: 0; } +#ifdef CONFIG_HOTPLUG +static int scsi_hotplug(struct device *dev, char **envp, + int num_envp, char *buffer, int buffer_size) +{ + struct scsi_device *sdev = to_scsi_device(dev); + int i = 0; + int length = 0; + + if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length, + "MODNAME=scsi-type-%d", sdev->type)) + return -ENOMEM; + + envp[i] = NULL; + return 0; +} +#endif + struct bus_type scsi_bus_type = { .name = "scsi", .match = scsi_bus_match, +#ifdef CONFIG_HOTPLUG + .hotplug = scsi_hotplug, +#endif }; int scsi_sysfs_register(void) diff -ruNp -x '*~' linux-2.6.11-rc4.hotplug.orig/drivers/scsi/sd.c linux-2.6.11-rc4.hotplug/drivers/scsi/sd.c --- linux-2.6.11-rc4.hotplug.orig/drivers/scsi/sd.c 2005-02-13 06:07:01.000000000 +0300 +++ linux-2.6.11-rc4.hotplug/drivers/scsi/sd.c 2005-02-16 04:18:47.000000000 +0300 @@ -1653,6 +1653,8 @@ static void __exit exit_sd(void) MODULE_LICENSE("GPL"); MODULE_AUTHOR("Eric Youngdale"); MODULE_DESCRIPTION("SCSI disk (sd) driver"); +MODULE_ALIAS("scsi-type-0"); /* TYPE_DISK */ +MODULE_ALIAS("scsi-type-7"); /* TYPE_MOD */ module_init(init_sd); module_exit(exit_sd); diff -ruNp -x '*~' linux-2.6.11-rc4.hotplug.orig/drivers/scsi/sr.c linux-2.6.11-rc4.hotplug/drivers/scsi/sr.c --- linux-2.6.11-rc4.hotplug.orig/drivers/scsi/sr.c 2005-02-13 06:08:04.000000000 +0300 +++ linux-2.6.11-rc4.hotplug/drivers/scsi/sr.c 2005-02-16 04:23:25.000000000 +0300 @@ -956,6 +956,9 @@ static void __exit exit_sr(void) unregister_blkdev(SCSI_CDROM_MAJOR, "sr"); } +MODULE_ALIAS("scsi-type-4"); /* TYPE_WORM */ +MODULE_ALIAS("scsi-type-5"); /* TYPE_ROM */ + module_init(init_sr); module_exit(exit_sr); MODULE_LICENSE("GPL"); diff -ruNp -x '*~' linux-2.6.11-rc4.hotplug.orig/drivers/scsi/st.c linux-2.6.11-rc4.hotplug/drivers/scsi/st.c --- linux-2.6.11-rc4.hotplug.orig/drivers/scsi/st.c 2005-02-13 06:06:55.000000000 +0300 +++ linux-2.6.11-rc4.hotplug/drivers/scsi/st.c 2005-02-16 04:26:28.000000000 +0300 @@ -4090,6 +4090,8 @@ static void __exit exit_st(void) printk(KERN_INFO "st: Unloaded.\n"); } +MODULE_ALIAS("scsi-type-1"); /* TYPE_TAPE */ + module_init(init_st); module_exit(exit_st); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel