Code

made getmountopt and checkmountopt public as quota_mnt_getmountopt and quota_mnt_chec...
authorniki <niki>
Thu, 8 Dec 2005 22:14:24 +0000 (22:14 +0000)
committerniki <niki>
Thu, 8 Dec 2005 22:14:24 +0000 (22:14 +0000)
src/quota_mnt.c
src/quota_mnt.h

index a0efab15155e94329cea537901e87a157c0ab140..921c589862a631658899482744e2854485d04c08 100644 (file)
 
 
 
-/* *** *** ***   prototypes   *** *** *** */
-
-static char *getmountopt(char *line, char *keyword);
-static char *checkmountopt(char *line, char *keyword, int full);
-
-
-
 /* *** *** ***   local functions   *** *** *** */
 
 
@@ -444,8 +437,8 @@ quota_mnt_getvfsmnt(FILE *mntf, quota_mnt_t **list)
 }
 #endif /* HAVE_GETVFSENT */
 
-static char *
-checkmountopt(char *line, char *keyword, int full)
+char *
+quota_mnt_checkmountopt(char *line, char *keyword, int full)
 {
        char *line2, *l2;
        int l = strlen(keyword);
@@ -482,14 +475,14 @@ checkmountopt(char *line, char *keyword, int full)
 
        free(line2);
        return NULL;
-} /* static char *checkmountopt(char *line, char *keyword, int full) */
+} /* char *quota_mnt_checkmountopt(char *line, char *keyword, int full) */
 
-static char *
-getmountopt(char *line, char *keyword)
+char *
+quota_mnt_getmountopt(char *line, char *keyword)
 {
        char *r;
 
-       r = checkmountopt(line, keyword, 0);
+       r = quota_mnt_checkmountopt(line, keyword, 0);
        if(r != NULL) {
                char *p;
                r += strlen(keyword);
@@ -510,7 +503,7 @@ getmountopt(char *line, char *keyword)
                }
        }
        return r;
-} /* static char *getmountopt(char *line, char *keyword) */
+} /* char *quota_mnt_getmountopt(char *line, char *keyword) */
 
 #if HAVE_GETMNTENT
 static void
@@ -541,19 +534,19 @@ quota_mnt_getmntent(FILE *mntf, quota_mnt_t **list)
                        continue;
                }
 
-               if(checkmountopt(mnt->mnt_opts, MNTOPT_NOQUOTA, 1) != NULL) {
+               if(quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_NOQUOTA, 1) != NULL) {
                        DBG("noquota option on fs (%s) %s (%s): ignored",
                                mnt->mnt_type, mnt->mnt_dir, mnt->mnt_fsname);
                        continue;
                }
 
-               if(checkmountopt(mnt->mnt_opts, "bind", 1) != NULL) {
+               if(quota_mnt_checkmountopt(mnt->mnt_opts, "bind", 1) != NULL) {
                        DBG("bind mount on fs (%s) %s (%s): ignored",
                                mnt->mnt_type, mnt->mnt_dir, mnt->mnt_fsname);
                        continue;
                }
 
-               loop = getmountopt(mnt->mnt_opts, "loop=");
+               loop = quota_mnt_getmountopt(mnt->mnt_opts, "loop=");
                if(loop == NULL) {   /* no loop= mount */
                        device = get_device_name(mnt->mnt_fsname);
                        if(device == NULL) {
@@ -566,9 +559,9 @@ quota_mnt_getmntent(FILE *mntf, quota_mnt_t **list)
                        device = loop;
                }
 
-               usrjquota = getmountopt(mnt->mnt_opts, "usrjquota=");
-               grpjquota = getmountopt(mnt->mnt_opts, "grpjquota=");
-               jqfmt = getmountopt(mnt->mnt_opts, "jqfmt=");
+               usrjquota = quota_mnt_getmountopt(mnt->mnt_opts, "usrjquota=");
+               grpjquota = quota_mnt_getmountopt(mnt->mnt_opts, "grpjquota=");
+               jqfmt = quota_mnt_getmountopt(mnt->mnt_opts, "jqfmt=");
 
 #if HAVE_XFS_XQM_H
                if(!strcmp(mnt->mnt_type, MNTTYPE_XFS)) {
@@ -586,11 +579,11 @@ quota_mnt_getmntent(FILE *mntf, quota_mnt_t **list)
                        }
                } else {
 #endif /* HAVE_XFS_XQM_H */
-                       if(checkmountopt(mnt->mnt_opts, MNTOPT_QUOTA, 1)
+                       if(quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_QUOTA, 1)
                                == NULL
-                       && checkmountopt(mnt->mnt_opts, MNTOPT_USRQUOTA, 1)
+                       && quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_USRQUOTA, 1)
                                == NULL
-                       && checkmountopt(mnt->mnt_opts, MNTOPT_GRPQUOTA, 1)
+                       && quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_GRPQUOTA, 1)
                                == NULL
                        && quota_fs_isnfs(mnt->mnt_type) == EXIT_FAILURE)
                        {
@@ -620,11 +613,11 @@ quota_mnt_getmntent(FILE *mntf, quota_mnt_t **list)
 /* TODO: this is not sufficient for XFS! */
 /* TODO: maybe we should anyway NOT rely on the option in the mountfile...
    ... maybe the fs should be asked direktly all time! */
-               if(checkmountopt(mnt->mnt_opts, MNTOPT_QUOTA, 1) != NULL
-               || checkmountopt(mnt->mnt_opts, MNTOPT_USRQUOTA, 1) != NULL) {
+               if(quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_QUOTA, 1) != NULL
+               || quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_USRQUOTA, 1) != NULL) {
                        (*list)->opts |= QMO_USRQUOTA;
                }
-               if(checkmountopt(mnt->mnt_opts, MNTOPT_GRPQUOTA, 1) != NULL) {
+               if(quota_mnt_checkmountopt(mnt->mnt_opts, MNTOPT_GRPQUOTA, 1) != NULL) {
                        (*list)->opts |= QMO_GRPQUOTA;
                }
                (*list)->next = NULL;
index cbe0a09487774bd0ad0e2d6dfef5ef7bb5d21ace..7b56bf1cae34ed8bb02b64e6ac5a977fbdcb126d 100644 (file)
@@ -42,9 +42,9 @@
 
 typedef struct _quota_mnt_t quota_mnt_t;
 struct _quota_mnt_t {
-       char *dir;
-       char *device;
-       char *type;
+       char *dir;         /* "/sys" or "/" */
+       char *device;      /* "none" or "/dev/hda1" */
+       char *type;        /* "sysfs" or "ext3"*/
        char *usrjquota;
        char *grpjquota;
        char *jqfmt;
@@ -54,6 +54,9 @@ struct _quota_mnt_t {
 
 int quota_mnt_type(const char *type);
 
+char *quota_mnt_getmountopt(char *line, char *keyword);
+char *quota_mnt_checkmountopt(char *line, char *keyword, int full);
+
 quota_mnt_t *quota_mnt_getlist(quota_mnt_t **list);
 void quota_mnt_freelist(quota_mnt_t *list);