From: Patrick Mansfield Date: Tue, 17 Feb 2004 02:25:35 +0000 Subject: Re: [PATCH] udev - create all partitions of blockdevice Message-Id: <20040216182535.A4689@beaverton.ibm.com> List-Id: References: <20040216033452.GA3523@vrfy.org> In-Reply-To: <20040216033452.GA3523@vrfy.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Mon, Feb 16, 2004 at 01:59:27PM -0800, Greg KH wrote: > On Mon, Feb 16, 2004 at 04:34:52AM +0100, Kay Sievers wrote: > > Here is the first try to create all partitons of a blockdevice, since > > removable media devices may need to acces the expected partition to > > revalidate the media. > > > > It uses the attribute syntax introduced with the last %s{file} patch. > > I'm using this with my multi-slot-flash-card-reader: > > > > SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia" > > SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash" > > SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick" > > SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia" > > If needed, we can make the number of partions to create > > adjustable with the attribute? > > Nice, this is great. I don't think we need to change the number of > partitions. > > I've applied this, and checked in a fix for udev-add.c if 'fake' was > true (which it is for udevtest). I'll go test this for my devices with > partitions. Should we export the scsi 'removable' flag via sysfs attribute for use with all_partitions? Kernel patch is a trivial: === drivers/scsi/scsi_sysfs.c 1.39 vs edited ==--- 1.39/drivers/scsi/scsi_sysfs.c Fri Jan 16 15:24:41 2004 +++ edited/drivers/scsi/scsi_sysfs.c Tue Feb 17 00:56:50 2004 @@ -266,6 +266,7 @@ sdev_rd_attr (model, "%.16s\n"); sdev_rd_attr (rev, "%.4s\n"); sdev_rw_attr_bit (online); +sdev_rd_attr (removable, "%d\n"); static ssize_t store_rescan_field (struct device *dev, const char *buf, size_t count) @@ -295,6 +296,7 @@ &dev_attr_online, &dev_attr_rescan, &dev_attr_delete, + &dev_attr_removable, NULL }; So you could have rules such as: KERNEL="sd*", BUS="scsi", SYSFS{removable}="1", NAME{all_partitions}="%k" KERNEL="sd*", BUS="scsi", SYSFS{removable}="0", NAME="%k" AFAIUI CD-ROM never wants all_partitions even though they are marked removable. Tape is also removable. So, the KERNEL="sd*". Though it won't help for non-scsi (implies non-usb mass storage) media. A global rule affecting all partitions or naming would be nice, so you would not have to have a separate rule, but then like Kay's example rules above, if you are specifically naming a device, you already know it is removable, and can set all_partitions. For example, you only need the first rule below, but if in some simliar case, you required two rules, that is ugly: SYSFS{model}="USB Storage-SMC ", SYSFS{removable}="1", NAME{all_partitions}="smartmedia" SYSFS{model}="USB Storage-SMC ", SYSFS{removable}="0", NAME="smartmedia" -- Patrick Mansfield ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&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