Source-Changes-HG archive

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

[src/trunk]: src/lib/libquota Move some more stuff technically specific to th...



details:   https://anonhg.NetBSD.org/src/rev/2a980ce361d4
branches:  trunk
changeset: 773013:2a980ce361d4
user:      dholland <dholland%NetBSD.org@localhost>
date:      Wed Jan 25 01:22:56 2012 +0000

description:
Move some more stuff technically specific to the proplib kernel
interface into the source file for using the proplib kernel interface.

diffstat:

 lib/libquota/quota_proplib.c |  45 ++++++++++++++++++++++++++++++++++++++++++-
 lib/libquota/quota_schema.c  |  26 ++++++------------------
 lib/libquota/quotapvt.h      |   7 +++++-
 3 files changed, 56 insertions(+), 22 deletions(-)

diffs (163 lines):

diff -r 85f8f0fb08c6 -r 2a980ce361d4 lib/libquota/quota_proplib.c
--- a/lib/libquota/quota_proplib.c      Wed Jan 25 00:43:03 2012 +0000
+++ b/lib/libquota/quota_proplib.c      Wed Jan 25 01:22:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota_proplib.c,v 1.6 2012/01/09 15:43:19 dholland Exp $       */
+/*     $NetBSD: quota_proplib.c,v 1.7 2012/01/25 01:22:56 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.6 2012/01/09 15:43:19 dholland Exp $");
+__RCSID("$NetBSD: quota_proplib.c,v 1.7 2012/01/25 01:22:56 dholland Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -180,6 +180,47 @@
        return "unknown";
 }
 
+unsigned
+__quota_proplib_getnumidtypes(void)
+{
+       return QUOTA_NCLASS;
+}
+
+const char *
+__quota_proplib_idtype_getname(int idtype)
+{
+       if (idtype < 0 || idtype >= QUOTA_NCLASS) {
+               return NULL;
+       }
+       return ufs_quota_class_names[idtype];
+}
+
+unsigned
+__quota_proplib_getnumobjtypes(void)
+{
+       return QUOTA_NLIMITS;
+}
+
+const char *
+__quota_proplib_objtype_getname(int objtype)
+{
+       if (objtype < 0 || objtype >= QUOTA_NLIMITS) {
+               return NULL;
+       }
+       return ufs_quota_limit_names[objtype];
+}
+
+int
+__quota_proplib_objtype_isbytes(int objtype)
+{
+       switch (objtype) {
+               case QUOTA_LIMIT_BLOCK: return 1;
+               case QUOTA_LIMIT_FILE: return 0;
+               default: break;
+       }
+       return 0;
+}
+
 static int
 __quota_proplib_extractval(int objtype, prop_dictionary_t data,
                           struct quotaval *qv)
diff -r 85f8f0fb08c6 -r 2a980ce361d4 lib/libquota/quota_schema.c
--- a/lib/libquota/quota_schema.c       Wed Jan 25 00:43:03 2012 +0000
+++ b/lib/libquota/quota_schema.c       Wed Jan 25 01:22:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quota_schema.c,v 1.2 2012/01/09 15:34:34 dholland Exp $        */
+/*     $NetBSD: quota_schema.c,v 1.3 2012/01/25 01:22:57 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.2 2012/01/09 15:34:34 dholland Exp $");
+__RCSID("$NetBSD: quota_schema.c,v 1.3 2012/01/25 01:22:57 dholland Exp $");
 
 #include <sys/types.h>
 #include <sys/statvfs.h>
@@ -38,7 +38,6 @@
 #include <errno.h>
 
 #include <quota.h>
-#include <quota/quotaprop.h>
 #include "quotapvt.h"
 
 /*
@@ -60,44 +59,33 @@
 unsigned
 quota_getnumidtypes(struct quotahandle *qh)
 {
-       return QUOTA_NCLASS;
+       return __quota_proplib_getnumidtypes();
 }
 
 /* ARGSUSED */
 const char *
 quota_idtype_getname(struct quotahandle *qh, int idtype)
 {
-       if (idtype < 0 || idtype >= QUOTA_NCLASS) {
-               return NULL;
-       }
-       return ufs_quota_class_names[idtype];
+       return __quota_proplib_idtype_getname(idtype);
 }
 
 /* ARGSUSED */
 unsigned
 quota_getnumobjtypes(struct quotahandle *qh)
 {
-       return QUOTA_NLIMITS;
+       return __quota_proplib_getnumobjtypes();
 }
 
 /* ARGSUSED */
 const char *
 quota_objtype_getname(struct quotahandle *qh, int objtype)
 {
-       if (objtype < 0 || objtype >= QUOTA_NLIMITS) {
-               return NULL;
-       }
-       return ufs_quota_limit_names[objtype];
+       return __quota_proplib_objtype_getname(objtype);
 }
 
 /* ARGSUSED */
 int
 quota_objtype_isbytes(struct quotahandle *qh, int objtype)
 {
-       switch (objtype) {
-               case QUOTA_LIMIT_BLOCK: return 1;
-               case QUOTA_LIMIT_FILE: return 0;
-               default: break;
-       }
-       return 0;
+       return __quota_proplib_objtype_isbytes(objtype);
 }
diff -r 85f8f0fb08c6 -r 2a980ce361d4 lib/libquota/quotapvt.h
--- a/lib/libquota/quotapvt.h   Wed Jan 25 00:43:03 2012 +0000
+++ b/lib/libquota/quotapvt.h   Wed Jan 25 01:22:56 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quotapvt.h,v 1.8 2012/01/09 15:45:19 dholland Exp $    */
+/*     $NetBSD: quotapvt.h,v 1.9 2012/01/25 01:22:57 dholland Exp $    */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -54,6 +54,11 @@
 /* proplib kernel interface */
 int __quota_proplib_getversion(struct quotahandle *qh, int8_t *version_ret);
 const char *__quota_proplib_getimplname(struct quotahandle *);
+unsigned __quota_proplib_getnumidtypes(void);
+const char *__quota_proplib_idtype_getname(int idtype);
+unsigned __quota_proplib_getnumobjtypes(void);
+const char *__quota_proplib_objtype_getname(int objtype);
+int __quota_proplib_objtype_isbytes(int objtype);
 int __quota_proplib_get(struct quotahandle *qh, const struct quotakey *qk,
                        struct quotaval *qv);
 int __quota_proplib_put(struct quotahandle *qh, const struct quotakey *qk,



Home | Main Index | Thread Index | Old Index