Skip to contentSkip to conversation

Patch for file fs/partitions/check.c

DISCUSSION Alex Davis 1 participant 1 message Feb 22, 2001 1 message not in the archive

lore
Share & tools
lore

Alex Davis

author
#1 lore raw
In reply to a message not in the archive
Quoted 6 lines · [email protected] wrote:
Quoted 2 lines

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 renamed from check.c.save +4 -0
@@ -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) {