]> arthur.barton.de Git - netatalk.git/commitdiff
MFS: Fix NFS quotas on Tru64.
authorjmarcus <jmarcus>
Thu, 29 Aug 2002 17:22:06 +0000 (17:22 +0000)
committerjmarcus <jmarcus>
Thu, 29 Aug 2002 17:22:06 +0000 (17:22 +0000)
etc/afpd/nfsquota.c
etc/afpd/quota.c

index 893bf78d26ec343c7ac942143b695fbb31bddbd7..61a4b8ec435cedbf37cbd449240f8078556bec33 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: nfsquota.c,v 1.9 2002-08-05 04:38:50 jmarcus Exp $
+ * $Id: nfsquota.c,v 1.10 2002-08-29 17:22:06 jmarcus Exp $
  *
  * parts of this are lifted from the bsd quota program and are
  * therefore under the following copyright:
@@ -149,15 +149,15 @@ int getnfsquota(const struct vol *vol, const int uid, const u_int32_t bsize,
     case Q_OK: /* we only copy the bits that we need. */
         gettimeofday(&tv, NULL);
 
-#ifdef __svr4__
+#if defined(__svr4__) || defined(TRU64)
         /* why doesn't using bsize work? */
 #define NFS_BSIZE gq_rslt.GQR_RQUOTA.rq_bsize / DEV_BSIZE
-#else /* __svr4__ */
+#else /* __svr4__ || TRU64 */
         /* NOTE: linux' rquotad program doesn't currently report the
         * correct rq_bsize. */
        /* NOTE: This is integer division and can introduce rounding errors */
 #define NFS_BSIZE gq_rslt.GQR_RQUOTA.rq_bsize / bsize
-#endif /* __svr4__ */
+#endif /* __svr4__  || TRU64 */
 
         dqp->dqb_bhardlimit =
             gq_rslt.GQR_RQUOTA.rq_bhardlimit*NFS_BSIZE;
index 9df3ac58aa86d22796aebb1780e1835df3f1a1be..dded3350b29e10450fa011a547c5626d2aa0fb2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: quota.c,v 1.21 2002-03-24 01:23:41 sibaz Exp $
+ * $Id: quota.c,v 1.22 2002-08-29 17:22:06 jmarcus Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -139,8 +139,14 @@ int         *nfs;
         return( NULL );
     }
 
+#ifdef TRU64
+    /* Digital UNIX: The struct sfs contains a field sfs.f_type,
+     * the MOUNT_* constants are defined in <sys/mount.h> */
+    if ((sfs.f_type == MOUNT_NFS)||(sfs.f_type == MOUNT_NFS3))
+#else /* TRU64 */
     /* XXX: make sure this really detects an nfs mounted fs */
     if (strchr(sfs.f_mntfromname, ':'))
+#endif /* TRU64 */
         *nfs = 1;
     return( sfs.f_mntfromname );
 }
@@ -345,8 +351,43 @@ const u_int32_t     bsize;
     }
 #endif
 
+#ifdef TRU64
+    /* Digital UNIX: Two forms of specifying an NFS filesystem are possible,
+       either 'hostname:path' or 'path@hostname' (Ultrix heritage) */
+    if (vol->v_nfs) {
+       char *hostpath;
+       char pathstring[MNAMELEN];
+       /* MNAMELEN ist defined in <sys/mount.h> */
+       int result;
+       
+       if ((hostpath = strchr(vol->v_gvs,'@')) != NULL ) {
+           /* convert 'path@hostname' to 'hostname:path',
+            * call getnfsquota(),
+            * convert 'hostname:path' back to 'path@hostname' */
+           *hostpath = '\0';
+           sprintf(pathstring,"%s:%s",hostpath+1,vol->v_gvs);
+           strcpy(vol->v_gvs,pathstring);
+           
+           result = getnfsquota(vol, uuid, bsize, dq);
+           
+           hostpath = strchr(vol->v_gvs,':');
+           *hostpath = '\0';
+           sprintf(pathstring,"%s@%s",hostpath+1,vol->v_gvs);
+           strcpy(vol->v_gvs,pathstring);
+           
+           return result;
+       }
+       else
+           /* vol->v_gvs is of the form 'hostname:path' */
+           return getnfsquota(vol, uuid, bsize, dq);
+    } else
+       /* local filesystem */
+       return getfsquota(vol, uuid, dq);
+          
+#else /* TRU64 */
     return vol->v_nfs ? getnfsquota(vol, uuid, bsize, dq) :
            getfsquota(vol, uuid, dq);
+#endif /* TRU64 */
 }
 
 static int overquota( dqblk )