Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 support nullfs in netbsd32.



details:   https://anonhg.NetBSD.org/src/rev/c32fc9081af0
branches:  trunk
changeset: 365289:c32fc9081af0
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Aug 11 03:41:06 2018 +0000

description:
support nullfs in netbsd32.

diffstat:

 sys/compat/netbsd32/netbsd32.h    |  17 +++++++++++++----
 sys/compat/netbsd32/netbsd32_fs.c |  28 ++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 6 deletions(-)

diffs (122 lines):

diff -r b816a9028c1a -r c32fc9081af0 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Sat Aug 11 00:32:17 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Sat Aug 11 03:41:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.118 2018/05/10 02:36:07 christos Exp $  */
+/*     $NetBSD: netbsd32.h,v 1.119 2018/08/11 03:41:06 mrg Exp $       */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -965,7 +965,7 @@
 /* from <fs/cd9660/cd9660_mount.h> */
 struct netbsd32_iso_args {
        netbsd32_charp fspec;
-       struct export_args30 _pad1;
+       struct netbsd32_export_args30 _pad1;
        int     flags;
 };
 
@@ -1021,8 +1021,6 @@
        netbsd32_export_argsp   mel_exports;
 };
 
-/* no struct export_args30 yet */
-
 /* from <nfs/nfsmount,h> */
 struct netbsd32_nfs_args {
        int32_t         version;        /* args structure version number */
@@ -1060,6 +1058,17 @@
        int     gmtoff;         /* v3: offset from UTC in seconds */
 };
 
+/* from <miscfs/genfs/layer.h> */
+struct netbsd32_layer_args {
+       netbsd32_charp target;          /* Target of loopback  */
+       struct netbsd32_export_args30 _pad1; /* compat with old userland tools */
+};
+
+/* from <miscfs/nullfs/null.h> */
+struct netbsd32_null_args {
+       struct  netbsd32_layer_args     la;     /* generic layerfs args */
+};
+
 struct netbsd32_posix_spawn_file_actions_entry {
        enum { FAE32_OPEN, FAE32_DUP2, FAE32_CLOSE } fae_action;
 
diff -r b816a9028c1a -r c32fc9081af0 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Sat Aug 11 00:32:17 2018 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sat Aug 11 03:41:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_fs.c,v 1.80 2017/06/01 02:45:08 chs Exp $     */
+/*     $NetBSD: netbsd32_fs.c,v 1.81 2018/08/11 03:41:06 mrg 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.80 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.81 2018/08/11 03:41:06 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@
 #include <fs/msdosfs/bpb.h>
 #include <fs/msdosfs/msdosfsmount.h>
 #include <ufs/ufs/ufsmount.h>
+#include <miscfs/nullfs/null.h>
 
 #define NFS_ARGS_ONLY
 #include <nfs/nfsmount.h>
@@ -799,6 +800,7 @@
                struct netbsd32_nfs_args nfs_args;
                struct netbsd32_msdosfs_args msdosfs_args;
                struct netbsd32_tmpfs_args tmpfs_args;
+               struct netbsd32_null_args null_args;
        } fs_args32;
        union {
                struct ufs_args ufs_args;
@@ -807,6 +809,7 @@
                struct nfs_args nfs_args;
                struct msdosfs_args msdosfs_args;
                struct tmpfs_args tmpfs_args;
+               struct null_args null_args;
        } fs_args;
        const char *type = SCARG_P32(uap, type);
        const char *path = SCARG_P32(uap, path);
@@ -953,6 +956,20 @@
                data_seg = UIO_SYSSPACE;
                data = &fs_args.nfs_args;
                data_len = sizeof(fs_args.nfs_args);
+       } else if (strcmp(mtype, MOUNT_NULL) == 0) {
+               if (data_len > sizeof(fs_args32.null_args))
+                       return EINVAL;
+               if ((flags & MNT_GETARGS) == 0) {
+                       error = copyin(data, &fs_args32.null_args, 
+                           sizeof(fs_args32.null_args));
+                       if (error)
+                               return error;
+                       fs_args.null_args.la.target =
+                           NETBSD32PTR64(fs_args32.null_args.la.target);
+               }
+               data_seg = UIO_SYSSPACE;
+               data = &fs_args.null_args;
+               data_len = sizeof(fs_args.null_args);
        } else {
                data_seg = UIO_USERSPACE;
        }
@@ -1032,6 +1049,13 @@
                            fs_args.nfs_args.hostname);
                        error = copyout(&fs_args32.nfs_args, data,
                            sizeof(fs_args32.nfs_args));
+               } else if (strcmp(mtype, MOUNT_NULL) == 0) {
+                       if (data_len != sizeof(fs_args.null_args))
+                               return EINVAL;
+                       NETBSD32PTR32(fs_args32.null_args.la.target,
+                           fs_args.null_args.la.target);
+                       error = copyout(&fs_args32.null_args, data, 
+                           sizeof(fs_args32.null_args));
                }
        }
        return error;



Home | Main Index | Thread Index | Old Index