summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f067692)
raw | patch | inline | side by side (parent: f067692)
author | niki <niki> | |
Tue, 29 Nov 2005 23:31:13 +0000 (23:31 +0000) | ||
committer | niki <niki> | |
Tue, 29 Nov 2005 23:31:13 +0000 (23:31 +0000) |
src/config.h.in | patch | blob | history | |
src/quota_mnt.c | patch | blob | history |
diff --git a/src/config.h.in b/src/config.h.in
index b49392eb5f7ac7632aeba9e739291ba94d336070..77604deeaf62269c817abfb911f81669239d0209 100644 (file)
--- a/src/config.h.in
+++ b/src/config.h.in
/* Define to 1 if you have the <sys/fs_types.h> header file. */
#undef HAVE_SYS_FS_TYPES_H
+/* Define to 1 if you have the <sys/mntent.h> header file. */
+#undef HAVE_SYS_MNTENT_H
+
/* Define to 1 if you have the <sys/mnttab.h> header file. */
#undef HAVE_SYS_MNTTAB_H
/* Define to 1 if you have the <sys/mount.h> header file. */
#undef HAVE_SYS_MOUNT_H
+/* Define to 1 if you have the <sys/quota.h> header file. */
+#undef HAVE_SYS_QUOTA_H
+
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
diff --git a/src/quota_mnt.c b/src/quota_mnt.c
index 19cfa76713da57d797df1401741d00df9be11089..fec543d60520e101264d3f835d121904724f5370 100644 (file)
--- a/src/quota_mnt.c
+++ b/src/quota_mnt.c
#if HAVE_SYS_FS_TYPES_H /* Ultrix. */
#include <sys/fs_types.h>
#endif
+#if HAVE_SYS_MNTENT_H
+#include <sys/mntent.h>
+#endif
#if HAVE_SYS_MNTTAB_H /* SVR4. */
#include <sys/mnttab.h>
#endif
#if HAVE_SYS_VFSTAB_H
#include <sys/vfstab.h>
#endif
+#if HAVE_SYS_QUOTA_H
#include <sys/quota.h>
+#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/vfs.h>
int fd, rv = 1;
size_t namesize;
struct ext2_super_block e2sb;
+#if HAVE_XFS_XQM_H
struct xfs_super_block xfsb;
+#endif
struct reiserfs_super_block reisersb;
fd = open(device, O_RDONLY);
for(s = ptname; *s; s++);
- if(isdigit(s[-1])) {
+ if(isdigit((int)s[-1])) {
/*
* Note: this is a heuristic only - there is no reason
* why these devices should live in /dev.
static unsigned char
fromhex(char c)
{
- if(isdigit(c)) {
+ if(isdigit((int)c)) {
return (c - '0');
- } else if(islower(c)) {
+ } else if(islower((int)c)) {
return (c - 'a' + 10);
} else {
return (c - 'A' + 10);
if(*s == '-') {
s++;
}
- if(!isxdigit(s[0]) || !isxdigit(s[1])) {
+ if(!isxdigit((int)s[0]) || !isxdigit((int)s[1])) {
goto bad_uuid;
}
uuid[i] = ((fromhex(s[0]) << 4) | fromhex(s[1]));
return rc;
}
-/* Return if given option has nonempty argument */
-char *
-hasmntoptarg(struct mntent *mnt, char *opt)
-{
- char *p = hasmntopt(mnt, opt);
-
- if(!p) {
- return NULL;
- }
- p += strlen(opt);
- if(*p == '=' && p[1] != ',') {
- return p+1;
- }
- return NULL;
-}
-
/*
* Check whether give filesystem type is supported
*/
}
#endif /* HAVE_XFS_XQM_H */
-/*
- * Check to see if a particular quota is to be enabled (filesystem mounted
- * with proper option)
- */
-int
-hasquota(struct mntent *mnt, int type)
-{
- if(!correct_fstype(mnt->mnt_type) || hasmntopt(mnt, MNTOPT_NOQUOTA)) {
- return 0;
- }
-#if HAVE_XFS_XQM_H
- if(!strcmp(mnt->mnt_type, MNTTYPE_XFS)) {
- return hasxfsquota(mnt, type);
- }
-#endif
- if(nfs_fstype(mnt->mnt_type)) {
- /* NFS always has quota or better there is
- no good way how to detect it */
- return 1;
- }
-
- if((type == USRQUOTA) && (hasmntopt(mnt, MNTOPT_USRQUOTA)
- || hasmntoptarg(mnt, MNTOPT_USRJQUOTA))) {
- return 1;
- }
- if((type == GRPQUOTA) && (hasmntopt(mnt, MNTOPT_GRPQUOTA)
- || hasmntoptarg(mnt, MNTOPT_GRPJQUOTA))) {
- return 1;
- }
- if((type == USRQUOTA) && hasmntopt(mnt, MNTOPT_QUOTA)) {
- return 1;
- }
-
- return 0;
-}
-
-/* END stolen from quota-3.13 (quota-tools) */
-
-
#if HAVE_LISTMNTENT
static void