Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Handle FSSIOCSET and FSSIOCGET; vndconfi...



details:   https://anonhg.NetBSD.org/src/rev/ed643cf06e0f
branches:  trunk
changeset: 1017876:ed643cf06e0f
user:      simonb <simonb%NetBSD.org@localhost>
date:      Thu Jan 14 08:00:45 2021 +0000

description:
Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.

diffstat:

 sys/compat/netbsd32/netbsd32.h       |   3 +-
 sys/compat/netbsd32/netbsd32_ioctl.c |  59 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/netbsd32_ioctl.h |  22 ++++++++++++-
 3 files changed, 80 insertions(+), 4 deletions(-)

diffs (154 lines):

diff -r 8c9873642f46 -r ed643cf06e0f sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h    Thu Jan 14 07:42:31 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32.h    Thu Jan 14 08:00:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32.h,v 1.134 2020/11/01 18:51:02 pgoyette Exp $  */
+/*     $NetBSD: netbsd32.h,v 1.135 2021/01/14 08:00:45 simonb Exp $    */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -203,6 +203,7 @@
 typedef netbsd32_uint64 netbsd32_dev_t;
 typedef netbsd32_int64 netbsd32_off_t;
 typedef netbsd32_uint64 netbsd32_ino_t;
+typedef netbsd32_int64 netbsd32_blkcnt_t;
 
 /* from <sys/spawn.h> */
 typedef netbsd32_pointer_t netbsd32_posix_spawn_file_actionsp;
diff -r 8c9873642f46 -r ed643cf06e0f sys/compat/netbsd32/netbsd32_ioctl.c
--- a/sys/compat/netbsd32/netbsd32_ioctl.c      Thu Jan 14 07:42:31 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.c      Thu Jan 14 08:00:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $      */
+/*     $NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -93,6 +93,7 @@
 #include <compat/netbsd32/netbsd32_syscallargs.h>
 #include <compat/netbsd32/netbsd32_conv.h>
 
+#include <dev/fssvar.h>
 #include <dev/vndvar.h>
 
 /* convert to/from different structures */
@@ -261,6 +262,30 @@
 }
 
 static inline void
+netbsd32_to_fss_set(struct netbsd32_fss_set *s32p, struct fss_set *p,
+    u_long cmd)
+{
+
+       p->fss_mount = (char *)NETBSD32PTR64(s32p->fss_mount);
+       p->fss_bstore = (char *)NETBSD32PTR64(s32p->fss_bstore);
+       p->fss_csize = s32p->fss_csize;
+       p->fss_flags = s32p->fss_flags;
+}
+
+static inline void
+netbsd32_to_fss_get(struct netbsd32_fss_get *s32p, struct fss_get *p,
+    u_long cmd)
+{
+
+       memcpy(p->fsg_mount, s32p->fsg_mount, MNAMELEN);
+       netbsd32_to_timeval(&s32p->fsg_time, &p->fsg_time);
+       p->fsg_csize = s32p->fsg_csize;
+       p->fsg_mount_size = s32p->fsg_mount_size;
+       p->fsg_bs_size = s32p->fsg_bs_size;
+
+}
+
+static inline void
 netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p,
     struct vnd_ioctl *p, u_long cmd)
 {
@@ -749,6 +774,30 @@
 }
 
 static inline void
+netbsd32_from_fss_set(struct fss_set *p, struct netbsd32_fss_set *s32p,
+    u_long cmd)
+{
+
+       NETBSD32PTR32(s32p->fss_mount, p->fss_mount);
+       NETBSD32PTR32(s32p->fss_bstore, p->fss_bstore);
+       s32p->fss_csize = p->fss_csize;
+       s32p->fss_flags = p->fss_flags;
+}
+
+static inline void
+netbsd32_from_fss_get(struct fss_get *p, struct netbsd32_fss_get *s32p,
+    u_long cmd)
+{
+
+       memcpy(s32p->fsg_mount, p->fsg_mount, MNAMELEN);
+       netbsd32_from_timeval(&p->fsg_time, &s32p->fsg_time);
+       s32p->fsg_csize = p->fsg_csize;
+       s32p->fsg_mount_size = p->fsg_mount_size;
+       s32p->fsg_bs_size = p->fsg_bs_size;
+
+}
+
+static inline void
 netbsd32_from_vnd_ioctl(struct vnd_ioctl *p,
     struct netbsd32_vnd_ioctl *s32p, u_long cmd)
 {
@@ -1446,6 +1495,12 @@
        case SIOCGETSGCNT32:
                IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req);
 
+       case FSSIOCSET32:       /* XXX FSSIOCSET50 not yet handled */
+               IOCTL_STRUCT_CONV_TO(FSSIOCSET, fss_set);
+
+       case FSSIOCGET32:       /* XXX FSSIOCGET50 not yet handled */
+               IOCTL_STRUCT_CONV_TO(FSSIOCGET, fss_get);
+
        case VNDIOCSET32:
                IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl);
 
diff -r 8c9873642f46 -r ed643cf06e0f sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h      Thu Jan 14 07:42:31 2021 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h      Thu Jan 14 08:00:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_ioctl.h,v 1.74 2021/01/14 02:43:04 simonb Exp $       */
+/*     $NetBSD: netbsd32_ioctl.h,v 1.75 2021/01/14 08:00:45 simonb Exp $       */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -477,6 +477,26 @@
 /* from <sys/sockio.h> */
 #define        SIOCGETSGCNT32  _IOWR('u', 52, struct netbsd32_sioc_sg_req) /* sg pkt cnt */
 
+/* from <dev/ffsvar.h> */
+struct netbsd32_fss_set {
+       netbsd32_charp  fss_mount;      /* Mount point of file system */
+       netbsd32_charp  fss_bstore;     /* Path of backing store */
+       blksize_t       fss_csize;      /* Preferred cluster size */
+       int             fss_flags;      /* Initial flags */
+};
+
+struct netbsd32_fss_get {
+       char            fsg_mount[MNAMELEN]; /* Mount point of file system */
+       struct netbsd32_timeval fsg_time;       /* Time this snapshot was taken */
+       blksize_t       fsg_csize;      /* Current cluster size */
+       netbsd32_blkcnt_t       fsg_mount_size; /* # clusters on file system */
+       netbsd32_blkcnt_t       fsg_bs_size;    /* # clusters on backing store */
+};
+
+/* XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled */
+#define FSSIOCSET32    _IOW('F', 5, struct netbsd32_fss_set)   /* Configure */
+#define FSSIOCGET32    _IOR('F', 1, struct netbsd32_fss_get)   /* Status */
+
 struct netbsd32_vnd_ioctl {
        netbsd32_charp  vnd_file;       /* pathname of file to mount */
        int             vnd_flags;      /* flags; see below */



Home | Main Index | Thread Index | Old Index