Subject: proposed change to sys/sys/disklabel.h
To: None <tech-kern@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 03/25/2002 13:51:09
Would anyone object to this change?

Index: disklabel.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/disklabel.h,v
retrieving revision 1.69
diff -u -r1.69 disklabel.h
--- disklabel.h 2001/04/03 20:25:22     1.69
+++ disklabel.h 2002/03/25 21:41:14
@@ -350,6 +350,8 @@
        NULL
 };
 #define FSMAXTYPES     (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
+#else
+#define FSMAXTYPES     (FS_CCD + 1)
 #endif

 #ifdef FSCKNAMES

The effect is to make FSMAXTYPES always available.

The reason I want this is that I added code to the macppc apple partition
map reading code that if it sees a certain Apple partition type (NETBSD,
NETBSD/MACPPC, or NETBSD/MAC68k) with a certain internal magic number
(valid bzb block), it will try to read a NetBSD partition type from the
partition. I also check that the partition type is valid. To do that, I
need FSMAXTYPES.

Here's the test:

                if ((bzb->bzbMagic == BZB_MAGIC) &&
                    (bzb->bzbType < FSMAXTYPES))
                        *fstype = bzb->bzbType;

*fstype is the type-returning pointer.

So should I:

1) Not make the change above, and include the table of fs type names.

	Would work, but is bloated because the code will never use
	the names, just how many of them there are.

2) Drop the test and take the partition value

	Would work too, and not need above change. Probably not too
	unsafe as I think few partitions will have a valid bzb and invalid
	partition type

3) Make the change

	My vote.

Thoughts?

Take care,

Bill