quotas: remove legacy AIX quota code that is covered by sysquotas now
authorBjoern Jacke <bj@sernet.de>
Thu, 31 Jan 2019 03:57:38 +0000 (21:57 -0600)
committerBjoern Jacke <bjacke@samba.org>
Sun, 17 Feb 2019 12:33:14 +0000 (13:33 +0100)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/smbd/quotas.c

index 2f18e368b17502131c1490af55ad596d6e1e1c17..c9472682f8fe08541435a476ab0b56d8623e9008 100644 (file)
@@ -335,128 +335,6 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
        return true;
 }
 
-
-#else /* not Solaris */
-
-#if           AIX
-/* AIX quota patch from Ole Holm Nielsen <ohnielse@fysik.dtu.dk> */
-#include <jfs/quota.h>
-/* AIX 4.X: Rename members of the dqblk structure (ohnielse@fysik.dtu.dk) */
-#define dqb_curfiles dqb_curinodes
-#define dqb_fhardlimit dqb_ihardlimit
-#define dqb_fsoftlimit dqb_isoftlimit
-#ifdef _AIXVERSION_530 
-#include <sys/statfs.h>
-#include <sys/vmount.h>
-#endif /* AIX 5.3 */
-#else /* !AIX */
-#include <sys/quota.h>
-#include <devnm.h>
-#endif
-
-
-/****************************************************************************
-try to get the disk space from disk quotas - default version
-****************************************************************************/
-
-bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
-                uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
-{
-  int r;
-  struct dqblk D;
-  uid_t euser_id;
-  const char *path = fname->base_name;
-#if !defined(AIX)
-  char dev_disk[256];
-  SMB_STRUCT_STAT S = fname->st;
-
-  /* find the block device file */
-
-  if ((sys_stat(path, &S, false)<0)
-      || (devnm(S_IFBLK, S.st_ex_dev, dev_disk, 256, 0)<0))
-       return (False);
-
-#endif /* !defined(AIX) */
-
-  euser_id = geteuid();
-
-#if   defined(AIX)
-  /* AIX has both USER and GROUP quotas: 
-     Get the USER quota (ohnielse@fysik.dtu.dk) */
-#ifdef _AIXVERSION_530
-  {
-    struct statfs statbuf;
-    quota64_t user_quota;
-    if (statfs(path,&statbuf) != 0)
-      return False;
-    if(statbuf.f_vfstype == MNT_J2)
-    {
-    /* For some reason we need to be root for jfs2 */
-      become_root();
-      r = quotactl(path,QCMD(Q_J2GETQUOTA,USRQUOTA),euser_id,(char *) &user_quota);
-      unbecome_root();
-    /* Copy results to old struct to let the following code work as before */
-      D.dqb_curblocks  = user_quota.bused;
-      D.dqb_bsoftlimit = user_quota.bsoft;
-      D.dqb_bhardlimit = user_quota.bhard;
-      D.dqb_curfiles   = user_quota.iused;
-      D.dqb_fsoftlimit = user_quota.isoft;
-      D.dqb_fhardlimit = user_quota.ihard;
-    }
-    else if(statbuf.f_vfstype == MNT_JFS)
-    {
-#endif /* AIX 5.3 */
-  save_re_uid();
-  if (set_re_uid() != 0) 
-    return False;
-  r= quotactl(path,QCMD(Q_GETQUOTA,USRQUOTA),euser_id,(char *) &D);
-  restore_re_uid();
-#ifdef _AIXVERSION_530
-    }
-    else
-      r = 1; /* Fail for other FS-types */
-  }
-#endif /* AIX 5.3 */
-#else /* !AIX */
-  r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
-#endif /* !AIX */
-
-  /* Use softlimit to determine disk space, except when it has been exceeded */
-  *bsize = 1024;
-
-  if (r)
-    {
-      if (errno == EDQUOT) 
-       {
-         *dfree =0;
-         *dsize =D.dqb_curblocks;
-         return (True);
-       }
-      else return(False);
-    }
-
-  /* If softlimit is zero, set it equal to hardlimit.
-   */
-
-  if (D.dqb_bsoftlimit==0)
-    D.dqb_bsoftlimit = D.dqb_bhardlimit;
-
-  if (D.dqb_bsoftlimit==0)
-    return(False);
-  /* Use softlimit to determine disk space, except when it has been exceeded */
-  if ((D.dqb_curblocks>D.dqb_bsoftlimit)
-||((D.dqb_curfiles>D.dqb_fsoftlimit) && (D.dqb_fsoftlimit != 0))
-    ) {
-      *dfree = 0;
-      *dsize = D.dqb_curblocks;
-    }
-  else {
-    *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
-    *dsize = D.dqb_bsoftlimit;
-  }
-  return (True);
-}
-
 #endif /* Solaris */
 
 #else /* WITH_QUOTAS */