[EMAIL PROTECTED] wrote:
> 
> > Are you the person I send the patch to?
> 
> Send it to [EMAIL PROTECTED] and to [EMAIL PROTECTED] .
> 
> 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 <[EMAIL PROTECTED]>
+ *     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) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to