Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/bouyer-quota2]: src/sys/compat/netbsd32 implement COMPAT_NETBSD32 quotac...
details: https://anonhg.NetBSD.org/src/rev/ed1031ab2156
branches: bouyer-quota2
changeset: 761179:ed1031ab2156
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue Feb 15 17:52:51 2011 +0000
description:
implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
diffstat:
sys/compat/netbsd32/netbsd32.h | 8 +++-
sys/compat/netbsd32/netbsd32_compat_50.c | 22 ++++++++++-
sys/compat/netbsd32/netbsd32_conv.h | 30 +++++++++++++++-
sys/compat/netbsd32/netbsd32_ioctl.h | 7 +---
sys/compat/netbsd32/netbsd32_netbsd.c | 59 +++++++++++++++----------------
5 files changed, 86 insertions(+), 40 deletions(-)
diffs (218 lines):
diff -r a1818b4d3653 -r ed1031ab2156 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h Tue Feb 15 16:45:56 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32.h Tue Feb 15 17:52:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.84.8.1 2011/02/08 16:19:47 bouyer Exp $ */
+/* $NetBSD: netbsd32.h,v 1.84.8.2 2011/02/15 17:52:51 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -789,6 +789,12 @@
netbsd32_long stbcnt; /* stability limit exceeded (ro) */
};
+/* <prop/plistref.h> */
+struct netbsd32_plistref {
+ netbsd32_pointer_t pref_plist;
+ netbsd32_size_t pref_len;
+};
+
/* from <ufs/lfs/lfs.h> */
typedef netbsd32_pointer_t netbsd32_block_infop_t; /* XXX broken */
diff -r a1818b4d3653 -r ed1031ab2156 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Tue Feb 15 16:45:56 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Tue Feb 15 17:52:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.17.4.1 2011/02/15 17:52:51 bouyer Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.17.4.1 2011/02/15 17:52:51 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -1069,3 +1069,21 @@
return error;
}
#endif
+
+int
+compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(const netbsd32_charp) path;
+ syscallarg(int) cmd;
+ syscallarg(int) uid;
+ syscallarg(netbsd32_voidp) arg;
+ } */
+ struct compat_50_sys_quotactl_args ua;
+
+ NETBSD32TOP_UAP(path, const char);
+ NETBSD32TO64_UAP(cmd);
+ NETBSD32TO64_UAP(uid);
+ NETBSD32TOP_UAP(arg, void *);
+ return (compat_50_sys_quotactl(l, &ua, retval));
+}
diff -r a1818b4d3653 -r ed1031ab2156 sys/compat/netbsd32/netbsd32_conv.h
--- a/sys/compat/netbsd32/netbsd32_conv.h Tue Feb 15 16:45:56 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_conv.h Tue Feb 15 17:52:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_conv.h,v 1.24 2011/01/16 23:21:16 njoly Exp $ */
+/* $NetBSD: netbsd32_conv.h,v 1.24.4.1 2011/02/15 17:52:51 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -52,6 +52,8 @@
#include <compat/sys/dirent.h>
+#include <prop/plistref.h>
+
#include <compat/netbsd32/netbsd32.h>
/* converters for structures that we need */
@@ -756,4 +758,30 @@
return ((char *)(void *)odp) - buf;
}
+static inline int
+netbsd32_copyin_plistref(netbsd32_pointer_t n32p, struct plistref *p)
+{
+ struct netbsd32_plistref n32plist;
+ int error;
+
+ error = copyin(NETBSD32PTR64(n32p), &n32plist,
+ sizeof(struct netbsd32_plistref));
+ if (error)
+ return error;
+ p->pref_plist = NETBSD32PTR64(n32plist.pref_plist);
+ p->pref_len = n32plist.pref_len;
+ return 0;
+}
+
+static inline int
+netbsd32_copyout_plistref(netbsd32_pointer_t n32p, struct plistref *p)
+{
+ struct netbsd32_plistref n32plist;
+
+ NETBSD32PTR32(n32plist.pref_plist, p->pref_plist);
+ n32plist.pref_len = p->pref_len;
+ return copyout(&n32plist, NETBSD32PTR64(n32p),
+ sizeof(struct netbsd32_plistref));
+}
+
#endif /* _COMPAT_NETBSD32_NETBSD32_CONV_H_ */
diff -r a1818b4d3653 -r ed1031ab2156 sys/compat/netbsd32/netbsd32_ioctl.h
--- a/sys/compat/netbsd32/netbsd32_ioctl.h Tue Feb 15 16:45:56 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_ioctl.h Tue Feb 15 17:52:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_ioctl.h,v 1.29.4.1 2011/02/08 16:19:47 bouyer Exp $ */
+/* $NetBSD: netbsd32_ioctl.h,v 1.29.4.2 2011/02/15 17:52:51 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -389,11 +389,6 @@
#define VNDIOCSET5032 _IOWR('F', 0, struct netbsd32_vnd_ioctl50)
#define VNDIOCCLR5032 _IOW('F', 1, struct netbsd32_vnd_ioctl50)
-struct netbsd32_plistref {
- netbsd32_voidp pref_plist; /* plist data */
- netbsd32_size_t pref_len; /* total length of plist data */
-};
-
#define ENVSYS_GETDICTIONARY32 _IOWR('E', 0, struct netbsd32_plistref)
#define ENVSYS_SETDICTIONARY32 _IOWR('E', 1, struct netbsd32_plistref)
#define ENVSYS_REMOVEPROPS32 _IOWR('E', 2, struct netbsd32_plistref)
diff -r a1818b4d3653 -r ed1031ab2156 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c Tue Feb 15 16:45:56 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c Tue Feb 15 17:52:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.168.4.2 2011/02/09 16:09:55 bouyer Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.168.4.3 2011/02/15 17:52:51 bouyer Exp $ */
/*
* Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.168.4.2 2011/02/09 16:09:55 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.168.4.3 2011/02/15 17:52:51 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
@@ -1185,40 +1185,39 @@
}
int
-compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval)
-{
- /* {
- syscallarg(const netbsd32_charp) path;
- syscallarg(int) cmd;
- syscallarg(int) uid;
- syscallarg(netbsd32_voidp) arg;
- } */
- struct compat_50_sys_quotactl_args ua;
-
- NETBSD32TOP_UAP(path, const char);
- NETBSD32TO64_UAP(cmd);
- NETBSD32TO64_UAP(uid);
- NETBSD32TOP_UAP(arg, void *);
- return (compat_50_sys_quotactl(l, &ua, retval));
-}
-
-int
netbsd32___quotactl50(struct lwp *l, const struct netbsd32___quotactl50_args *uap, register_t *retval)
{
/* {
syscallarg(const netbsd32_charp) path;
- syscallarg(void *) v;
+ syscallarg(netbsd32_voidp) v;
} */
- //struct sys___quotactl50_args ua;
+ struct plistref pref;
+ int error;
+ struct vnode *vp;
+ struct mount *mp;
+ prop_dictionary_t dict;
+
+ error = namei_simple_user(SCARG_P32(uap, path),
+ NSM_FOLLOW_TRYEMULROOT, &vp);
+
+ if (error != 0)
+ return (error);
+ mp = vp->v_mount;
- return EOPNOTSUPP;
-#if 0
- NETBSD32TOP_UAP(path, const char);
- NETBSD32TO64_UAP(cmd);
- NETBSD32TO64_UAP(uid);
- NETBSD32TOP_UAP(arg, void *);
- return (sys_quotactl(l, &ua, retval));
-#endif
+ error = netbsd32_copyin_plistref(SCARG(uap, pref), &pref);
+ if (error)
+ return error;
+ error = prop_dictionary_copyin(&pref, &dict);
+ if (error)
+ return error;
+ error = VFS_QUOTACTL(mp, dict);
+ vrele(vp);
+ if (!error)
+ error = prop_dictionary_copyout(&pref, dict);
+ if (!error)
+ error = netbsd32_copyout_plistref(SCARG(uap, pref), &pref);
+ prop_object_release(dict);
+ return (error);
}
int
Home |
Main Index |
Thread Index |
Old Index