2.3.99pre3-6 devfs and Config [PATCH]

From: Andrzej Krzysztofowicz (ankry@green.mif.pg.gda.pl)
Date: Wed Mar 22 2000 - 20:14:58 EST


Hi,
   The following two patches fixes some 2.3.99pre3-3 (and older) problems:

1. Fixed devfs oops with second-level partition checking (devfs/non-devfs
   names were mixed and long name was used in places where, IMHO, a short
   one is expected) by adding a new function short_partition_name().
   A comment fixed.

2. CONFIG_PCI shouldn't be used as dependency as it is *NOT* defined
   (has empty value) for some architectures. Shells without quotes
   cannot handle it then.
   [ Maybe, this problem will be fixed in a next config language/parsers
     generation, but not now ]

   CONFIG_HOTPLUG added as dependency for IDE PCMCIA option.
   (CONFIG_PCMCIA may be undefined result - as above)

Regards
   Andrzej

********************** patch 1 **********************************
--- fs/partitions/check.c.old Sat Feb 26 17:25:35 2000
+++ fs/partitions/check.c Thu Mar 23 01:48:49 2000
@@ -72,7 +72,7 @@
 };
 
 /*
- * disk_name() is used by genhd.c and blkpg.c.
+ * disk_name() is used by md.c.
  * It formats the devicename of the indicated disk into
  * the supplied buffer (of size at least 32), and returns
  * a pointer to that same buffer (for convenience).
@@ -157,24 +157,34 @@
 }
 
 /*
- * Add a partitions details to the devices partition description.
+ * short_partition_name() is also used in msdos.c.
+ * It formats the base name of the indicated partition (without directory
+ * path) into the supplied buffer (of size at least 7), and returns
+ * a pointer to that same buffer (for convenience).
  */
-void add_gd_partition(struct gendisk *hd, int minor, int start, int size)
+char *short_partition_name (struct gendisk *hd, int minor, char *buf)
 {
-#ifndef CONFIG_DEVFS_FS
- char buf[40];
-#endif
-
- hd->part[minor].start_sect = start;
- hd->part[minor].nr_sects = size;
 #ifdef CONFIG_DEVFS_FS
- printk(" p%d", (minor & ((1 << hd->minor_shift) - 1)));
+ sprintf(buf, "p%d", (minor & ((1 << hd->minor_shift) - 1)));
 #else
         if (hd->major >= COMPAQ_SMART2_MAJOR+0 && hd->major <= COMPAQ_SMART2_MAJOR+7)
- printk(" p%d", (minor & ((1 << hd->minor_shift) - 1)));
+ sprintf(buf, "p%d", (minor & ((1 << hd->minor_shift) - 1)));
         else
- printk(" %s", disk_name(hd, minor, buf));
+ sprintf(buf, "%s", disk_name(hd, minor, buf));
 #endif
+ return buf;
+}
+
+/*
+ * Add a partitions details to the devices partition description.
+ */
+void add_gd_partition(struct gendisk *hd, int minor, int start, int size)
+{
+ char buf[10];
+
+ hd->part[minor].start_sect = start;
+ hd->part[minor].nr_sects = size;
+ printk(" %s", short_partition_name(hd, minor, buf));
 }
 
 int get_hardsect_size(kdev_t dev)
--- fs/partitions/msdos.c.old Thu Mar 23 01:22:20 2000
+++ fs/partitions/msdos.c Thu Mar 23 01:39:05 2000
@@ -191,7 +191,7 @@
                 brelse(bh);
                 return;
         }
- printk(" %s: <solaris:", disk_name(hd, minor, buf));
+ printk(" %s: <solaris:", short_partition_name(hd, minor, buf));
         if(v->v_version != 1) {
                 printk(" cannot handle version %ld vtoc>\n", v->v_version);
                 brelse(bh);
@@ -276,7 +276,7 @@
                 brelse(bh);
                 return;
         }
- printk(" %s:", disk_name(hd, minor, buf));
+ printk(" %s:", short_partition_name(hd, minor, buf));
         printk((type == OPENBSD_PARTITION) ? " <openbsd:" :
                (type == NETBSD_PARTITION) ? " <netbsd:" : " <bsd:");
 
@@ -319,7 +319,7 @@
                 brelse(bh);
                 return;
         }
