Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Rename rump_dev_makenodes() to rump_vfs_makedevnode...



details:   https://anonhg.NetBSD.org/src/rev/5724b877a984
branches:  trunk
changeset: 747236:5724b877a984
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Sep 06 20:42:25 2009 +0000

description:
Rename rump_dev_makenodes() to rump_vfs_makedevnodes() -- while it
will most likely be used devices, the implementation requires
services provided by vfs (mkdir, mknod).

diffstat:

 sys/rump/dev/lib/libnetsmb/Makefile         |   3 +-
 sys/rump/dev/lib/libnetsmb/component.c      |   8 +-
 sys/rump/librump/rumpdev/Makefile.rumpdev   |   4 +-
 sys/rump/librump/rumpdev/devnodes.c         |  73 -----------------------------
 sys/rump/librump/rumpdev/rump_dev_private.h |   6 +-
 sys/rump/librump/rumpvfs/Makefile.rumpvfs   |   4 +-
 sys/rump/librump/rumpvfs/devnodes.c         |  73 +++++++++++++++++++++++++++++
 sys/rump/librump/rumpvfs/rump_vfs_private.h |   5 +-
 8 files changed, 89 insertions(+), 87 deletions(-)

diffs (280 lines):

diff -r 0bc934685380 -r 5724b877a984 sys/rump/dev/lib/libnetsmb/Makefile
--- a/sys/rump/dev/lib/libnetsmb/Makefile       Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/dev/lib/libnetsmb/Makefile       Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2009/09/04 12:20:42 pooka Exp $
+#      $NetBSD: Makefile,v 1.2 2009/09/06 20:42:26 pooka Exp $
 #
 
 .PATH: ${.CURDIR}/../../../../netsmb
@@ -10,6 +10,7 @@
 
 SRCS+= component.c
 
+CPPFLAGS+=     -I${RUMPTOP}/librump/rumpvfs
 #CPPFLAGS+=    -DSMB_SOCKET_DEBUG -DSMB_IOD_DEBUG
 
 CFLAGS+=       -Wno-pointer-sign
diff -r 0bc934685380 -r 5724b877a984 sys/rump/dev/lib/libnetsmb/component.c
--- a/sys/rump/dev/lib/libnetsmb/component.c    Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/dev/lib/libnetsmb/component.c    Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: component.c,v 1.1 2009/09/04 12:20:42 pooka Exp $      */
+/*     $NetBSD: component.c,v 1.2 2009/09/06 20:42:26 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.1 2009/09/04 12:20:42 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.2 2009/09/06 20:42:26 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -36,6 +36,7 @@
 #include <sys/stat.h>
 
 #include "rump_dev_private.h"
+#include "rump_vfs_private.h"
 
 void nsmbattach(int); /* XXX */
 
@@ -49,7 +50,8 @@
        bmaj = cmaj = NODEVMAJOR;
        if ((error = devsw_attach("nsmb", NULL, &bmaj, &nsmb_cdevsw, &cmaj))!=0)
                panic("nsmb devsw attach failed: %d", error);
-       if ((error = rump_dev_makenodes(S_IFCHR, "nsmb", '0', cmaj, 0, 4)) != 0)
+       if ((error = rump_vfs_makedevnodes(S_IFCHR, "nsmb", '0',
+           cmaj, 0, 4)) != 0)
                panic("cannot create nsmb device nodes: %d", error);
 
        rump_pdev_add(nsmbattach, 4);
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpdev/Makefile.rumpdev
--- a/sys/rump/librump/rumpdev/Makefile.rumpdev Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/librump/rumpdev/Makefile.rumpdev Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rumpdev,v 1.1 2009/07/20 18:04:13 pooka Exp $
+#      $NetBSD: Makefile.rumpdev,v 1.2 2009/09/06 20:42:26 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -8,7 +8,7 @@
 .PATH: ${RUMPTOP}/librump/rumpdev                              \
        ${RUMPTOP}/../kern
 
