public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Davis <letmein@erols.com>
To: aeb@cwi.nl, linux-kernel@vger.kernel.org
Subject: Re: Patch for file fs/partitions/check.c
Date: Wed, 21 Feb 2001 19:54:38 -0500	[thread overview]
Message-ID: <3A94634E.E25F3758@erols.com> (raw)
In-Reply-To: <UTC200102202301.AAA209334.aeb@vlet.cwi.nl>

Andries.Brouwer@cwi.nl wrote:
> 
> > Are you the person I send the patch to?
> 
> Send it to aeb@cwi.nl and to linux-kernel@vger.kernel.org .
> 
> Andries

Here's my patch to perform a media-change check and, if necessary,
a disk revalidate whenever /proc/partitions is accessed.

--- check.c.save	Wed Feb 21 17:50:54 2001
+++ check.c	Wed Feb 21 19:49:20 2001
@@ -9,6 +9,10 @@
  *  contained.
  *
  *  Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl}
+ *
+ *  Alex Davis <letmein@erols.com>
+ *	Added code to keep /proc/partitions in sync with
+ *  removable media.
  */
 
 #include <linux/config.h>
@@ -242,11 +246,25 @@
 int get_partition_list(char *page, char **start, off_t offset, int
count)
 {
 	struct gendisk *dsk;
+	kdev_t dev;
 	int len;
 
 	len = sprintf(page, "major minor  #blocks  name\n\n");
 	for (dsk = gendisk_head; dsk; dsk = dsk->next) {
 		int n;
+		int i;
+
+		if ( dsk->fops->check_media_change &&
+			 dsk->fops->revalidate ) {
+			for ( i = 0; i < dsk->nr_real; ++i ) {
+				dev = MKDEV(dsk->major, i << dsk->minor_shift);
+				if ( dsk->flags[i] & GENHD_FL_REMOVABLE &&
+					 dsk->fops->check_media_change(dev) ) {
+//printk(KERN_INFO "revalidating drive %d:%d\n", dsk->major, i);
+					dsk->fops->revalidate(dev);
+				}
+			}
+		}
 
 		for (n = 0; n < (dsk->nr_real << dsk->minor_shift); n++)
 			if (dsk->part[n].nr_sects) {

           reply	other threads:[~2001-02-22  0:53 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <UTC200102202301.AAA209334.aeb@vlet.cwi.nl>]

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=3A94634E.E25F3758@erols.com \
    --to=letmein@erols.com \
    --cc=aeb@cwi.nl \
    --cc=linux-kernel@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