Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add QUOTACTL_CURSORSKIPIDTYPE, QUOTACTL_CURSORATEND, QUO...
details: https://anonhg.NetBSD.org/src/rev/01c405e84130
branches: trunk
changeset: 773200:01c405e84130
user: dholland <dholland%NetBSD.org@localhost>
date: Sun Jan 29 07:09:52 2012 +0000
description:
Add QUOTACTL_CURSORSKIPIDTYPE, QUOTACTL_CURSORATEND, QUOTACTL_CURSORREWIND.
This change requires a kernel version bump.
diffstat:
sys/kern/vfs_quotactl.c | 18 +++---
sys/sys/quotactl.h | 25 ++++++++-
sys/ufs/ufs/ufs_quota.c | 112 ++++++++++++++++++++++++++++++++++++++++------
sys/ufs/ufs/ufs_quota.h | 9 ++-
sys/ufs/ufs/ufs_quota2.c | 74 +++++++++++++++++++++++++++++-
5 files changed, 205 insertions(+), 33 deletions(-)
diffs (truncated from 412 to 300 lines):
diff -r 1d0d2dbce8e6 -r 01c405e84130 sys/kern/vfs_quotactl.c
--- a/sys/kern/vfs_quotactl.c Sun Jan 29 07:08:58 2012 +0000
+++ b/sys/kern/vfs_quotactl.c Sun Jan 29 07:09:52 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $ */
+/* $NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $ */
/*
* Copyright (c) 1991, 1993, 1994
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.28 2012/01/29 07:08:58 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_quotactl.c,v 1.29 2012/01/29 07:09:52 dholland Exp $");
#include <sys/malloc.h> /* XXX: temporary */
#include <sys/mount.h>
@@ -560,14 +560,14 @@
lastid = 0; /* value not actually referenced */
while (1) {
- args.qc_type = QCT_GETALL;
- args.u.getall.qc_cursor = &cursor;
- args.u.getall.qc_keys = keys;
- args.u.getall.qc_vals = vals;
- args.u.getall.qc_maxnum = loopmax;
- args.u.getall.qc_ret = &loopnum;
+ args.qc_type = QCT_CURSORGET;
+ args.u.cursorget.qc_cursor = &cursor;
+ args.u.cursorget.qc_keys = keys;
+ args.u.cursorget.qc_vals = vals;
+ args.u.cursorget.qc_maxnum = loopmax;
+ args.u.cursorget.qc_ret = &loopnum;
- error = VFS_QUOTACTL(mp, QUOTACTL_GETALL, &args);
+ error = VFS_QUOTACTL(mp, QUOTACTL_CURSORGET, &args);
if (error) {
goto err;
}
diff -r 1d0d2dbce8e6 -r 01c405e84130 sys/sys/quotactl.h
--- a/sys/sys/quotactl.h Sun Jan 29 07:08:58 2012 +0000
+++ b/sys/sys/quotactl.h Sun Jan 29 07:09:52 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: quotactl.h,v 1.25 2012/01/29 07:08:58 dholland Exp $ */
+/* $NetBSD: quotactl.h,v 1.26 2012/01/29 07:09:52 dholland Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -57,10 +57,13 @@
#define QUOTACTL_QUOTAOFF 2
#define QUOTACTL_GET 3
#define QUOTACTL_PUT 4
-#define QUOTACTL_GETALL 5
+#define QUOTACTL_CURSORGET 5
#define QUOTACTL_DELETE 6
#define QUOTACTL_CURSOROPEN 7
#define QUOTACTL_CURSORCLOSE 8
+#define QUOTACTL_CURSORSKIPIDTYPE 9
+#define QUOTACTL_CURSORATEND 10
+#define QUOTACTL_CURSORREWIND 11
/* Argument encoding. */
enum vfs_quotactl_argtypes {
@@ -71,7 +74,10 @@
QCT_DELETE, /* delete */
QCT_CURSOROPEN, /* open cursor */
QCT_CURSORCLOSE,/* close cursor */
- QCT_GETALL, /* get all */
+ QCT_CURSORGET, /* get from cursor */
+ QCT_CURSORSKIPIDTYPE, /* iteration hint */
+ QCT_CURSORATEND,/* test cursor */
+ QCT_CURSORREWIND,/* reset cursor */
};
struct vfs_quotactl_args {
enum vfs_quotactl_argtypes qc_type;
@@ -103,11 +109,22 @@
} cursorclose;
struct {
struct quotakcursor *qc_cursor;
+ unsigned qc_idtype;
+ } cursorskipidtype;
+ struct {
+ struct quotakcursor *qc_cursor;
struct quotakey *qc_keys;
struct quotaval *qc_vals;
unsigned qc_maxnum;
unsigned *qc_ret;
- } getall;
+ } cursorget;
+ struct {
+ struct quotakcursor *qc_cursor;
+ int *qc_ret; /* really boolean */
+ } cursoratend;
+ struct {
+ struct quotakcursor *qc_cursor;
+ } cursorrewind;
} u;
};
diff -r 1d0d2dbce8e6 -r 01c405e84130 sys/ufs/ufs/ufs_quota.c
--- a/sys/ufs/ufs/ufs_quota.c Sun Jan 29 07:08:58 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.c Sun Jan 29 07:09:52 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $ */
+/* $NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.97 2012/01/29 07:08:58 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota.c,v 1.98 2012/01/29 07:09:52 dholland Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@@ -77,7 +77,7 @@
struct vfs_quotactl_args *args);
static int quota_handle_cmd_put(struct mount *, struct lwp *,
struct vfs_quotactl_args *args);
-static int quota_handle_cmd_getall(struct mount *, struct lwp *,
+static int quota_handle_cmd_cursorget(struct mount *, struct lwp *,
struct vfs_quotactl_args *args);
static int quota_handle_cmd_delete(struct mount *, struct lwp *,
struct vfs_quotactl_args *args);
@@ -89,6 +89,12 @@
struct vfs_quotactl_args *args);
static int quota_handle_cmd_cursorclose(struct mount *, struct lwp *,
struct vfs_quotactl_args *args);
+static int quota_handle_cmd_cursorskipidtype(struct mount *, struct lwp *,
+ struct vfs_quotactl_args *args);
+static int quota_handle_cmd_cursoratend(struct mount *, struct lwp *,
+ struct vfs_quotactl_args *args);
+static int quota_handle_cmd_cursorrewind(struct mount *, struct lwp *,
+ struct vfs_quotactl_args *args);
/*
* Initialize the quota fields of an inode.
@@ -179,8 +185,8 @@
case QUOTACTL_PUT:
error = quota_handle_cmd_put(mp, l, args);
break;
- case QUOTACTL_GETALL:
- error = quota_handle_cmd_getall(mp, l, args);
+ case QUOTACTL_CURSORGET:
+ error = quota_handle_cmd_cursorget(mp, l, args);
break;
case QUOTACTL_DELETE:
error = quota_handle_cmd_delete(mp, l, args);
@@ -191,6 +197,15 @@
case QUOTACTL_CURSORCLOSE:
error = quota_handle_cmd_cursorclose(mp, l, args);
break;
+ case QUOTACTL_CURSORSKIPIDTYPE:
+ error = quota_handle_cmd_cursorskipidtype(mp, l, args);
+ break;
+ case QUOTACTL_CURSORATEND:
+ error = quota_handle_cmd_cursoratend(mp, l, args);
+ break;
+ case QUOTACTL_CURSORREWIND:
+ error = quota_handle_cmd_cursorrewind(mp, l, args);
+ break;
default:
panic("Invalid quotactl operation %d\n", op);
}
@@ -365,7 +380,7 @@
}
static int
-quota_handle_cmd_getall(struct mount *mp, struct lwp *l,
+quota_handle_cmd_cursorget(struct mount *mp, struct lwp *l,
struct vfs_quotactl_args *args)
{
struct ufsmount *ump = VFSTOUFS(mp);
@@ -376,12 +391,12 @@
unsigned *ret;
int error;
- KASSERT(args->qc_type == QCT_GETALL);
- cursor = args->u.getall.qc_cursor;
- keys = args->u.getall.qc_keys;
- vals = args->u.getall.qc_vals;
- maxnum = args->u.getall.qc_maxnum;
- ret = args->u.getall.qc_ret;
+ KASSERT(args->qc_type == QCT_CURSORGET);
+ cursor = args->u.cursorget.qc_cursor;
+ keys = args->u.cursorget.qc_keys;
+ vals = args->u.cursorget.qc_vals;
+ maxnum = args->u.cursorget.qc_maxnum;
+ ret = args->u.cursorget.qc_ret;
if ((ump->um_flags & UFS_QUOTA2) == 0)
return EOPNOTSUPP;
@@ -393,11 +408,11 @@
#ifdef QUOTA2
if (ump->um_flags & UFS_QUOTA2) {
- error = quota2_handle_cmd_getall(ump, cursor,
- keys, vals, maxnum, ret);
+ error = quota2_handle_cmd_cursorget(ump, cursor, keys, vals,
+ maxnum, ret);
} else
#endif
- panic("quota_handle_cmd_getall: no support ?");
+ panic("quota_handle_cmd_cursorget: no support ?");
return error;
}
@@ -455,6 +470,73 @@
}
static int
+quota_handle_cmd_cursorskipidtype(struct mount *mp, struct lwp *l,
+ struct vfs_quotactl_args *args)
+{
+ struct ufsmount *ump = VFSTOUFS(mp);
+ struct quotakcursor *cursor;
+ int idtype;
+ int error;
+
+ KASSERT(args->qc_type == QCT_CURSORSKIPIDTYPE);
+ cursor = args->u.cursorskipidtype.qc_cursor;
+ idtype = args->u.cursorskipidtype.qc_idtype;
+
+#ifdef QUOTA2
+ if (ump->um_flags & UFS_QUOTA2) {
+ error = quota2_handle_cmd_cursorskipidtype(ump, cursor, idtype);
+ } else
+#endif
+ error = EOPNOTSUPP;
+
+ return error;
+}
+
+static int
+quota_handle_cmd_cursoratend(struct mount *mp, struct lwp *l,
+ struct vfs_quotactl_args *args)
+{
+ struct ufsmount *ump = VFSTOUFS(mp);
+ struct quotakcursor *cursor;
+ int *ret;
+ int error;
+
+ KASSERT(args->qc_type == QCT_CURSORATEND);
+ cursor = args->u.cursoratend.qc_cursor;
+ ret = args->u.cursoratend.qc_ret;
+
+#ifdef QUOTA2
+ if (ump->um_flags & UFS_QUOTA2) {
+ error = quota2_handle_cmd_cursoratend(ump, cursor, ret);
+ } else
+#endif
+ error = EOPNOTSUPP;
+
+ return error;
+}
+
+static int
+quota_handle_cmd_cursorrewind(struct mount *mp, struct lwp *l,
+ struct vfs_quotactl_args *args)
+{
+ struct ufsmount *ump = VFSTOUFS(mp);
+ struct quotakcursor *cursor;
+ int error;
+
+ KASSERT(args->qc_type == QCT_CURSORREWIND);
+ cursor = args->u.cursorrewind.qc_cursor;
+
+#ifdef QUOTA2
+ if (ump->um_flags & UFS_QUOTA2) {
+ error = quota2_handle_cmd_cursorrewind(ump, cursor);
+ } else
+#endif
+ error = EOPNOTSUPP;
+
+ return error;
+}
+
+static int
quota_handle_cmd_quotaon(struct mount *mp, struct lwp *l,
struct vfs_quotactl_args *args)
{
diff -r 1d0d2dbce8e6 -r 01c405e84130 sys/ufs/ufs/ufs_quota.h
--- a/sys/ufs/ufs/ufs_quota.h Sun Jan 29 07:08:58 2012 +0000
+++ b/sys/ufs/ufs/ufs_quota.h Sun Jan 29 07:09:52 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota.h,v 1.19 2012/01/29 07:08:58 dholland Exp $ */
+/* $NetBSD: ufs_quota.h,v 1.20 2012/01/29 07:09:52 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -131,10 +131,15 @@
int quota2_handle_cmd_put(struct ufsmount *, const struct quotakey *,
const struct quotaval *);
int quota2_handle_cmd_delete(struct ufsmount *, const struct quotakey *);
-int quota2_handle_cmd_getall(struct ufsmount *, struct quotakcursor *,
+int quota2_handle_cmd_cursorget(struct ufsmount *, struct quotakcursor *,
struct quotakey *, struct quotaval *, unsigned, unsigned *);
Home |
Main Index |
Thread Index |
Old Index