linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] udev - create all partitions of blockdevice
Date: Sun, 07 Mar 2004 14:01:11 +0000	[thread overview]
Message-ID: <20040307140111.GA31097@suse.de> (raw)
In-Reply-To: <20040216033452.GA3523@vrfy.org>

 On Sun, Feb 22, Patrick Mansfield wrote:

> I ran with this patch:
> 
> diff -uprN -X /home/patman/dontdiff base-2.6/drivers/block/genhd.c blk-attr-2.6/drivers/block/genhd.c
> --- base-2.6/drivers/block/genhd.c	Fri Feb 20 07:36:56 2004
> +++ blk-attr-2.6/drivers/block/genhd.c	Sun Feb 22 13:55:48 2004
> @@ -352,6 +352,12 @@ static ssize_t disk_range_read(struct ge
>  {
>  	return sprintf(page, "%d\n", disk->minors);
>  }
> +static ssize_t disk_removable_read(struct gendisk * disk, char *page)
> +{
> +	return sprintf(page, "%d\n",
> +		       (disk->flags & GENHD_FL_REMOVABLE ? 1 : 0));
> +
> +}
>  static ssize_t disk_size_read(struct gendisk * disk, char *page)
>  {
>  	return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk));
> @@ -394,6 +400,10 @@ static struct disk_attribute disk_attr_r
>  	.attr = {.name = "range", .mode = S_IRUGO },
>  	.show	= disk_range_read
>  };
> +static struct disk_attribute disk_attr_removable = {
> +	.attr = {.name = "removable", .mode = S_IRUGO },
> +	.show	= disk_removable_read
> +};
>  static struct disk_attribute disk_attr_size = {
>  	.attr = {.name = "size", .mode = S_IRUGO },
>  	.show	= disk_size_read
> @@ -406,6 +416,7 @@ static struct disk_attribute disk_attr_s
>  static struct attribute * default_attrs[] = {
>  	&disk_attr_dev.attr,
>  	&disk_attr_range.attr,
> +	&disk_attr_removable.attr,
>  	&disk_attr_size.attr,
>  	&disk_attr_stat.attr,
>  	NULL,
> 
> And then I see:
> 
> [root@laptop root]# for i in /sys/block/*; do echo $i removable is $(cat $i/removable); done
> /sys/block/fd0 removable is 1
> /sys/block/hda removable is 0
> /sys/block/hdc removable is 1
> /sys/block/sda removable is 1
> 
> hda is my boot/root disk. hdc my cd drive.
> 
> For sda, both my fairly cheap dazzle xd card reader and my olympus c750
> give the same result.
> 
> (The ide floppy is the bay thing on my laptop, though it has a cd drive in
> it.)

This doesnt work for firewire at least.

/sys/block/hda removable is 0
/sys/block/hdb removable is 1
/sys/block/ram0 removable is 0
/sys/block/sda removable is 0

Can we mark all sbp2 and usb-storage devices as removeable somehow?
They can disappear at any time. 

./drivers/usb/storage/isd200.c does modify the InquiryData as example.

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, n√úRNBERG


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÃk
_______________________________________________
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

  parent reply	other threads:[~2004-03-07 14:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-16  3:34 [PATCH] udev - create all partitions of blockdevice Kay Sievers
2004-02-16 21:59 ` Greg KH
2004-02-17  2:25 ` Patrick Mansfield
2004-02-21  0:47 ` Greg KH
2004-02-22 23:03 ` Patrick Mansfield
2004-03-07 14:01 ` Olaf Hering [this message]
2004-03-07 17:41 ` Olaf Hering

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040307140111.GA31097@suse.de \
    --to=olh@suse.de \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).