Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 add tmpfs.



details:   https://anonhg.NetBSD.org/src/rev/d02c68522f99
branches:  trunk
changeset: 332715:d02c68522f99
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 05 20:17:28 2014 +0000

description:
add tmpfs.

diffstat:

 sys/compat/netbsd32/netbsd32.h    |  17 ++++++++++++-
 sys/compat/netbsd32/netbsd32_fs.c |  52 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 5 deletions(-)

diffs (139 lines):

diff -r 947a4d4a09c5 -r d02c68522f99 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Sun Oct 05 17:08:46 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Sun Oct 05 20:17:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.102 2014/06/28 22:27:50 dholland Exp $  */
+/*     $NetBSD: netbsd32.h,v 1.103 2014/10/05 20:17:28 christos Exp $  */
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -167,6 +167,7 @@
 typedef netbsd32_pointer_t netbsd32_semidp_t;
 typedef netbsd32_uint64 netbsd32_dev_t;
 typedef netbsd32_int64 netbsd32_off_t;
+typedef netbsd32_uint64 netbsd32_ino_t;
 
 /* from <sys/uio.h> */
 typedef netbsd32_pointer_t netbsd32_iovecp_t;
@@ -909,6 +910,20 @@
 typedef netbsd32_pointer_t netbsd32_sched_paramp_t;
 typedef netbsd32_pointer_t netbsd32_cpusetp_t;
 
+/* from <fs/tmpfs/tmpfs_args.h> */
+struct netbsd32_tmpfs_args {
+        int                     ta_version;
+
+        /* Size counters. */
+        netbsd32_ino_t          ta_nodes_max;
+        netbsd32_off_t          ta_size_max;
+
+        /* Root node attributes. */
+        uid_t                   ta_root_uid;
+        gid_t                   ta_root_gid;
+        mode_t                  ta_root_mode;
+};
+
 /* from <fs/cd9660/cd9660_mount.h> */
 struct netbsd32_iso_args {
        netbsd32_charp fspec;
diff -r 947a4d4a09c5 -r d02c68522f99 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Sun Oct 05 17:08:46 2014 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sun Oct 05 20:17:28 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_fs.c,v 1.71 2014/09/05 09:21:54 matt Exp $    */
+/*     $NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $        */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.71 2014/09/05 09:21:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.72 2014/10/05 20:17:28 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,6 +50,7 @@
 #include <sys/vfs_syscalls.h>
 
 #include <fs/cd9660/cd9660_mount.h>
+#include <fs/tmpfs/tmpfs_args.h>
 #include <fs/msdosfs/bpb.h>
 #include <fs/msdosfs/msdosfsmount.h>
 #include <ufs/ufs/ufsmount.h>
@@ -799,6 +800,7 @@
                struct netbsd32_iso_args iso_args;
                struct netbsd32_nfs_args nfs_args;
                struct netbsd32_msdosfs_args msdosfs_args;
+               struct netbsd32_tmpfs_args tmpfs_args;
        } fs_args32;
        union {
                struct ufs_args ufs_args;
@@ -806,6 +808,7 @@
                struct iso_args iso_args;
                struct nfs_args nfs_args;
                struct msdosfs_args msdosfs_args;
+               struct tmpfs_args tmpfs_args;
        } fs_args;
        const char *type = SCARG_P32(uap, type);
        const char *path = SCARG_P32(uap, path);
@@ -819,7 +822,31 @@
        error = copyinstr(type, mtype, sizeof(mtype), &len);
        if (error)
                return error;
-       if (strcmp(mtype, MOUNT_MFS) == 0) {
+       if (strcmp(mtype, MOUNT_TMPFS) == 0) {
+               if (data_len != sizeof(fs_args32.tmpfs_args))
+                       return EINVAL;
+               if ((flags & MNT_GETARGS) == 0) {
+                       error = copyin(data, &fs_args32.tmpfs_args, 
+                           sizeof(fs_args32.tmpfs_args));
+                       if (error)
+                               return error;
+                       fs_args.tmpfs_args.ta_version =
+                           fs_args32.tmpfs_args.ta_version;
+                       fs_args.tmpfs_args.ta_nodes_max =
+                           fs_args32.tmpfs_args.ta_nodes_max;
+                       fs_args.tmpfs_args.ta_size_max =
+                           fs_args32.tmpfs_args.ta_size_max;
+                       fs_args.tmpfs_args.ta_root_uid =
+                           fs_args32.tmpfs_args.ta_root_uid;
+                       fs_args.tmpfs_args.ta_root_gid =
+                           fs_args32.tmpfs_args.ta_root_gid;
+                       fs_args.tmpfs_args.ta_root_mode =
+                           fs_args32.tmpfs_args.ta_root_mode;
+               }
+               data_seg = UIO_SYSSPACE;
+               data = &fs_args.tmpfs_args;
+               data_len = sizeof(fs_args.tmpfs_args);
+       } else if (strcmp(mtype, MOUNT_MFS) == 0) {
                if (data_len != sizeof(fs_args32.mfs_args))
                        return EINVAL;
                if ((flags & MNT_GETARGS) == 0) {
@@ -937,7 +964,24 @@
                return error;
        if (flags & MNT_GETARGS) {
                data_len = *retval;
-               if (strcmp(mtype, MOUNT_MFS) == 0) {
+               if (strcmp(mtype, MOUNT_TMPFS) == 0) {
+                       if (data_len != sizeof(fs_args.tmpfs_args))
+                               return EINVAL;
+                       fs_args32.tmpfs_args.ta_version =
+                           fs_args.tmpfs_args.ta_version;
+                       fs_args32.tmpfs_args.ta_nodes_max =
+                           fs_args.tmpfs_args.ta_nodes_max;
+                       fs_args32.tmpfs_args.ta_size_max =
+                           fs_args.tmpfs_args.ta_size_max;
+                       fs_args32.tmpfs_args.ta_root_uid =
+                           fs_args.tmpfs_args.ta_root_uid;
+                       fs_args32.tmpfs_args.ta_root_gid =
+                           fs_args.tmpfs_args.ta_root_gid;
+                       fs_args32.tmpfs_args.ta_root_mode =
+                           fs_args.tmpfs_args.ta_root_mode;
+                       error = copyout(&fs_args32.tmpfs_args, data,
+                                   sizeof(fs_args32.tmpfs_args));
+               } else if (strcmp(mtype, MOUNT_MFS) == 0) {
                        if (data_len != sizeof(fs_args.mfs_args))
                                return EINVAL;
                        NETBSD32PTR32(fs_args32.mfs_args.fspec,



Home | Main Index | Thread Index | Old Index