Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Implement support for mounting UDF in co...
details: https://anonhg.NetBSD.org/src/rev/166a13ea9327
branches: trunk
changeset: 365761:166a13ea9327
user: reinoud <reinoud%NetBSD.org@localhost>
date: Sat Apr 23 17:46:23 2022 +0000
description:
Implement support for mounting UDF in compat32
Fixes PR#56801
diffstat:
sys/compat/netbsd32/netbsd32.h | 21 +++++++++++-
sys/compat/netbsd32/netbsd32_fs.c | 70 +++++++++++++++++++++++++++++++++++++-
2 files changed, 88 insertions(+), 3 deletions(-)
diffs (154 lines):
diff -r 7b7ea314d9b1 -r 166a13ea9327 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h Sat Apr 23 17:25:58 2022 +0000
+++ b/sys/compat/netbsd32/netbsd32.h Sat Apr 23 17:46:23 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.139 2021/11/11 17:32:46 martin Exp $ */
+/* $NetBSD: netbsd32.h,v 1.140 2022/04/23 17:46:23 reinoud Exp $ */
/*
* Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1140,6 +1140,25 @@
int gmtoff; /* v3: offset from UTC in seconds */
};
+/* from <udf/udf_mount.h> */
+struct netbsd32_udf_args {
+ uint32_t version; /* version of this structure */
+ netbsd32_charp fspec; /* mount specifier */
+ int32_t sessionnr; /* session specifier, rel of abs */
+ uint32_t udfmflags; /* mount options */
+ int32_t gmtoff; /* offset from UTC in seconds */
+
+ uid_t anon_uid; /* mapping of anonymous files uid */
+ gid_t anon_gid; /* mapping of anonymous files gid */
+ uid_t nobody_uid; /* nobody:nobody will map to -1:-1 */
+ gid_t nobody_gid; /* nobody:nobody will map to -1:-1 */
+
+ uint32_t sector_size; /* for mounting dumps/files */
+
+ /* extendable */
+ uint8_t reserved[32];
+};
+
/* from <miscfs/genfs/layer.h> */
struct netbsd32_layer_args {
netbsd32_charp target; /* Target of loopback */
diff -r 7b7ea314d9b1 -r 166a13ea9327 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Sat Apr 23 17:25:58 2022 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sat Apr 23 17:46:23 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_fs.c,v 1.94 2021/09/11 10:08:55 riastradh Exp $ */
+/* $NetBSD: netbsd32_fs.c,v 1.95 2022/04/23 17:46:23 reinoud 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.94 2021/09/11 10:08:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.95 2022/04/23 17:46:23 reinoud Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -53,6 +53,7 @@
#include <fs/tmpfs/tmpfs_args.h>
#include <fs/msdosfs/bpb.h>
#include <fs/msdosfs/msdosfsmount.h>
+#include <fs/udf/udf_mount.h>
#include <ufs/ufs/ufsmount.h>
#include <miscfs/nullfs/null.h>
@@ -790,6 +791,7 @@
struct netbsd32_iso_args iso_args;
struct netbsd32_nfs_args nfs_args;
struct netbsd32_msdosfs_args msdosfs_args;
+ struct netbsd32_udf_args udf_args;
struct netbsd32_tmpfs_args tmpfs_args;
struct netbsd32_null_args null_args;
} fs_args32;
@@ -799,6 +801,7 @@
struct iso_args iso_args;
struct nfs_args nfs_args;
struct msdosfs_args msdosfs_args;
+ struct udf_args udf_args;
struct tmpfs_args tmpfs_args;
struct null_args null_args;
} fs_args;
@@ -925,6 +928,40 @@
data_seg = UIO_SYSSPACE;
data = &fs_args.msdosfs_args;
data_len = sizeof(fs_args.msdosfs_args);
+ } else if (strcmp(mtype, MOUNT_UDF) == 0) {
+ if (data_len != 0 && data_len < sizeof(fs_args32.udf_args))
+ return EINVAL;
+ if ((flags & MNT_GETARGS) == 0) {
+ error = copyin(data, &fs_args32.udf_args,
+ sizeof(fs_args32.udf_args));
+ if (error)
+ return error;
+ fs_args.udf_args.version =
+ fs_args32.udf_args.version;
+ fs_args.udf_args.fspec =
+ NETBSD32PTR64(fs_args32.udf_args.fspec);
+ fs_args.udf_args.sessionnr =
+ fs_args32.udf_args.sessionnr;
+ fs_args.udf_args.udfmflags =
+ fs_args32.udf_args.udfmflags;
+ fs_args.udf_args.gmtoff =
+ fs_args32.udf_args.gmtoff;
+ fs_args.udf_args.anon_uid =
+ fs_args32.udf_args.anon_uid;
+ fs_args.udf_args.anon_gid =
+ fs_args32.udf_args.anon_gid;
+ fs_args.udf_args.nobody_uid =
+ fs_args32.udf_args.nobody_uid;
+ fs_args.udf_args.nobody_gid =
+ fs_args32.udf_args.nobody_gid;
+ fs_args.udf_args.sector_size =
+ fs_args32.udf_args.sector_size;
+ memset(fs_args.udf_args.reserved, 0,
+ sizeof(fs_args.udf_args.reserved));
+ }
+ data_seg = UIO_SYSSPACE;
+ data = &fs_args.udf_args;
+ data_len = sizeof(fs_args.udf_args);
} else if (strcmp(mtype, MOUNT_NFS) == 0) {
if (data_len != 0 && data_len < sizeof(fs_args32.nfs_args))
return EINVAL;
@@ -1032,6 +1069,35 @@
error = copyout(&fs_args32.iso_args, udata,
sizeof(fs_args32.iso_args));
*retval = sizeof(fs_args32.iso_args);
+ } else if (strcmp(mtype, MOUNT_UDF) == 0) {
+ if (data_len != 0 &&
+ data_len != sizeof(fs_args.udf_args))
+ return EINVAL;
+ fs_args32.udf_args.version =
+ fs_args.udf_args.version;
+ NETBSD32PTR32(fs_args32.udf_args.fspec,
+ fs_args.udf_args.fspec);
+ fs_args32.udf_args.sessionnr =
+ fs_args.udf_args.sessionnr;
+ fs_args32.udf_args.udfmflags =
+ fs_args.udf_args.udfmflags;
+ fs_args32.udf_args.gmtoff =
+ fs_args.udf_args.gmtoff;
+ fs_args32.udf_args.anon_uid =
+ fs_args.udf_args.anon_uid;
+ fs_args32.udf_args.anon_gid =
+ fs_args.udf_args.anon_gid;
+ fs_args32.udf_args.nobody_uid =
+ fs_args.udf_args.nobody_uid;
+ fs_args32.udf_args.nobody_gid =
+ fs_args.udf_args.nobody_gid;
+ fs_args32.udf_args.sector_size =
+ fs_args.udf_args.sector_size;
+ memset(fs_args32.udf_args.reserved, 0,
+ sizeof(fs_args32.udf_args.reserved));
+ error = copyout(&fs_args32.udf_args, udata,
+ sizeof(fs_args32.udf_args));
+ *retval = sizeof(fs_args32.udf_args);
} else if (strcmp(mtype, MOUNT_NFS) == 0) {
if (data_len != 0 &&
data_len != sizeof(fs_args.nfs_args))
Home |
Main Index |
Thread Index |
Old Index