- printk(" %s: <unixware:", disk_name(hd, minor, buf));
+ printk(" %s: <unixware:", short_partition_name(hd, minor, buf));
         p = &l->vtoc.v_slice[1];
         /* I omit the 0th slice as it is the same as whole disk. */
         while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) {
--- include/linux/genhd.h.old Thu Mar 23 01:42:13 2000
+++ include/linux/genhd.h Thu Mar 23 01:42:46 2000
@@ -227,6 +227,7 @@
 extern struct gendisk *gendisk_head; /* linked list of disks */
 
 char *disk_name (struct gendisk *hd, int minor, char *buf);
+char *short_partition_name (struct gendisk *hd, int minor, char *buf);
 
 extern void devfs_register_partitions (struct gendisk *dev, int minor,
                                        int unregister);
********************** patch 2 **********************************
--- drivers/ide/Config.in.old Thu Mar 23 00:50:54 2000
+++ drivers/ide/Config.in Thu Mar 23 00:53:38 2000
@@ -12,7 +12,7 @@
 
    dep_tristate ' Include IDE/ATA-2 DISK support' CONFIG_BLK_DEV_IDEDISK $CONFIG_BLK_DEV_IDE
    dep_mbool ' Use multi-mode by default' CONFIG_IDEDISK_MULTI_MODE $CONFIG_BLK_DEV_IDEDISK
- dep_tristate ' PCMCIA IDE support' CONFIG_BLK_DEV_IDECS $CONFIG_BLK_DEV_IDE $CONFIG_PCMCIA
+ dep_tristate ' PCMCIA IDE support' CONFIG_BLK_DEV_IDECS $CONFIG_BLK_DEV_IDE $CONFIG_HOTPLUG $CONFIG_PCMCIA
    dep_tristate ' Include IDE/ATAPI CDROM support' CONFIG_BLK_DEV_IDECD $CONFIG_BLK_DEV_IDE
    dep_tristate ' Include IDE/ATAPI TAPE support' CONFIG_BLK_DEV_IDETAPE $CONFIG_BLK_DEV_IDE
    dep_tristate ' Include IDE/ATAPI FLOPPY support' CONFIG_BLK_DEV_IDEFLOPPY $CONFIG_BLK_DEV_IDE
--- drivers/net/Config.in.orig Thu Mar 23 00:43:02 2000
+++ drivers/net/Config.in Thu Mar 23 00:50:38 2000
@@ -124,7 +124,9 @@
    bool ' EISA, VLB, PCI and on board controllers' CONFIG_NET_PCI
    if [ "$CONFIG_NET_PCI" = "y" ]; then
       tristate ' AMD PCnet32 (VLB and PCI) support' CONFIG_PCNET32
- dep_tristate ' Adaptec Starfire support (EXPERIMENTAL)' CONFIG_ADAPTEC_STARFIRE $CONFIG_PCI $CONFIG_EXPERIMENTAL
+ if [ "$CONFIG_PCI" = "y" ]; then
+ dep_tristate ' Adaptec Starfire support (EXPERIMENTAL)' CONFIG_ADAPTEC_STARFIRE $CONFIG_EXPERIMENTAL
+ fi
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
          tristate ' Ansel Communications EISA 3200 support (EXPERIMENTAL)' CONFIG_AC3200
       fi
@@ -132,12 +134,16 @@
       tristate ' Apricot Xen-II on board Ethernet' CONFIG_APRICOT
       tristate ' CS89x0 support' CONFIG_CS89x0
       tristate ' Generic DECchip & DIGITAL EtherWORKS PCI/EISA' CONFIG_DE4X5
- dep_tristate ' DECchip Tulip (dc21x4x) PCI support' CONFIG_TULIP $CONFIG_PCI
+ if [ "$CONFIG_PCI" = "y" ]; then
+ tristate ' DECchip Tulip (dc21x4x) PCI support' CONFIG_TULIP
+ fi
       tristate ' Digi Intl. RightSwitch SE-X support' CONFIG_DGRS
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
          tristate ' DM9102 PCI Fast Ethernet Adapter support (EXPERIMENTAL)' CONFIG_DM9102
       fi
- dep_tristate ' EtherExpressPro/100 support' CONFIG_EEPRO100 $CONFIG_PCI
+ if [ "$CONFIG_PCI" = "y" ]; then
+ tristate ' EtherExpressPro/100 support' CONFIG_EEPRO100
+ fi
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
          if [ "$CONFIG_EEPRO100" = "y" -o "$CONFIG_EEPRO100" = "m" ]; then
             bool ' Enable Power Management (EXPERIMENTAL)' CONFIG_EEPRO100_PM
@@ -145,7 +151,9 @@
          tristate ' Mylex EISA LNE390A/B support (EXPERIMENTAL)' CONFIG_LNE390
          tristate ' Novell/Eagle/Microdyne NE3210 EISA support (EXPERIMENTAL)' CONFIG_NE3210
       fi
- dep_tristate ' PCI NE2000 support' CONFIG_NE2K_PCI $CONFIG_PCI
+ if [ "$CONFIG_PCI" = "y" ]; then
+ tristate ' PCI NE2000 support' CONFIG_NE2K_PCI
+ fi
       # tristate ' Sundance Alta support' CONFIG_ALTA
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
          tristate ' RealTek 8129 (not 8019/8029!) support (EXPERIMENTAL)' CONFIG_RTL8129
@@ -241,7 +249,9 @@
    dep_tristate ' Aironet 4500/4800 ISA/PCI/PNP/365 support ' CONFIG_AIRONET4500_NONCS $CONFIG_AIRONET4500
    if [ "$CONFIG_AIRONET4500" != "n" -a "$CONFIG_AIRONET4500_NONCS" != "n" ]; then
       bool ' Aironet 4500/4800 PNP support ' CONFIG_AIRONET4500_PNP
- dep_bool ' Aironet 4500/4800 PCI support ' CONFIG_AIRONET4500_PCI $CONFIG_PCI
+ if [ "$CONFIG_PCI" = "y" ]; then
+ bool ' Aironet 4500/4800 PCI support ' CONFIG_AIRONET4500_PCI
+ fi
       dep_bool ' Aironet 4500/4800 ISA broken support (EXPERIMENTAL)' CONFIG_AIRONET4500_ISA $CONFIG_EXPERIMENTAL
       dep_bool ' Aironet 4500/4800 I365 broken support (EXPERIMENTAL)' CONFIG_AIRONET4500_I365 $CONFIG_EXPERIMENTAL
    fi
********************** patch 2 **********************************

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Technical University of Gdansk

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:37 EST