s3:lib/sysquota: remove ugly LARGE_SMB_OFF_T ifdef's
[kai/samba.git] / source3 / lib / sysquotas.c
index 4a2d88abdf5ee58d2394cd0657ed6d8da779f9fa..12c34edaa2c941b1add2ae1e9a0adc47f007d0a0 100644 (file)
@@ -60,10 +60,10 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
        (*bdev) = NULL;
        (*fs) = NULL;
        
-       if ( sys_stat(path, &S) == -1 )
+       if ( sys_stat(path, &S, false) == -1 )
                return (-1);
 
-       devno = S.st_dev ;
+       devno = S.st_ex_dev ;
 
        fp = setmntent(MOUNTED,"r");
        if (fp == NULL) {
@@ -71,10 +71,10 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
        }
   
        while ((mnt = getmntent(fp))) {
-               if ( sys_stat(mnt->mnt_dir,&S) == -1 )
+               if ( sys_stat(mnt->mnt_dir, &S, false) == -1 )
                        continue ;
 
-               if (S.st_dev == devno) {
+               if (S.st_ex_dev == devno) {
                        (*mntpath) = SMB_STRDUP(mnt->mnt_dir);
                        (*bdev) = SMB_STRDUP(mnt->mnt_fsname);
                        (*fs)   = SMB_STRDUP(mnt->mnt_type);
@@ -114,11 +114,11 @@ static int sys_path_to_bdev(const char *path, char **mntpath, char **bdev, char
        
        /* find the block device file */
 
-       if ((ret=sys_stat(path, &S))!=0) {
+       if ((ret=sys_stat(path, &S, false))!=0) {
                return ret;
        }
        
-       if ((ret=devnm(S_IFBLK, S.st_dev, dev_disk, 256, 1))!=0) {
+       if ((ret=devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 1))!=0) {
                return ret;     
        }
 
@@ -177,6 +177,9 @@ static struct {
 #ifdef HAVE_XFS_QUOTAS
        {"xfs", sys_get_xfs_quota,      sys_set_xfs_quota},
 #endif /* HAVE_XFS_QUOTAS */
+#ifdef HAVE_NFS_QUOTAS
+       {"nfs", sys_get_nfs_quota,      sys_set_nfs_quota},
+#endif /* HAVE_NFS_QUOTAS */
        {NULL,  NULL,                   NULL}
 };
 
@@ -295,12 +298,11 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
                                dp->bsize = 1024;
                        }
 
-                       file_lines_free(lines);
+                       TALLOC_FREE(lines);
                        lines = NULL;
 
                        DEBUG (3, ("Parsed output of get_quota, ...\n"));
 
-#ifdef LARGE_SMB_OFF_T
                        DEBUGADD (5,( 
                                "qflags:%u curblocks:%llu softlimit:%llu hardlimit:%llu\n"
                                "curinodes:%llu isoftlimit:%llu ihardlimit:%llu bsize:%llu\n", 
@@ -309,16 +311,6 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
                                (long long unsigned)dp->curinodes,
                                (long long unsigned)dp->isoftlimit,(long long unsigned)dp->ihardlimit,
                                (long long unsigned)dp->bsize));
-#else /* LARGE_SMB_OFF_T */
-                       DEBUGADD (5,( 
-                               "qflags:%u curblocks:%lu softlimit:%lu hardlimit:%lu\n"
-                               "curinodes:%lu isoftlimit:%lu ihardlimit:%lu bsize:%lu\n", 
-                               dp->qflags,(long unsigned)dp->curblocks,
-                               (long unsigned)dp->softlimit,(long unsigned)dp->hardlimit,
-                               (long unsigned)dp->curinodes,
-                               (long unsigned)dp->isoftlimit,(long unsigned)dp->ihardlimit,
-                               (long unsigned)dp->bsize));
-#endif /* LARGE_SMB_OFF_T */
                        return 0;
                }
 
@@ -331,7 +323,7 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
 
 invalid_param:
 
-       file_lines_free(lines);
+       TALLOC_FREE(lines);
        DEBUG(0,("The output of get_quota_command is invalid!\n"));
        return -1;
 }
@@ -359,7 +351,6 @@ static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
                                return -1;
                }
 
-#ifdef LARGE_SMB_OFF_T
                if (asprintf(&syscmd,
                        "%s \"%s\" %d %d "
                        "%u %llu %llu "
@@ -370,18 +361,6 @@ static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
                        (long long unsigned)dp->bsize) < 0) {
                        return -1;
                }
-#else /* LARGE_SMB_OFF_T */
-               if (asprintf(&syscmd,
-                       "%s \"%s\" %d %d "
-                       "%u %lu %lu "
-                       "%lu %lu %lu ",
-                       set_quota_command, path, qtype, _id, dp->qflags,
-                       (long unsigned)dp->softlimit,(long unsigned)dp->hardlimit,
-                       (long unsigned)dp->isoftlimit,(long unsigned)dp->ihardlimit,
-                       (long unsigned)dp->bsize) < 0) {
-                       return -1;
-               }
-#endif /* LARGE_SMB_OFF_T */
 
                DEBUG (3, ("get_quota: Running command %s\n", syscmd));
 
@@ -392,7 +371,7 @@ static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
 
                        DEBUG (3, ("Read output from set_quota, \"%s\"\n", line));
 
-                       file_lines_free(lines);
+                       TALLOC_FREE(lines);
 
                        return 0;
                }