Skip to contentSkip to conversation

Patch: modularizing partition parsing in linux-2.4.0-test10-pre6

PATCH Adam J. Richter 1 participant 1 message Oct 30, 2000

lore
Share & tools
lore
#0 lore raw

Ages ago, I modularized the partition parsing code and
posted the patch to linux-kernel. I received a few suggestions for some small improvements, and I confess it took me a while to get around to producing a new patch. Anyhow, here is the new partitioning modularization patch. It now longer has any "#ifdef MODULE" code in it. It just has one module-centric SMP-safe initialization scheme.

I would appreciate it if people would try this patch
and make sure that it works for them.

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
[email protected]     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America

fax +1 408 261-6631 "Free Software For The Rest Of Us."

----------------------CUT HERE--------------------------------

fs/partitions/Config.in +10 -10
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/Config.in linux/fs/partitions/Config.in
@@ -3,7 +3,7 @@
 #
 bool 'Advanced partition selection' CONFIG_PARTITION_ADVANCED
 if [ "$CONFIG_PARTITION_ADVANCED" = "y" ]; then
-   bool '  Acorn partition support' CONFIG_ACORN_PARTITION
+   tristate '  Acorn partition support' CONFIG_ACORN_PARTITION
    if [ "$CONFIG_ACORN_PARTITION" != "n" ]; then
 #      bool '    Cumana partition support' CONFIG_ACORN_PARTITION_CUMANA
       bool '    ICS partition support' CONFIG_ACORN_PARTITION_ICS
@@ -11,22 +11,22 @@
       bool '    PowerTec partition support' CONFIG_ACORN_PARTITION_POWERTEC
       bool '    RISCiX partition support' CONFIG_ACORN_PARTITION_RISCIX
    fi
-   bool '  Alpha OSF partition support' CONFIG_OSF_PARTITION
-   bool '  Amiga partition table support' CONFIG_AMIGA_PARTITION
-   bool '  Atari partition table support' CONFIG_ATARI_PARTITION
+   tristate '  Alpha OSF partition support' CONFIG_OSF_PARTITION
+   tristate '  Amiga partition table support' CONFIG_AMIGA_PARTITION
+   tristate '  Atari partition table support' CONFIG_ATARI_PARTITION
    if [ "$CONFIG_ARCH_S390" = "y" ]; then
       bool '  IBM disk label and partition support' CONFIG_IBM_PARTITION
    fi
-   bool '  Macintosh partition map support' CONFIG_MAC_PARTITION
-   bool '  PC BIOS (MSDOS partition tables) support' CONFIG_MSDOS_PARTITION
-   if [ "$CONFIG_MSDOS_PARTITION" = "y" ]; then
+   tristate '  Macintosh partition map support' CONFIG_MAC_PARTITION
+   tristate '  PC BIOS (MSDOS partition tables) support' CONFIG_MSDOS_PARTITION
+   if [ "$CONFIG_MSDOS_PARTITION" != "n" ]; then
       bool '    BSD disklabel (FreeBSD partition tables) support' CONFIG_BSD_DISKLABEL
       bool '    Solaris (x86) partition table support' CONFIG_SOLARIS_X86_PARTITION
       bool '    Unixware slices support' CONFIG_UNIXWARE_DISKLABEL
    fi
-   bool '  SGI partition support' CONFIG_SGI_PARTITION
-   bool '  Ultrix partition table support' CONFIG_ULTRIX_PARTITION
-   bool '  Sun partition tables support' CONFIG_SUN_PARTITION
+   tristate '  SGI partition support' CONFIG_SGI_PARTITION
+   tristate '  Ultrix partition table support' CONFIG_ULTRIX_PARTITION
+   tristate '  Sun partition tables support' CONFIG_SUN_PARTITION
 else
    if [ "$ARCH" = "alpha" ]; then
       define_bool CONFIG_OSF_PARTITION y
fs/partitions/Makefile +1 -1
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/Makefile linux/fs/partitions/Makefile
@@ -14,7 +14,7 @@
 obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
 obj-$(CONFIG_ATARI_PARTITION) += atari.o
 obj-$(CONFIG_MAC_PARTITION) += mac.o
-obj-$(CONFIG_MSDOS_PARTITION) += msdos.o
+obj-$(CONFIG_MSDOS_PARTITION) += msdos_part.o
 obj-$(CONFIG_OSF_PARTITION) += osf.o
 obj-$(CONFIG_SGI_PARTITION) += sgi.o
 obj-$(CONFIG_SUN_PARTITION) += sun.o
fs/partitions/acorn.c +6 -2
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/acorn.c linux/fs/partitions/acorn.c
@@ -478,8 +478,9 @@
  *
  * Returns: -1 on error, 0 if not ADFS format, 1 if ok.
  */
-int acorn_partition(struct gendisk *hd, kdev_t dev,
-		    unsigned long first_sect, int first_minor)
+static int
+acorn_partition(struct gendisk *hd, kdev_t dev,
+		unsigned long first_sect, int first_minor)
 {
 	int r = 0, i;
 
@@ -492,3 +493,6 @@
 		printk("\n");
 	return r;
 }
+
+#define check_partition acorn_partition
+#include "partition_module.h"
fs/partitions/amiga.c +6 -2
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/amiga.c linux/fs/partitions/amiga.c
@@ -30,8 +30,9 @@
 	return sum;
 }
 
