/proc/partitions for LVM
Subsystems (3)
Question about /proc/partitions and LVM. LVM devices in/proc/partitions currently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support in fs/partitions/check.c for showing the proper name for the device (something like <vgname>/<lvname>).
Are their any plans for something like this to be added
or is their a reason it was taken out?
BTW, 2.4.0-test11 is the first "perfect" kernel for me. It
finally has everything I use working correctly. (well, with a small raid5 patch, anyway).
Brian Kress
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Quoted 6 lines · Brian Kress
Question about
/proc/partitionsand LVM. LVM devices in/proc/partitionscurrently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support infs/partitions/check.cfor showing the proper name for the device (something like <vgname>/<lvname>).
Yes.
It actually was <vgname>/<lvname>.
Linus didn't accept it though.
The code is still available in case he changes his mind.
Quoted 15 lines
Are their any plans for something like this to be added
or is their a reason it was taken out?BTW, 2.4.0-test11 is the first "perfect" kernel for me. It
finally has everything I use working correctly. (well, with a small raid5 patch, anyway).Brian Kress
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Signature · 16 lines
Regards,
Heinz -- The LVM guy --
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Bartningstr. 12
64289 Darmstadt
Germany
[email protected] +49 6151 7103 86
FAX 7103 96
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/RFC: Modularize /proc/partitons (was Re: /proc/partitions for LVM)
In reply to Brian KressQuoted 9 lines · Heinz J. Mauelshagen
Quoted 6 lines · Brian Kress
Question about
/proc/partitionsand LVM. LVM devices in/proc/partitionscurrently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support infs/partitions/check.cfor showing the proper name for the device (something like <vgname>/<lvname>).
Quoted 6 lines
Yes.
It actually was <vgname>/<lvname>.Linus didn't accept it though.
The code is still available in case he changes his mind.
Yes, I can see that now looking through lvm.c. (LVM_HD_NAME)
I'm guessing why he didn't take it is the minor hack of adding a function pointer to genhd.c as a special case just for LVM.
A general solution to this problem would be nice. The
big switch statement in disk_name in fs/paritions/check.c is kind of ugly as it has generic code have to know things about specific drivers.
How's this for an idea to generalize this. Put a function
pointer in the gendisk structure for a specific function to call for disk_name for disks for that gendisk. That way, LVM gets its <vgname>/<lvname>, IDE gets its two disks per major (special cased right now), all the other special cases get what they need and future drivers can call their devices whatever they like without touching this file. Makes the whole thing more modular. Make a NULL for this function default to the old <name>a, <name>b, etc.
What to people think about this? If this sounds reasonable
I can come up with a patch.
Brian Kress
[email protected]
Quoted 24 lines
Quoted 10 lines
Are their any plans for something like this to be added
or is their a reason it was taken out?BTW, 2.4.0-test11 is the first "perfect" kernel for me. It
finally has everything I use working correctly. (well, with a small raid5 patch, anyway).Quoted 6 lines
Brian Kress
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/--
Regards,
Heinz -- The LVM guy --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Quoted 7 lines
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Bartningstr. 1264289 Darmstadt Germany [email protected] +49 6151 7103 86 FAX 7103 96=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Re: RFC: Modularize /proc/partitons (was Re: /proc/partitions for LVM)
In reply to Brian KressQuoted 17 lines · Brian Kress
Quoted 9 lines · Heinz J. Mauelshagen
Quoted 6 lines · Brian Kress
Question about
/proc/partitionsand LVM. LVM devices in/proc/partitionscurrently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support infs/partitions/check.cfor showing the proper name for the device (something like <vgname>/<lvname>).Quoted 6 lines
Yes.
It actually was <vgname>/<lvname>.Linus didn't accept it though.
The code is still available in case he changes his mind.
Quoted 7 lines
Yes, I can see that now looking through
lvm.c. (LVM_HD_NAME)
I'm guessing why he didn't take it is the minor hack of adding a function pointer togenhd.cas a special case just for LVM.
A general solution to this problem would be nice. The
big switch statement indisk_nameinfs/paritions/check.cis kind of ugly as it has generic code have to know things about specific drivers.
Yep.
Quoted 3 lines
How's this for an idea to generalize this. Put a function
pointer in the gendisk structure for a specific function to call fordisk_namefor disks for that gendisk.
Sounds resonable to me.
Quoted 8 lines
That way, LVM gets its
<vgname>/<lvname>, IDE gets its two disks per major (special cased right now), all the other special cases get what they need and future drivers can call their devices whatever they like without touching this file. Makes the whole thing more modular. Make a NULL for this function default to the old <name>a, <name>b, etc.
What to people think about this? If this sounds reasonable
I can come up with a patch.
Very good. I'ld appreciate it.
Quoted 43 lines
Brian Kress
[email protected]Quoted 31 lines
Quoted 10 lines
Are their any plans for something like this to be added
or is their a reason it was taken out?BTW, 2.4.0-test11 is the first "perfect" kernel for me. It
finally has everything I use working correctly. (well, with a small raid5 patch, anyway).Quoted 6 lines
Brian Kress
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/--
Regards,
Heinz -- The LVM guy --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Bartningstr. 1264289 Darmstadt Germany [email protected] +49 6151 7103 86 FAX 7103 96=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Signature · 16 lines
Regards,
Heinz -- The LVM guy --
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Bartningstr. 12
64289 Darmstadt
Germany
[email protected] +49 6151 7103 86
FAX 7103 96
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/Re: RFC: Modularize /proc/partitons (was Re: /proc/partitions for LVM)
In reply to Brian KressQuoted 44 lines · Heinz J. Mauelshagen
Quoted 17 lines · Brian Kress
Quoted 9 lines · Heinz J. Mauelshagen
Quoted 6 lines · Brian Kress
Question about
/proc/partitionsand LVM. LVM devices in/proc/partitionscurrently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support infs/partitions/check.cfor showing the proper name for the device (something like <vgname>/<lvname>).Quoted 6 lines
Yes.
It actually was <vgname>/<lvname>.Linus didn't accept it though.
The code is still available in case he changes his mind.
Quoted 7 lines
Yes, I can see that now looking through
lvm.c. (LVM_HD_NAME)
I'm guessing why he didn't take it is the minor hack of adding a function pointer togenhd.cas a special case just for LVM.
A general solution to this problem would be nice. The
big switch statement indisk_nameinfs/paritions/check.cis kind of ugly as it has generic code have to know things about specific drivers.Yep.
Quoted 3 lines
How's this for an idea to generalize this. Put a function
pointer in the gendisk structure for a specific function to call fordisk_namefor disks for that gendisk.Sounds resonable to me.
Quoted 8 lines
That way, LVM gets its
<vgname>/<lvname>, IDE gets its two disks per major (special cased right now), all the other special cases get what they need and future drivers can call their devices whatever they like without touching this file. Makes the whole thing more modular. Make a NULL for this function default to the old <name>a, <name>b, etc.
What to people think about this? If this sounds reasonable
I can come up with a patch.
Quoted 2 lines
Very good. I'ld appreciate it.
OK, here's the patch. It has three sets of changes:
1) Add a function pointer to struct gendisk called hd_name.
2) Make disk_name in fs/partitions/check.c use that function pointer if its non-null.
3) Change the following drivers to use this method. (adding the driver specific method and removing the old code in check.c)
drivers/md/lvm.cdrivers/md/md.cdrivers/ide/ide-probe.cdrivers/scsi/sd.cdrivers/block/cpqarray.cdrivers/block/cciss.cdrivers/block/DAC960.c
Let me know what you think. Think there's any chance we
can get this in the main kernel tree?
Brian Kress
[email protected]
drivers/block/DAC960.c +16 -0
@@ -1885,6 +1885,21 @@ } +char *DAC960_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -DAC960_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} + +/* DAC960_RegisterBlockDevice registers the Block Device structures associated with Controller.
@@ -1945,6 +1960,7 @@ Controller->GenericDiskInfo.nr_real = Controller->LogicalDriveCount; Controller->GenericDiskInfo.next =NULL ; Controller->GenericDiskInfo.fops = &DAC960_BlockDeviceOperations; + Controller->GenericDiskInfo.hd_name = DAC960_disk_name;/* Install the Generic Disk Information structure at the end of the list. */
drivers/block/cciss.c +15 -0
@@ -1749,6 +1749,20 @@kfree (size_buff); } +char *cciss_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -COMPAQ_CISS_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} +/* * This is it. Find all the controllers and register them. I really hate * stealing all these major device numbers.
@@ -1851,6 +1865,7 @@ hba[i]->gendisk.part = hba[i]->hd; hba[i]->gendisk.sizes = hba[i]->sizes; hba[i]->gendisk.nr_real = hba[i]->num_luns; + hba[i]->gendisk.hd_name = cciss_disk_name;/* Get on the disk list */ hba[i]->gendisk.next = gendisk_head;
drivers/block/cpqarray.c +15 -0
@@ -362,6 +362,20 @@ }#endif /* MODULE */ +char *ida_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -COMPAQ_SMART2_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} +/* * This is it. Find all the controllers and register them. I really hate * stealing all these major device numbers.
@@ -512,6 +526,7 @@ ida_gendisk[i].part = ida + (i*256 ); ida_gendisk[i].sizes = ida_sizes + (i*256 ); ida_gendisk[i].nr_real =0 ; + ida_gendisk[i].hd_name = ida_disk_name;/* Get on the disk list */ ida_gendisk[i].next = gendisk_head;
drivers/ide/ide-probe.c +35 -0
@@ -726,6 +726,40 @@return 0 ; } +char *ide_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int unit = (minor >> hd->minor_shift) +'a' ; +unsigned int part = minor & ((1 << hd->minor_shift) -1 ); + +switch (hd->major) { +case IDE9_MAJOR : + unit +=2 ; +case IDE8_MAJOR : + unit +=2 ; +case IDE7_MAJOR : + unit +=2 ; +case IDE6_MAJOR : + unit +=2 ; +case IDE5_MAJOR : + unit +=2 ; +case IDE4_MAJOR : + unit +=2 ; +case IDE3_MAJOR : + unit +=2 ; +case IDE2_MAJOR : + unit +=2 ; +case IDE1_MAJOR : + unit +=2 ; +case IDE0_MAJOR : + } +if (part) +sprintf (buf,"hd%c%d" , unit, part); +else +sprintf (buf,"hd%c" , unit); +return buf; +} +/* * init_gendisk() (as opposed to ide_geninit) is called for each major device, * after probing for drives, to allocate partition tables and other data
@@ -781,6 +815,7 @@ gd->fops = ide_fops;/* file operations */ gd->de_arr =kmalloc (sizeof *gd->de_arr * units,GFP_KERNEL ); gd->flags =kmalloc (sizeof *gd->flags * units,GFP_KERNEL ); + gd->hd_name = ide_disk_name;if (gd->de_arr)memset (gd->de_arr,0 ,sizeof *gd->de_arr * units);if (gd->flags)
drivers/md/lvm.c +6 -21
@@ -213,9 +213,7 @@ &lvm_proc_get_info;#endif -#ifdef LVM_HD_NAME -void lvm_hd_name (char *,int ); -#endif +char *lvm_hd_name (struct gendisk *,int ,char *);/* End external function prototypes */
@@ -230,9 +228,6 @@int lvm_snapshot_alloc (lv_t *);void lvm_snapshot_release (lv_t *); -#ifdef LVM_HD_NAME -extern void (*lvm_hd_name_ptr) (char *,int ); -#endif static int lvm_map (struct buffer_head *,int );static int lvm_do_lock_lvm (void );static int lvm_do_le_remap (vg_t *,void *);
@@ -397,11 +392,6 @@ lvm_gendisk.next =NULL ; } -#ifdef LVM_HD_NAME -/* reference from drivers/block/genhd.c */ - lvm_hd_name_ptr = lvm_hd_name; -#endif -blk_init_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ),DEVICE_REQUEST );blk_queue_make_request (BLK_DEFAULT_QUEUE (MAJOR_NR ), lvm_make_request_fn);blk_queue_pluggable (BLK_DEFAULT_QUEUE (MAJOR_NR ), lvm_plug_device_noop);
@@ -460,11 +450,6 @@remove_proc_entry (LVM_NAME , &proc_root);#endif -#ifdef LVM_HD_NAME -/* reference from linux/drivers/block/genhd.c */ - lvm_hd_name_ptr =NULL ; -#endif -printk (KERN_INFO "%s -- Module successfully deactivated\n" , lvm_name);return ;
@@ -1448,24 +1433,22 @@* internal support functions */ -#ifdef LVM_HD_NAME /* * generate "hard disk" name */ -void lvm_hd_name (char *buf,int minor) +char *lvm_hd_name (struct gendisk *hd,int minor,char *buf) {int len =0 ;lv_t *lv_ptr;if (vg[VG_BLK (minor)] ==NULL || (lv_ptr = vg[VG_BLK (minor)]->lv[LV_BLK (minor)]) ==NULL ) -return ; +return buf; len =strlen (lv_ptr->lv_name) -5 ;memcpy (buf, &lv_ptr->lv_name[5 ], len); buf[len] =0 ; -return ; +return buf; } -#endif /*
@@ -2515,6 +2498,8 @@ blksize_size[MAJOR_NR ] = lvm_blocksizes; blk_size[MAJOR_NR ] = lvm_size; + + lvm_gendisk.hd_name=lvm_hd_name;return ; }/* lvm_gen_init() */
drivers/md/md.c +11 -0
@@ -113,6 +113,8 @@extern struct block_device_operations md_fops;static devfs_handle_t devfs_handle; +char *md_disk_name (struct gendisk *,int ,char *); +static struct gendisk md_gendisk= { major:MD_MAJOR ,
@@ -125,6 +127,7 @@ real_devices: NULL, next: NULL, fops: &md_fops, + hd_name: md_disk_name, };/*
@@ -215,6 +218,14 @@MOD_INC_USE_COUNT ;return mddev; +} + +char *md_disk_name (struct gendisk *hd,int minor,char * buf) + +{ +int unit = (minor >> hd->minor_shift) +'0' ; +sprintf (buf,"%s%c" , hd->major_name, unit); +return buf; }struct gendisk *find_gendisk (kdev_t dev)
drivers/scsi/sd.c +25 -0
@@ -1013,6 +1013,30 @@return i; } +char *scsi_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int unit = (minor >> hd->minor_shift) +'a' ; +unsigned int part = minor & ((1 << hd->minor_shift) -1 ); + +if (hd->major >=SCSI_DISK1_MAJOR && hd->major <=SCSI_DISK7_MAJOR ) { + unit = unit + (hd->major -SCSI_DISK1_MAJOR +1 ) *16 ; +if (unit >'z' ) { + unit -='z' +1 ; +sprintf (buf,"sd%c%c" ,'a' + unit /26 ,'a' + unit %26 ); +if (part) +sprintf (buf +4 ,"%d" , part); +return buf; + } + } + +if (part) +sprintf (buf,"sd%c%d" , unit, part); +else +sprintf (buf,"sd%c" , unit); +return buf; +} +/* * The sd_init() function looks at all SCSI drives present, determines * their size, and reads partition table entries for them.
@@ -1109,6 +1133,7 @@ sd_gendisks[i].next = sd_gendisks + i +1 ; sd_gendisks[i].real_devices = (void *) (rscsi_disks + i *SCSI_DISKS_PER_MAJOR ); + sd_gendisks[i].hd_name=scsi_disk_name; }LAST_SD_GENDISK .next =NULL ;
fs/partitions/check.c +3 -73
91 lines not on this page · raw message
include/linux/genhd.h +2 -0
@@ -72,6 +72,8 @@devfs_handle_t *de_arr;/* one per physical disc */ char *flags;/* one per physical disc */ + + char *(*hd_name) (struct gendisk *, int, char *); };#endif /* __KERNEL__ */
Re: RFC: Modularize /proc/partitons (was Re: /proc/partitions for LVM)
In reply to Brian Kress[Brian Kress]
Quoted 7 lines
1) Add a function pointer to struct gendisk called
hd_name.2) Make
disk_nameinfs/partitions/check.cuse that function pointer if its non-null.3) Change the following drivers to use this method. (adding the driver specific method and removing the old code in
check.c)
Looks good to me ... except that cpqarray.c, cciss.c and DAC960.c have basically duplicate functions. Would this be a net win:
char *typical_disk_name(struct gendisk *, int major_base, int minor, char *buf);
...exported from check.c?
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
Re: RFC: Modularize /proc/partitons (was Re: /proc/partitions for LVM)
In reply to Brian KressLooks good to me.
Regards,
Heinz -- The LVM guy --
Quoted 68 lines · Brian Kress
Quoted 44 lines · Heinz J. Mauelshagen
Quoted 17 lines · Brian Kress
Quoted 9 lines · Heinz J. Mauelshagen
Quoted 6 lines · Brian Kress
Question about
/proc/partitionsand LVM. LVM devices in/proc/partitionscurrently show up as lvma, lvmb, etc, depending on their device number. This breaks things like mount by filesystem name. Back when LVM existed as a patch, I believe there was some support infs/partitions/check.cfor showing the proper name for the device (something like <vgname>/<lvname>).Quoted 6 lines
Yes.
It actually was <vgname>/<lvname>.Linus didn't accept it though.
The code is still available in case he changes his mind.
Quoted 7 lines
Yes, I can see that now looking through
lvm.c. (LVM_HD_NAME)
I'm guessing why he didn't take it is the minor hack of adding a function pointer togenhd.cas a special case just for LVM.
A general solution to this problem would be nice. The
big switch statement indisk_nameinfs/paritions/check.cis kind of ugly as it has generic code have to know things about specific drivers.Yep.
Quoted 3 lines
How's this for an idea to generalize this. Put a function
pointer in the gendisk structure for a specific function to call fordisk_namefor disks for that gendisk.Sounds resonable to me.
Quoted 8 lines
That way, LVM gets its
<vgname>/<lvname>, IDE gets its two disks per major (special cased right now), all the other special cases get what they need and future drivers can call their devices whatever they like without touching this file. Makes the whole thing more modular. Make a NULL for this function default to the old <name>a, <name>b, etc.
What to people think about this? If this sounds reasonable
I can come up with a patch.Quoted 2 lines
Very good. I'ld appreciate it.
OK, here's the patch. It has three sets of changes:
1) Add a function pointer to struct gendisk called
hd_name.2) Make
disk_nameinfs/partitions/check.cuse that function pointer if its non-null.3) Change the following drivers to use this method. (adding the driver specific method and removing the old code in
check.c)
drivers/md/lvm.cdrivers/md/md.cdrivers/ide/ide-probe.cdrivers/scsi/sd.cdrivers/block/cpqarray.cdrivers/block/cciss.cdrivers/block/DAC960.c
Quoted 2 lines
Let me know what you think. Think there's any chance we
can get this in the main kernel tree?
Linus can answer that one ;-)
Quoted 415 lines
Brian Kress
[email protected]
diff -u --recursivelinux-2.4.0-test11/drivers/block/DAC960.clinux-2.4.0-test11-ppfix/drivers/block/DAC960.cdrivers/block/DAC960.c +16
-0@@ -1885,6 +1885,21 @@ } +char *DAC960_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -DAC960_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} + +/* DAC960_RegisterBlockDevice registers the Block Device structures associated with Controller. @@ -1945,6 +1960,7 @@ Controller->GenericDiskInfo.nr_real = Controller->LogicalDriveCount; Controller->GenericDiskInfo.next =NULL ; Controller->GenericDiskInfo.fops = &DAC960_BlockDeviceOperations; + Controller->GenericDiskInfo.hd_name = DAC960_disk_name;/* Install the Generic Disk Information structure at the end of the list. */ diff -u --recursive
linux-2.4.0-test11/drivers/block/cciss.clinux-2.4.0-test11-ppfix/drivers/block/cciss.cdrivers/block/cciss.c +15
-0@@ -1749,6 +1749,20 @@kfree (size_buff); } +char *cciss_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -COMPAQ_CISS_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} +/* * This is it. Find all the controllers and register them. I really hate * stealing all these major device numbers. @@ -1851,6 +1865,7 @@ hba[i]->gendisk.part = hba[i]->hd; hba[i]->gendisk.sizes = hba[i]->sizes; hba[i]->gendisk.nr_real = hba[i]->num_luns; + hba[i]->gendisk.hd_name = cciss_disk_name;/* Get on the disk list */ hba[i]->gendisk.next = gendisk_head;diff -u --recursive
linux-2.4.0-test11/drivers/block/cpqarray.clinux-2.4.0-test11-ppfix/drivers/block/cpqarray.cdrivers/block/cpqarray.c +15
-0@@ -362,6 +362,20 @@ }#endif /* MODULE */ +char *ida_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int ctlr = hd->major -COMPAQ_SMART2_MAJOR ; +int disk = minor >> hd->minor_shift; +int part = minor & ((1 << hd->minor_shift) -1 ); + +if (part) +sprintf (buf,"%s/c%dd%dp%d" , hd->major_name, ctlr, disk, part); +else +sprintf (buf,"%s/c%dd%d" , hd->major_name, ctlr, disk); +return buf; +} +/* * This is it. Find all the controllers and register them. I really hate * stealing all these major device numbers. @@ -512,6 +526,7 @@ ida_gendisk[i].part = ida + (i*256 ); ida_gendisk[i].sizes = ida_sizes + (i*256 ); ida_gendisk[i].nr_real =0 ; + ida_gendisk[i].hd_name = ida_disk_name;/* Get on the disk list */ ida_gendisk[i].next = gendisk_head;diff -u --recursive
linux-2.4.0-test11/drivers/ide/ide-probe.clinux-2.4.0-test11-ppfix/drivers/ide/ide-probe.cdrivers/ide/ide-probe.c +35
-0@@ -726,6 +726,40 @@return 0 ; } +char *ide_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int unit = (minor >> hd->minor_shift) +'a' ; +unsigned int part = minor & ((1 << hd->minor_shift) -1 ); + +switch (hd->major) { +case IDE9_MAJOR : + unit +=2 ; +case IDE8_MAJOR : + unit +=2 ; +case IDE7_MAJOR : + unit +=2 ; +case IDE6_MAJOR : + unit +=2 ; +case IDE5_MAJOR : + unit +=2 ; +case IDE4_MAJOR : + unit +=2 ; +case IDE3_MAJOR : + unit +=2 ; +case IDE2_MAJOR : + unit +=2 ; +case IDE1_MAJOR : + unit +=2 ; +case IDE0_MAJOR : + } +if (part) +sprintf (buf,"hd%c%d" , unit, part); +else +sprintf (buf,"hd%c" , unit); +return buf; +} +/* * init_gendisk() (as opposed to ide_geninit) is called for each major device, * after probing for drives, to allocate partition tables and other data @@ -781,6 +815,7 @@ gd->fops = ide_fops;/* file operations */ gd->de_arr =kmalloc (sizeof *gd->de_arr * units,GFP_KERNEL ); gd->flags =kmalloc (sizeof *gd->flags * units,GFP_KERNEL ); + gd->hd_name = ide_disk_name;if (gd->de_arr)memset (gd->de_arr,0 ,sizeof *gd->de_arr * units);if (gd->flags)diff -u --recursive
linux-2.4.0-test11/drivers/md/lvm.clinux-2.4.0-test11-ppfix/drivers/md/lvm.cdrivers/md/lvm.c +6
-21@@ -213,9 +213,7 @@ &lvm_proc_get_info;#endif -#ifdef LVM_HD_NAME -void lvm_hd_name (char *,int ); -#endif +char *lvm_hd_name (struct gendisk *,int ,char *);/* End external function prototypes */ @@ -230,9 +228,6 @@int lvm_snapshot_alloc (lv_t *);void lvm_snapshot_release (lv_t *); -#ifdef LVM_HD_NAME -extern void (*lvm_hd_name_ptr) (char *,int ); -#endif static int lvm_map (struct buffer_head *,int );static int lvm_do_lock_lvm (void );static int lvm_do_le_remap (vg_t *,void *);@@ -397,11 +392,6 @@ lvm_gendisk.next =NULL ; } -#ifdef LVM_HD_NAME -/* reference from drivers/block/genhd.c */ - lvm_hd_name_ptr = lvm_hd_name; -#endif -blk_init_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ),DEVICE_REQUEST );blk_queue_make_request (BLK_DEFAULT_QUEUE (MAJOR_NR ), lvm_make_request_fn);blk_queue_pluggable (BLK_DEFAULT_QUEUE (MAJOR_NR ), lvm_plug_device_noop);@@ -460,11 +450,6 @@remove_proc_entry (LVM_NAME , &proc_root);#endif -#ifdef LVM_HD_NAME -/* reference from linux/drivers/block/genhd.c */ - lvm_hd_name_ptr =NULL ; -#endif -printk (KERN_INFO "%s -- Module successfully deactivated\n" , lvm_name);return ;@@ -1448,24 +1433,22 @@* internal support functions */ -#ifdef LVM_HD_NAME /* * generate "hard disk" name */ -void lvm_hd_name (char *buf,int minor) +char *lvm_hd_name (struct gendisk *hd,int minor,char *buf) {int len =0 ;lv_t *lv_ptr;if (vg[VG_BLK (minor)] ==NULL || (lv_ptr = vg[VG_BLK (minor)]->lv[LV_BLK (minor)]) ==NULL ) -return ; +return buf; len =strlen (lv_ptr->lv_name) -5 ;memcpy (buf, &lv_ptr->lv_name[5 ], len); buf[len] =0 ; -return ; +return buf; } -#endif /* @@ -2515,6 +2498,8 @@ blksize_size[MAJOR_NR ] = lvm_blocksizes; blk_size[MAJOR_NR ] = lvm_size; + + lvm_gendisk.hd_name=lvm_hd_name;return ; }/* lvm_gen_init() */ diff -u --recursive
linux-2.4.0-test11/drivers/md/md.clinux-2.4.0-test11-ppfix/drivers/md/md.cdrivers/md/md.c +11
-0@@ -113,6 +113,8 @@extern struct block_device_operations md_fops;static devfs_handle_t devfs_handle; +char *md_disk_name (struct gendisk *,int ,char *); +static struct gendisk md_gendisk= { major:MD_MAJOR ,@@ -125,6 +127,7 @@ real_devices: NULL, next: NULL, fops: &md_fops, + hd_name: md_disk_name, };/* @@ -215,6 +218,14 @@MOD_INC_USE_COUNT ;return mddev; +} + +char *md_disk_name (struct gendisk *hd,int minor,char * buf) + +{ +int unit = (minor >> hd->minor_shift) +'0' ; +sprintf (buf,"%s%c" , hd->major_name, unit); +return buf; }struct gendisk *find_gendisk (kdev_t dev)diff -u --recursive
linux-2.4.0-test11/drivers/scsi/sd.clinux-2.4.0-test11-ppfix/drivers/scsi/sd.cdrivers/scsi/sd.c +25
-0@@ -1013,6 +1013,30 @@return i; } +char *scsi_disk_name (struct gendisk *hd,int minor,char *buf) + +{ +int unit = (minor >> hd->minor_shift) +'a' ; +unsigned int part = minor & ((1 << hd->minor_shift) -1 ); + +if (hd->major >=SCSI_DISK1_MAJOR && hd->major <=SCSI_DISK7_MAJOR ) { + unit = unit + (hd->major -SCSI_DISK1_MAJOR +1 ) *16 ; +if (unit >'z' ) { + unit -='z' +1 ; +sprintf (buf,"sd%c%c" ,'a' + unit /26 ,'a' + unit %26 ); +if (part) +sprintf (buf +4 ,"%d" , part); +return buf; + } + } + +if (part) +sprintf (buf,"sd%c%d" , unit, part); +else +sprintf (buf,"sd%c" , unit); +return buf; +} +/* * The sd_init() function looks at all SCSI drives present, determines * their size, and reads partition table entries for them. @@ -1109,6 +1133,7 @@ sd_gendisks[i].next = sd_gendisks + i +1 ; sd_gendisks[i].real_devices = (void *) (rscsi_disks + i *SCSI_DISKS_PER_MAJOR ); + sd_gendisks[i].hd_name=scsi_disk_name; }LAST_SD_GENDISK .next =NULL ;diff -u --recursive
linux-2.4.0-test11/fs/partitions/check.clinux-2.4.0-test11-ppfix/fs/partitions/check.cfs/partitions/check.c +3
-73@@ -83,11 +83,10 @@*/ char *disk_name (struct gendisk *hd,int minor,char *buf) { -unsigned int part;const char *maj = hd->major_name;int unit = (minor >> hd->minor_shift) +'a' ; +unsigned int part = minor & ((1 << hd->minor_shift) -1 ); - part = minor & ((1 << hd->minor_shift) -1 );if (hd->part[minor].de) {int pos;@@ -95,77 +94,8 @@if (pos >=0 )return buf + pos; } -/* -* IDE devices use multiple major numbers, but the drives -* are named as: {hda,hdb}, {hdc,hdd}, {hde,hdf}, {hdg,hdh}.. -* This requires special handling here. -*/ -switch (hd->major) { -case IDE9_MAJOR : - unit +=2 ; -case IDE8_MAJOR : - unit +=2 ; -case IDE7_MAJOR : - unit +=2 ; -case IDE6_MAJOR : - unit +=2 ; -case IDE5_MAJOR : - unit +=2 ; -case IDE4_MAJOR : - unit +=2 ; -case IDE3_MAJOR : - unit +=2 ; -case IDE2_MAJOR : - unit +=2 ; -case IDE1_MAJOR : - unit +=2 ; -case IDE0_MAJOR : - maj ="hd" ; -break ; -case MD_MAJOR : - unit -='a' -'0' ; -break ; - } -if (hd->major >=SCSI_DISK1_MAJOR && hd->major <=SCSI_DISK7_MAJOR ) { - unit = unit + (hd->major -SCSI_DISK1_MAJOR +1 ) *16 ; -if (unit >'z' ) { - unit -='z' +1 ; -sprintf (buf,"sd%c%c" ,'a' + unit /26 ,'a' + unit %26 ); -if (part) -sprintf (buf +4 ,"%d" , part); -return buf; - } - } -if (hd->major >=COMPAQ_SMART2_MAJOR && hd->major <=COMPAQ_SMART2_MAJOR +7 ) { -int ctlr = hd->major -COMPAQ_SMART2_MAJOR ; -int disk = minor >> hd->minor_shift; -int part = minor & ((1 << hd->minor_shift) -1 ); -if (part ==0 ) -sprintf (buf,"%s/c%dd%d" , maj, ctlr, disk); -else -sprintf (buf,"%s/c%dd%dp%d" , maj, ctlr, disk, part); -return buf; - } -if (hd->major >=COMPAQ_CISS_MAJOR && hd->major <=COMPAQ_CISS_MAJOR +7 ) { -int ctlr = hd->major -COMPAQ_CISS_MAJOR ; -int disk = minor >> hd->minor_shift; -int part = minor & ((1 << hd->minor_shift) -1 ); -if (part ==0 ) -sprintf (buf,"%s/c%dd%d" , maj, ctlr, disk); -else -sprintf (buf,"%s/c%dd%dp%d" , maj, ctlr, disk, part); -return buf; - } -if (hd->major >=DAC960_MAJOR && hd->major <=DAC960_MAJOR +7 ) { -int ctlr = hd->major -DAC960_MAJOR ; -int disk = minor >> hd->minor_shift; -int part = minor & ((1 << hd->minor_shift) -1 ); -if (part ==0 ) -sprintf (buf,"%s/c%dd%d" , maj, ctlr, disk); -else -sprintf (buf,"%s/c%dd%dp%d" , maj, ctlr, disk, part); -return buf; - } +if (hd->hd_name)return hd->hd_name (hd, minor, buf); +if (part)sprintf (buf,"%s%c%d" , maj, unit, part);else diff -u --recursive
linux-2.4.0-test11/include/linux/genhd.hlinux-2.4.0-test11-ppfix/include/linux/genhd.h
include/linux/genhd.h line 79
Quoted 8 lines
include/linux/genhd.h +2
-0@@ -72,6 +72,8 @@devfs_handle_t *de_arr;/* one per physical disc */ char *flags;/* one per physical disc */ + + char *(*hd_name) (struct gendisk *, int, char *); };#endif /* __KERNEL__ */
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Heinz Mauelshagen Sistina Software Inc.
Senior Consultant/Developer Bartningstr. 12
64289 Darmstadt
Germany
[email protected] +49 6151 7103 86
FAX 7103 96=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/