Source-Changes-HG archive

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

[src/trunk]: src/lib/libquota Add quota_getrestrictions() to report the seman...



details:   https://anonhg.NetBSD.org/src/rev/190f4278bd86
branches:  trunk
changeset: 773285:190f4278bd86
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jan 30 16:44:09 2012 +0000

description:
Add quota_getrestrictions() to report the semantic restrictions
associated with a particular quotahandle.

diffstat:

 lib/libquota/quota_schema.c |  31 ++++++++++++++++++++++++-------
 lib/libquota/quotapvt.h     |   3 ++-
 2 files changed, 26 insertions(+), 8 deletions(-)

diffs (97 lines):

diff -r 0e8daf01db84 -r 190f4278bd86 lib/libquota/quota_schema.c
--- a/lib/libquota/quota_schema.c       Mon Jan 30 16:44:08 2012 +0000
+++ b/lib/libquota/quota_schema.c       Mon Jan 30 16:44:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota_schema.c,v 1.4 2012/01/25 17:43:37 dholland Exp $        */
+/*     $NetBSD: quota_schema.c,v 1.5 2012/01/30 16:44:09 dholland Exp $        */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: quota_schema.c,v 1.4 2012/01/25 17:43:37 dholland Exp $");
+__RCSID("$NetBSD: quota_schema.c,v 1.5 2012/01/30 16:44:09 dholland Exp $");
 
 #include <sys/types.h>
 #include <sys/statvfs.h>
@@ -65,7 +65,28 @@
        return NULL;
 }
 
-/* ARGSUSED */
+unsigned
+quota_getrestrictions(struct quotahandle *qh)
+{
+       switch (qh->qh_mode) {
+           case QUOTA_MODE_NFS:
+               /* XXX this should maybe report the rquotad protocol version */
+               return QUOTA_RESTRICT_32BIT | QUOTA_RESTRICT_READONLY;
+
+           case QUOTA_MODE_PROPLIB:
+               return __quota_proplib_getrestrictions(qh);
+
+           case QUOTA_MODE_OLDFILES:
+               return QUOTA_RESTRICT_NEEDSQUOTACHECK |
+                       QUOTA_RESTRICT_UNIFORMGRACE |
+                       QUOTA_RESTRICT_32BIT;
+           default:
+               break;
+       }
+       errno = EINVAL;
+       return 0;
+}
+
 unsigned
 quota_getnumidtypes(struct quotahandle *qh)
 {
@@ -84,7 +105,6 @@
        return 2;
 }
 
-/* ARGSUSED */
 const char *
 quota_idtype_getname(struct quotahandle *qh, int idtype)
 {
@@ -111,7 +131,6 @@
        return "???";
 }
 
-/* ARGSUSED */
 unsigned
 quota_getnumobjtypes(struct quotahandle *qh)
 {
@@ -127,7 +146,6 @@
        return 2;
 }
 
-/* ARGSUSED */
 const char *
 quota_objtype_getname(struct quotahandle *qh, int objtype)
 {
@@ -152,7 +170,6 @@
        return "???"; /* ? */
 }
 
-/* ARGSUSED */
 int
 quota_objtype_isbytes(struct quotahandle *qh, int objtype)
 {
diff -r 0e8daf01db84 -r 190f4278bd86 lib/libquota/quotapvt.h
--- a/lib/libquota/quotapvt.h   Mon Jan 30 16:44:08 2012 +0000
+++ b/lib/libquota/quotapvt.h   Mon Jan 30 16:44:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quotapvt.h,v 1.10 2012/01/25 17:43:37 dholland Exp $   */
+/*     $NetBSD: quotapvt.h,v 1.11 2012/01/30 16:44:09 dholland Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -58,6 +58,7 @@
 /* proplib kernel interface */
 int __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret);
 const char *__quota_proplib_getimplname(struct quotahandle *);
+unsigned __quota_proplib_getrestrictions(struct quotahandle *);
 unsigned __quota_proplib_getnumidtypes(void);
 const char *__quota_proplib_idtype_getname(int idtype);
 unsigned __quota_proplib_getnumobjtypes(void);



Home | Main Index | Thread Index | Old Index