-int
-amiga_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int first_part_minor)
+static int
+amiga_partition(struct gendisk *hd, kdev_t dev,
+		unsigned long first_sector, int first_part_minor)
 {
 	struct buffer_head	*bh;
 	struct RigidDiskBlock	*rdb;
@@ -118,3 +119,6 @@
 	set_blocksize(dev,old_blocksize);
 	return res;
 }
+
+#define check_partition amiga_partition
+#include "partition_module.h"
fs/partitions/atari.c +5 -3
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/atari.c linux/fs/partitions/atari.c
@@ -33,8 +33,9 @@
      be32_to_cpu((pi)->st) <= (hdsiz) &&				     \
      be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
 
-int atari_partition (struct gendisk *hd, kdev_t dev,
-		     unsigned long first_sector, int minor)
+static int
+atari_partition (struct gendisk *hd, kdev_t dev,
+		 unsigned long first_sector, int minor)
 {
   int m_lim = minor + hd->max_p;
   struct buffer_head *bh;
@@ -62,7 +63,6 @@
       /* if there's no valid primary partition, assume that no Atari
 	 format partition table (there's no reliable magic or the like
 	 :-() */
-      brelse(bh);
       return 0;
   }
 
@@ -176,3 +176,5 @@
   return 1;
 }
 
+#define check_partition atari_partition
+#include "partition_module.h"
fs/partitions/check.c +54 -38

155 lines not on this page · raw message

fs/partitions/ibm.c +3 -1
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/ibm.c linux/fs/partitions/ibm.c
@@ -43,7 +43,7 @@
   return ibm_partition_none;
 }
 
-void
+static void
 ibm_partition (struct gendisk *hd, kdev_t dev)
 {
 	struct buffer_head *bh;
@@ -120,3 +120,5 @@
 	bforget(bh);
 }
 
+#define check_partition ibm_partition
+#include "partition_module.h"
fs/partitions/mac.c +5 -1
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/mac.c linux/fs/partitions/mac.c
@@ -36,7 +36,9 @@
 		stg[i] = 0;
 }
 
-int mac_partition(struct gendisk *hd, kdev_t dev, unsigned long fsec, int first_part_minor)
+static int
+mac_partition(struct gendisk *hd, kdev_t dev, unsigned long fsec,
+	      int first_part_minor)
 {
 	struct buffer_head *bh;
 	int blk, blocks_in_map;
@@ -152,3 +154,5 @@
 	return 1;
 }
 
+#define check_partition mac_partition
+#include "partition_module.h"
fs/partitions/msdos.c +0 -515

515 lines not on this page · raw message

fs/partitions/msdos_part.c +517 -0

517 lines not on this page · raw message

fs/partitions/osf.c +5 -2
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/osf.c linux/fs/partitions/osf.c
@@ -17,8 +17,9 @@
 #include "check.h"
 #include "osf.h"
 
-int osf_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector,
-		  int current_minor)
+static int
+osf_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector,
+	      int current_minor)
 {
 	int i;
 	int mask = (1 << hd->minor_shift) - 1;
@@ -84,3 +85,5 @@
 	return 1;
 }
 
+#define check_partition osf_partition
+#include "partition_module.h"
fs/partitions/partition_module.h +43 -0

43 lines not on this page · raw message

fs/partitions/sgi.c +6 -1
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/sgi.c linux/fs/partitions/sgi.c
@@ -17,7 +17,9 @@
 #include "check.h"
 #include "sgi.h"
 
-int sgi_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int current_minor)
+static int
+sgi_partition(struct gendisk *hd, kdev_t dev,
+	      unsigned long first_sector, int current_minor)
 {
 	int i, csum, magic;
 	unsigned int *ui, start, blocks, cs;
@@ -84,3 +86,6 @@
 	brelse(bh);
 	return 1;
 }
+
+#define check_partition sgi_partition
+#include "partition_module.h"
fs/partitions/sun.c +4 -1
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/sun.c linux/fs/partitions/sun.c
@@ -19,7 +19,8 @@
 #include "check.h"
 #include "sun.h"
 
-int sun_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int first_part_minor)
+static int
+sun_partition(struct gendisk *hd, kdev_t dev, unsigned long first_sector, int first_part_minor)
 {
 	int i, csum;
 	unsigned short *ush;
@@ -87,3 +88,5 @@
 	return 1;
 }
 
+#define check_partition sun_partition
+#include "partition_module.h"
fs/partitions/ultrix.c +6 -2
diff --new-file -u -r linux-2.4.0-test10-pre6/fs/partitions/ultrix.c linux/fs/partitions/ultrix.c
@@ -14,8 +14,9 @@
 
 #include "check.h"
 
-int ultrix_partition(struct gendisk *hd, kdev_t dev,
-                            unsigned long first_sector, int first_part_minor)
+static int
+ultrix_partition(struct gendisk *hd, kdev_t dev,
+		 unsigned long first_sector, int first_part_minor)
 {
 	int i;
 	struct buffer_head *bh;
@@ -58,3 +59,6 @@
 		return 0;
 	}
 }
+
+#define check_partition ultrix_partition
+#include "partition_module.h"

-
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/