Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump * create /dev on the rump rootfs automatically



details:   https://anonhg.NetBSD.org/src/rev/0c4d1561dc0f
branches:  trunk
changeset: 749596:0c4d1561dc0f
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 03 15:06:04 2009 +0000

description:
* create /dev on the rump rootfs automatically
* make rump_vfs_makedevnodes() take a full basepath instead of hardcoding
  an assumption that the device node is created in /dev
  + the caller is responsible that the directory the nodes are being
    created in exists

diffstat:

 sys/rump/dev/lib/libcgd/component.c       |   8 ++++----
 sys/rump/dev/lib/libnetsmb/component.c    |   6 +++---
 sys/rump/dev/lib/libraidframe/component.c |   8 ++++----
 sys/rump/dev/lib/librnd/component.c       |   8 ++++----
 sys/rump/librump/rumpvfs/devnodes.c       |  13 ++++---------
 sys/rump/librump/rumpvfs/rump_vfs.c       |   7 +++++--
 6 files changed, 24 insertions(+), 26 deletions(-)

diffs (187 lines):

diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/dev/lib/libcgd/component.c
--- a/sys/rump/dev/lib/libcgd/component.c       Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/dev/lib/libcgd/component.c       Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: component.c,v 1.3 2009/12/01 09:04:21 pooka Exp $      */
+/*     $NetBSD: component.c,v 1.4 2009/12/03 15:06:04 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.3 2009/12/01 09:04:21 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.4 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -49,14 +49,14 @@
        /* go, mydevfs */
        bmaj = cmaj = -1;
 
-       if ((error = devsw_attach("cgd0", &cgd_bdevsw, &bmaj,
+       if ((error = devsw_attach("/dev/cgd0", &cgd_bdevsw, &bmaj,
            &cgd_cdevsw, &cmaj)) != 0)
                panic("cannot attach cgd: %d", error);
 
        if ((error = rump_vfs_makedevnodes(S_IFBLK, "cgd0", 'a',
            bmaj, 0, 7)) != 0)
                panic("cannot create cooked cgd dev nodes: %d", error);
-       if ((error = rump_vfs_makedevnodes(S_IFCHR, "rcgd0", 'a',
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/rcgd0", 'a',
            cmaj, 0, 7)) != 0)
                panic("cannot create raw cgd dev nodes: %d", error);
 
diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/dev/lib/libnetsmb/component.c
--- a/sys/rump/dev/lib/libnetsmb/component.c    Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/dev/lib/libnetsmb/component.c    Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: component.c,v 1.2 2009/09/06 20:42:26 pooka Exp $      */
+/*     $NetBSD: component.c,v 1.3 2009/12/03 15:06:04 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2009/09/06 20:42:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.3 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -50,7 +50,7 @@
        bmaj = cmaj = NODEVMAJOR;
        if ((error = devsw_attach("nsmb", NULL, &bmaj, &nsmb_cdevsw, &cmaj))!=0)
                panic("nsmb devsw attach failed: %d", error);
-       if ((error = rump_vfs_makedevnodes(S_IFCHR, "nsmb", '0',
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/nsmb", '0',
            cmaj, 0, 4)) != 0)
                panic("cannot create nsmb device nodes: %d", error);
 
diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/dev/lib/libraidframe/component.c
--- a/sys/rump/dev/lib/libraidframe/component.c Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/dev/lib/libraidframe/component.c Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: component.c,v 1.3 2009/09/07 14:28:18 pooka Exp $      */
+/*     $NetBSD: component.c,v 1.4 2009/12/03 15:06:04 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.3 2009/09/07 14:28:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.4 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -55,10 +55,10 @@
            &raid_cdevsw, &cmaj)) != 0)
                panic("raid devsw attach failed: %d", error);
 
-       if ((error = rump_vfs_makedevnodes(S_IFBLK, "raid0", 'a',
+       if ((error = rump_vfs_makedevnodes(S_IFBLK, "/dev/raid0", 'a',
            bmaj, 0, 7)) != 0)
                panic("cannot create cooked raid dev nodes: %d", error);
-       if ((error = rump_vfs_makedevnodes(S_IFCHR, "rraid0", 'a',
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/rraid0", 'a',
            cmaj, 0, 7)) != 0)
                panic("cannot create raw raid dev nodes: %d", error);
 
diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/dev/lib/librnd/component.c
--- a/sys/rump/dev/lib/librnd/component.c       Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/dev/lib/librnd/component.c       Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: component.c,v 1.1 2009/09/08 20:12:52 pooka Exp $      */
+/*     $NetBSD: component.c,v 1.2 2009/12/03 15:06:04 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/09/08 20:12:52 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -54,10 +54,10 @@
                panic("cannot attach rnd: %d", error);
 
        /* XXX: truly hideous interface abuse */
-       if ((error = rump_vfs_makedevnodes(S_IFCHR, "random", 0,
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/random", 0,
            cmaj, RND_DEV_RANDOM, 1)) != 0)
                panic("cannot create /dev/random: %d", error);
-       if ((error = rump_vfs_makedevnodes(S_IFCHR, "urandom", 0,
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "/dev/urandom", 0,
            cmaj, RND_DEV_URANDOM, 1)) != 0)
                panic("cannot create /dev/urandom: %d", error);
 
diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/librump/rumpvfs/devnodes.c
--- a/sys/rump/librump/rumpvfs/devnodes.c       Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/librump/rumpvfs/devnodes.c       Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devnodes.c,v 1.1 2009/09/06 20:42:25 pooka Exp $       */
+/*     $NetBSD: devnodes.c,v 1.2 2009/12/03 15:06:04 pooka Exp $       */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.1 2009/09/06 20:42:25 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.2 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -48,14 +48,9 @@
        size_t devlen;
        register_t retval;
 
-       error = do_sys_mkdir("/dev", 0777, UIO_SYSSPACE);
-       if (error != 0 && error != EEXIST)
-               return error;
-
-       devlen = strlen("/dev/") + strlen(basename) + 1 + 1; /* +letter +0 */
+       devlen = strlen(basename) + 1 + 1; /* +letter +0 */
        devname = kmem_zalloc(devlen, KM_SLEEP);
-       strlcpy(devname, "/dev/", devlen);
-       strlcat(devname, basename, devlen);
+       strlcpy(devname, basename, devlen);
        p = devname + devlen-2;
 
        for (; nnodes > 0; nnodes--, minchar++, minnum++) {
diff -r 1d18d84d59a4 -r 0c4d1561dc0f sys/rump/librump/rumpvfs/rump_vfs.c
--- a/sys/rump/librump/rumpvfs/rump_vfs.c       Thu Dec 03 14:51:48 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs.c       Thu Dec 03 15:06:04 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_vfs.c,v 1.40 2009/12/03 12:52:42 pooka Exp $      */
+/*     $NetBSD: rump_vfs.c,v 1.41 2009/12/03 15:06:04 pooka Exp $      */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.40 2009/12/03 12:52:42 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.41 2009/12/03 15:06:04 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -119,6 +119,9 @@
        vfs_attach(&rumpfs_vfsops);
        vfs_mountroot();
 
+       /* "mtree": create /dev */
+       do_sys_mkdir("/dev", 0777, UIO_SYSSPACE);
+
        rump_proc_vfs_init = pvfs_init;
        rump_proc_vfs_release = pvfs_rele;
 



Home | Main Index | Thread Index | Old Index