-SRCS=  rump_dev.c autoconf.c devnodes.c
+SRCS=  rump_dev.c autoconf.c
 
 # sys/kern
 SRCS+= subr_autoconf.c
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpdev/devnodes.c
--- a/sys/rump/librump/rumpdev/devnodes.c       Sun Sep 06 20:26:47 2009 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*     $NetBSD: devnodes.c,v 1.3 2009/09/04 08:57:00 he Exp $  */
-
-/*
- * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.3 2009/09/04 08:57:00 he Exp $");
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/filedesc.h>
-#include <sys/kmem.h>
-#include <sys/lwp.h>
-#include <sys/stat.h>
-#include <sys/vfs_syscalls.h>
-
-#include "rump_dev_private.h"
-
-/* realqvik(tm) "devfs" */
-int
-rump_dev_makenodes(dev_t devtype, const char *basename, char minchar,
-       devmajor_t maj, devminor_t minnum, int nnodes)
-{
-       int error;
-       char *devname, *p;
-       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 */
-       devname = kmem_zalloc(devlen, KM_SLEEP);
-       strlcpy(devname, "/dev/", devlen);
-       strlcat(devname, basename, devlen);
-       p = devname + devlen-2;
-
-       for (; nnodes > 0; nnodes--, minchar++, minnum++) {
-               KASSERT(minchar <= 'z');
-               *p = minchar;
-
-               if ((error = do_sys_mknod(curlwp, devname, 0666 | devtype,
-                   makedev(maj, minnum), &retval, UIO_SYSSPACE)))
-                       goto out;
-       }
-
- out:
-       kmem_free(devname, devlen);
-       return error;
-}
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpdev/rump_dev_private.h
--- a/sys/rump/librump/rumpdev/rump_dev_private.h       Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/librump/rumpdev/rump_dev_private.h       Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_dev_private.h,v 1.2 2009/09/04 12:20:42 pooka Exp $       */
+/*     $NetBSD: rump_dev_private.h,v 1.3 2009/09/06 20:42:26 pooka Exp $       */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -33,10 +33,6 @@
 void   rump_pdev_add(void (*fn)(int), int);
 void   rump_pdev_finalize(void);
 
-int    rump_dev_makenodes(dev_t, const char *, char,
-                          devmajor_t, devminor_t, int);
-
-
 void   rump_dev_cgd_init(void);
 void   rump_dev_raidframe_init(void);
 void   rump_dev_netsmb_init(void);
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpvfs/Makefile.rumpvfs
--- a/sys/rump/librump/rumpvfs/Makefile.rumpvfs Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/librump/rumpvfs/Makefile.rumpvfs Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.rumpvfs,v 1.12 2009/08/07 18:52:56 pooka Exp $
+#      $NetBSD: Makefile.rumpvfs,v 1.13 2009/09/06 20:42:25 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -14,7 +14,7 @@
 #
 # Source modules, first the ones specifically implemented for librump.
 # 
-SRCS=  rump_vfs.c rumpblk.c rumpfs.c vm_vfs.c
+SRCS=  rump_vfs.c devnodes.c rumpblk.c rumpfs.c vm_vfs.c
 
 SRCS+= fstrans_stub.c vfsops_stub.c
 
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpvfs/devnodes.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/rump/librump/rumpvfs/devnodes.c       Sun Sep 06 20:42:25 2009 +0000
@@ -0,0 +1,73 @@
+/*     $NetBSD: devnodes.c,v 1.1 2009/09/06 20:42:25 pooka Exp $       */
+
+/*
+ * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.1 2009/09/06 20:42:25 pooka Exp $");
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/filedesc.h>
+#include <sys/kmem.h>
+#include <sys/lwp.h>
+#include <sys/stat.h>
+#include <sys/vfs_syscalls.h>
+
+#include "rump_vfs_private.h"
+
+/* realqvik(tm) "devfs" */
+int
+rump_vfs_makedevnodes(dev_t devtype, const char *basename, char minchar,
+       devmajor_t maj, devminor_t minnum, int nnodes)
+{
+       int error;
+       char *devname, *p;
+       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 */
+       devname = kmem_zalloc(devlen, KM_SLEEP);
+       strlcpy(devname, "/dev/", devlen);
+       strlcat(devname, basename, devlen);
+       p = devname + devlen-2;
+
+       for (; nnodes > 0; nnodes--, minchar++, minnum++) {
+               KASSERT(minchar <= 'z');
+               *p = minchar;
+
+               if ((error = do_sys_mknod(curlwp, devname, 0666 | devtype,
+                   makedev(maj, minnum), &retval, UIO_SYSSPACE)))
+                       goto out;
+       }
+
+ out:
+       kmem_free(devname, devlen);
+       return error;
+}
diff -r 0bc934685380 -r 5724b877a984 sys/rump/librump/rumpvfs/rump_vfs_private.h
--- a/sys/rump/librump/rumpvfs/rump_vfs_private.h       Sun Sep 06 20:26:47 2009 +0000
+++ b/sys/rump/librump/rumpvfs/rump_vfs_private.h       Sun Sep 06 20:42:25 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_vfs_private.h,v 1.3 2009/08/03 14:23:30 pooka Exp $       */
+/*     $NetBSD: rump_vfs_private.h,v 1.4 2009/09/06 20:42:25 pooka Exp $       */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -39,4 +39,7 @@
 
 void   rump_biodone(void *, size_t, int);
 
+int     rump_vfs_makedevnodes(dev_t, const char *, char,
+                             devmajor_t, devminor_t, int);
+
 #endif /* _SYS_RUMP_VFS_PRIVATE_H_ */



Home | Main Index | Thread Index | Old Index