Date: Fri, 09 Nov 2001 22:32:18 +0900 From: Makoto Matsushita <matusita@jp.freebsd.org> To: current@FreeBSD.org Subject: PATCH: sysinstall (libdisk) fix to detect devfs Message-ID: <20011109223218B.matusita@jp.FreeBSD.org>
next in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011109223218B.matusita>
