Source-Changes-HG archive

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

[src/trunk]: src Add quota_getrestrictions() to report the semantic restrictions



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

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

diffstat:

 include/quota.h              |   1 +
 lib/libquota/quota_proplib.c |  22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r abd3343ca025 -r dc57264610c1 include/quota.h
--- a/include/quota.h   Mon Jan 30 16:44:03 2012 +0000
+++ b/include/quota.h   Mon Jan 30 16:44:08 2012 +0000
@@ -46,6 +46,7 @@
 const char *quota_getmountdevice(struct quotahandle *);
 
 const char *quota_getimplname(struct quotahandle *);
+unsigned quota_getrestrictions(struct quotahandle *);
 
 unsigned quota_getnumidtypes(struct quotahandle *);
 const char *quota_idtype_getname(struct quotahandle *, int /*idtype*/);
diff -r abd3343ca025 -r dc57264610c1 lib/libquota/quota_proplib.c
--- a/lib/libquota/quota_proplib.c      Mon Jan 30 16:44:03 2012 +0000
+++ b/lib/libquota/quota_proplib.c      Mon Jan 30 16:44:08 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota_proplib.c,v 1.8 2012/01/30 06:00:49 dholland Exp $       */
+/*     $NetBSD: quota_proplib.c,v 1.9 2012/01/30 16:44:08 dholland Exp $       */
 /*-
   * Copyright (c) 2011 Manuel Bouyer
   * All rights reserved.
@@ -26,7 +26,7 @@
   */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: quota_proplib.c,v 1.8 2012/01/30 06:00:49 dholland Exp $");
+__RCSID("$NetBSD: quota_proplib.c,v 1.9 2012/01/30 16:44:08 dholland Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -181,6 +181,24 @@
 }
 
 unsigned
+__quota_proplib_getrestrictions(struct quotahandle *qh)
+{
+       int8_t version;
+
+       if (__quota_proplib_getversion(qh, &version) < 0) {
+               /* XXX no decent way to report an error here */
+               return 0;
+       }
+       switch (version) {
+               case 1: return QUOTA_RESTRICT_NEEDSQUOTACHECK |
+                               QUOTA_RESTRICT_UNIFORMGRACE |
+                               QUOTA_RESTRICT_32BIT;
+               default: break;
+       }
+       return 0;
+}
+
+unsigned
 __quota_proplib_getnumidtypes(void)
 {
        return QUOTA_NCLASS;



Home | Main Index | Thread Index | Old Index