This patch is the same of PR: bin/31009.  I try to send to this list
for wider audience to check my patch.

***

Current 5-current sysinstall has a bug; when you want to install
FreeBSD to a fresh PC, and you try to make a partition except 'a'
(for example, 'ad0s1e'), sysinstall fails to do newfs. This is because
sysinstall misunderstands /mnt/dev filesystem is a devfs partition.

In a month before, this bug is reported as bin/31009, but this patch
still has a bug. Unconditionally libdisk refuses to mknod(2) a device
file.  It should be done *if and only if a path is on devfs*.

Libdisk should check a patch is devfs or not, using a given path.  It
would be done with statfs(2) so I wrote a patch.  I already sent this
to jkh (it's sysinstall-related) but he is now in BSDcon Europe :-)

Does anybody confirm that I'm doing a right thing?

-- -
Makoto `MAR' MATSUSHITA

Index: create_chunk.c
===================================================================
RCS file: /home/ncvs/src/lib/libdisk/create_chunk.c,v
retrieving revision 1.62
diff -u -r1.62 create_chunk.c
--- create_chunk.c      10 Oct 2001 07:46:04 -0000      1.62
+++ create_chunk.c      8 Nov 2001 16:23:17 -0000
@@ -17,10 +17,10 @@
 #include <ctype.h>
 #include <fcntl.h>
 #include <stdarg.h>
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/disklabel.h>
 #include <sys/diskslice.h>
-#include <sys/types.h>
+#include <sys/mount.h>
 #include <sys/stat.h>
 #include <sys/sysctl.h>
 #include <grp.h>
@@ -282,18 +282,22 @@
     char buf[BUFSIZ], buf2[BUFSIZ];
     struct group *grp;
     struct passwd *pwd;
+    struct statfs fs;
     uid_t owner;
     gid_t group;
-    int mib[4];
-    size_t miblen;
 
     *buf2 = '\0';
-    miblen = sizeof(mib)/sizeof(mib[0]);
     if (isDebug())
        msgDebug("MakeDev: Called with %s on path %s\n", p, path);
     if (!strcmp(p, "X"))
        return 0;
-    if (!sysctlnametomib("vfs.devfs.generation", &mib, &miblen)) {
+    if (statfs(path, &fs) != 0) {
+#ifdef DEBUG
+       warn("statfs(%s) failed\n", path);
+#endif
+       return 0;
+    }
+    if (strcmp(fs.f_fstypename, "devfs") == 0) {
        if (isDebug())
            msgDebug("MakeDev: No need to mknod(2) with DEVFS.\n");
        return 1;

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to