r8109 - in /branches/upstream/libquota-perl/current: ./ contrib/ contrib/aix_jfs2_class/ hints/ include/

rmayorga-guest at users.alioth.debian.org rmayorga-guest at users.alioth.debian.org
Tue Oct 9 03:05:23 UTC 2007


Author: rmayorga-guest
Date: Tue Oct  9 03:05:22 2007
New Revision: 8109

URL: http://svn.debian.org/wsvn/?sc=1&rev=8109
Log:
[svn-upgrade] Integrating new upstream version, libquota-perl (1.5.2)

Added:
    branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/
    branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.pm
    branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.xs
    branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl   (with props)
Modified:
    branches/upstream/libquota-perl/current/CHANGES
    branches/upstream/libquota-perl/current/Quota.pm
    branches/upstream/libquota-perl/current/Quota.xs
    branches/upstream/libquota-perl/current/README
    branches/upstream/libquota-perl/current/afsquota.c
    branches/upstream/libquota-perl/current/contrib/mount-list-qcarg.pl
    branches/upstream/libquota-perl/current/hints/aix_4_1.h
    branches/upstream/libquota-perl/current/include/quotaio_xfs.h
    branches/upstream/libquota-perl/current/test.pl

Modified: branches/upstream/libquota-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/CHANGES?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/CHANGES (original)
+++ branches/upstream/libquota-perl/current/CHANGES Tue Oct  9 03:05:22 2007
@@ -1,3 +1,15 @@
+Changes in 1.5.2 (October 2007)
+- Added support for new quotactl() parameters in JFS2 on AIX 5.3.
+  Thanks to Joshua Frigerio (joshua at uic.edu) for providing a development
+  account.  (Note: also prepared support for JFS2 quota classes; this is
+  yet unfinished and untested. See sub-directory contrib/aix_jfs2_class)
+- Added support for XFS project quotas on request of
+  Sten Spans (sten at blinkenlights.nl); received no feedback it if works.
+  Changed the "isgrp" param to Quota::query() and setqlim() from boolean
+  into an enum: 0:=user, 1:=group, 2:=project quotas.
+- Added a copyright notice to the main module and the manual page on
+  request of the Debian maintainer.
+
 Changes in 1.5.1 (July 2005)
 - Added new API function rpcauth: use non-default authentication for RPC
   Patch submitted by Karol Lassak

Modified: branches/upstream/libquota-perl/current/Quota.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/Quota.pm?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/Quota.pm (original)
+++ branches/upstream/libquota-perl/current/Quota.pm Tue Oct  9 03:05:22 2007
@@ -1,3 +1,18 @@
+# ------------------------------------------------------------------------ #
+# Quota.pm - Copyright (C) 1995-2007 Tom Zoerner
+# ------------------------------------------------------------------------ #
+# This program is free software: you can redistribute it and/or modify
+# it either under the terms of the Perl Artistic License or the GNU
+# General Public License as published by the Free Software Foundation.
+# (Either version 2 of the GPL, or any later version.)
+# For a copy of these licenses see <http://www.opensource.org/licenses/>.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# Perl Artistic License or GNU General Public License for more details.
+# ------------------------------------------------------------------------ #
+
 package Quota;
 
 require Exporter;
@@ -72,6 +87,7 @@
               defined($fsupp) && ($fsupp =~ /,VXFS/)) { $ret = "(VXFS)$ret" }
         elsif((($fstyp eq "afs") || ($fsname eq "AFS")) &&
               ($fsupp =~ /,AFS/)) { $ret = "(AFS)$target"; }
+        if   (($fstyp eq "jfs2") && ($fsupp =~ /,JFS2/)) { $ret = "(JFS2)$ret" }
         last;
       }
     }
@@ -90,7 +106,7 @@
   my($str);
 
   eval {
-    if(($! == &EINVAL) || ($! == &ENOTTY) || ($! == &ENOENT))
+    if(($! == &EINVAL) || ($! == &ENOTTY) || ($! == &ENOENT) || ($! == ENOSYS))
                          { $str = "No quotas on this system" }
     elsif($! == &ENODEV) { $str = "Not a standard file system" }
     elsif($! == &EPERM)  { $str = "Not privileged" }
@@ -120,7 +136,7 @@
 
     ($block_curr, $block_soft, $block_hard, $block_timelimit,
      $inode_curr, $inode_soft, $inode_hard, $inode_timelimit) =
-    Quota::query($dev [,$uid [,isgrp]]);
+    Quota::query($dev [,$uid [,kind]]);
 
     ($block_curr, $block_soft, $block_hard, $block_timelimit,
      $inode_curr, $inode_soft, $inode_hard, $inode_timelimit) =
@@ -131,7 +147,7 @@
     Quota::rpcauth([$uid [,$gid [,$hostname]]]);
 
     Quota::setqlim($dev, $uid, $block_soft, $block_hard,
-		   $inode_soft, $inode_hard [,$tlo [,isgrp]]);
+		   $inode_soft, $inode_hard [,$tlo [,kind]]);
 
     Quota::sync([$dev]);
 
@@ -154,7 +170,7 @@
 
 =over 4
 
-=item I<($bc,$bs,$bh,$bt, $ic,$is,$ih,$it) = Quota::query($dev, $uid, $isgrp)>
+=item I<($bc,$bs,$bh,$bt, $ic,$is,$ih,$it) = Quota::query($dev, $uid, $kind)>
 
 Get current usage and quota limits for a given file system and user.
 The user is specified by its numeric uid; defaults to the process'
@@ -187,13 +203,15 @@
 systems Quota::query will return undef in that case and
 errno will be set to ESRCH.
 
-When I<$isgrp> is given and set to 1, I<$uid> is taken as gid and
+When I<$kind> is given and set to 1, I<$uid> is taken as gid and
 group quotas are queried. This is B<not> supported across RPC and
 even locally only on a few architectures (e.g. Linux and other BSD
 based Unix variants, OSF/1 and  AIX - check the quotactl(2) man page
-on your systems). If unsupported, this flag is ignored.
-
-=item I<Quota::setqlim($dev, $uid, $bs,$bh, $is,$ih, $tlo, $isgrp)>
+on your systems). When I<$kind> is set to 2, project quotas are
+queried; this is currently only supported for XFS.  When unsupported,
+this flag is ignored.
+
+=item I<Quota::setqlim($dev, $uid, $bs,$bh, $is,$ih, $tlo, $kind)>
 
 Sets quota limits for the given user. Meanings of I<$dev>, I<$uid>,
 I<$bs>, I<$bh>, I<$is> and I<$ih> are the same as in B<Quota::query>.
@@ -206,9 +224,11 @@
 More alternatives (i.e. setting a specific time) aren't available in
 most implementations.
 
-When I<$isgrp> is given and set to 1, I<$uid> is taken as gid and
+When I<$kind> is given and set to 1, I<$uid> is taken as gid and
 group quota limits are set. This is supported only on a few
-architectures (see above). If unsupported, this flag is ignored.
+architectures (see above).When I<$kind> is set to 2, project quotas
+are modified; this is currently only supported for XFS.
+When unsupported, this flag is ignored.
 
 Note: if you want to set the quota of a particular user to zero, i.e.
 no write permission, you must not set all limits to zero, since that
@@ -313,6 +333,8 @@
 Note that this function only returns a defined result if you called a
 Quota command directly before which returned an error indication.
 
+=back
+
 =head1 RETURN VALUES
 
 Functions that are supposed return lists or scalars, return I<undef> upon
@@ -345,6 +367,13 @@
 have contributed to this process; for a complete
 list of names please see the CHANGES document.
 
+The quota module was in the public domain 1995-2001. Since 2001 it is
+licensed under both the Perl Artistic License and version 2 or later of the
+GNU General Public License as published by the Free Software Foundation.
+For a copy of these licenses see <http://www.opensource.org/licenses/>.
+The respective authors of the source code are it's owner in regard to
+copyright.
+
 =head1 SEE ALSO
 
 perl(1), edquota(1m),

Modified: branches/upstream/libquota-perl/current/Quota.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/Quota.xs?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/Quota.xs (original)
+++ branches/upstream/libquota-perl/current/Quota.xs Tue Oct  9 03:05:22 2007
@@ -270,10 +270,10 @@
 PROTOTYPES: DISABLE
 
 void
-query(dev,uid=getuid(),isgrp=0)
+query(dev,uid=getuid(),kind=0)
 	char *	dev
 	int	uid
-	int     isgrp
+	int     kind
 	PPCODE:
 	{
 	  struct dqblk dqblk;
@@ -289,7 +289,7 @@
 #ifndef linux
 	    err = quotactl(Q_XGETQUOTA, dev+5, uid, CADR &xfs_dqblk);
 #else
-	    err = quotactl(QCMD(Q_XGETQUOTA, (isgrp ? GRPQUOTA : USRQUOTA)), dev+5, uid, CADR &xfs_dqblk);
+	    err = quotactl(QCMD(Q_XGETQUOTA, ((kind == 2) ? XQM_PRJQUOTA : ((kind == 1) ? XQM_GRPQUOTA : XQM_USRQUOTA))), dev+5, uid, CADR &xfs_dqblk);
 #endif
 	    if(!err) {
 	      EXTEND(sp, 8);
@@ -367,16 +367,39 @@
 		     (ioctl(fd, Q_QUOTACTL, &qp) == -1));
 #else /* not USE_IOCTL */
 #ifdef Q_CTL_V3  /* Linux */
-	      err = linuxquota_query(dev, uid, isgrp, &dqblk);
+	      err = linuxquota_query(dev, uid, (kind != 0), &dqblk);
 #else /* not Q_CTL_V3 */
 #ifdef Q_CTL_V2
 #ifdef AIX
               /* AIX quotactl doesn't fail if path does not exist!? */
               struct stat st;
-	      if (stat(dev, &st)) err = 1;
-	      else
-#endif
-	      err = quotactl(dev, QCMD(Q_GETQUOTA, (isgrp ? GRPQUOTA : USRQUOTA)), uid, CADR &dqblk);
+#if defined(HAVE_JFS2)
+              if (strncmp(dev, "(JFS2)", 6) == 0) {
+                if (stat(dev + 6, &st)) {
+		  err = 1;
+                }
+		else {
+		  quota64_t user_quota;
+
+		  err = quotactl(dev + 6, QCMD(Q_J2GETQUOTA, ((kind != 0) ? GRPQUOTA : USRQUOTA)),
+                                 uid, CADR &user_quota);
+		  dqblk.dqb_curblocks  = user_quota.bused;
+		  dqblk.dqb_bsoftlimit = user_quota.bsoft;
+		  dqblk.dqb_bhardlimit = user_quota.bhard;
+		  dqblk.dqb_ihardlimit = user_quota.ihard;
+		  dqblk.dqb_isoftlimit = user_quota.isoft;
+		  dqblk.dqb_curinodes = user_quota.iused;
+		  dqblk.dqb_btime = user_quota.btime;
+		  dqblk.dqb_itime = user_quota.itime;
+		}
+              }
+#endif /* HAVE_JFS2 */
+              else if (stat(dev, &st)) {
+                err = 1;
+              }
+              else
+#endif /* AIX */
+	      err = quotactl(dev, QCMD(Q_GETQUOTA, ((kind != 0) ? GRPQUOTA : USRQUOTA)), uid, CADR &dqblk);
 #else /* not Q_CTL_V2 */
 	      err = quotactl(Q_GETQUOTA, dev, uid, CADR &dqblk);
 #endif /* not Q_CTL_V2 */
@@ -401,7 +424,7 @@
         }
 
 int
-setqlim(dev,uid,bs,bh,fs,fh,timelimflag=0,isgrp=0)
+setqlim(dev,uid,bs,bh,fs,fh,timelimflag=0,kind=0)
 	char *	dev
 	int	uid
 	int	bs
@@ -409,7 +432,7 @@
 	int	fs
 	int	fh
 	int	timelimflag
-	int     isgrp
+	int     kind
 	CODE:
 	{
 	  struct dqblk dqblk;
@@ -437,7 +460,7 @@
 #ifndef linux
 	    RETVAL = quotactl(Q_XSETQLIM, dev+5, uid, CADR &xfs_dqblk);
 #else
-	    RETVAL = quotactl(QCMD(Q_XSETQLIM, (isgrp ? GRPQUOTA : USRQUOTA)), dev+5, uid, CADR &xfs_dqblk);
+	    RETVAL = quotactl(QCMD(Q_XSETQLIM, ((kind == 2) ? XQM_PRJQUOTA : ((kind == 1) ? XQM_GRPQUOTA : XQM_USRQUOTA))), dev+5, uid, CADR &xfs_dqblk);
 #endif
 	  }
 	  else
@@ -468,6 +491,25 @@
 	  }
 	  else
 #endif
+#if defined(HAVE_JFS2)
+          if(strncmp(dev, "(JFS2)", 6) == 0) {
+            quota64_t user_quota;
+
+            RETVAL = quotactl(dev + 6, QCMD(Q_J2GETQUOTA, ((kind != 0) ? GRPQUOTA : USRQUOTA)),
+                              uid, CADR &user_quota);
+            if (RETVAL == 0) {
+              user_quota.bsoft = bs;
+              user_quota.bhard = bh;
+              user_quota.btime = timelimflag;
+              user_quota.isoft = fs;
+              user_quota.ihard = fh;
+              user_quota.itime = timelimflag;
+              RETVAL = quotactl(dev + 6, QCMD(Q_J2PUTQUOTA, ((kind != 0) ? GRPQUOTA : USRQUOTA)),
+                                uid, CADR &user_quota);
+            }
+          }
+          else
+#endif /* HAVE_JFS2 */
 	  {
 	    dqblk.QS_BSOFT = Q_MUL(bs);
 	    dqblk.QS_BHARD = Q_MUL(bh);
@@ -484,10 +526,10 @@
 	      RETVAL = -1;
 #else
 #ifdef Q_CTL_V3  /* Linux */
-	    RETVAL = linuxquota_setqlim (dev, uid, isgrp, &dqblk);
+	    RETVAL = linuxquota_setqlim (dev, uid, (kind != 0), &dqblk);
 #else
 #ifdef Q_CTL_V2
-	    RETVAL = quotactl (dev, QCMD(Q_SETQUOTA,(isgrp ? GRPQUOTA : USRQUOTA)), uid, CADR &dqblk);
+	    RETVAL = quotactl (dev, QCMD(Q_SETQUOTA,((kind != 0) ? GRPQUOTA : USRQUOTA)), uid, CADR &dqblk);
 #else
 	    RETVAL = quotactl (Q_SETQLIM, dev, uid, CADR &dqblk);
 #endif
@@ -573,6 +615,9 @@
 #endif
 	  if(dev == NULL) dev = "/";
 #ifdef AIX
+#if defined(HAVE_JFS2)
+          if (strncmp(dev, "(JFS2)", 6) == 0) dev += 6;
+#endif
 	  if (stat(dev, &st)) RETVAL = -1;
 	  else
 #endif
@@ -712,11 +757,11 @@
 	  int count, space;
 
           if(mtab != NULL) free(mtab);
-	  count = mntctl(MCTL_QUERY, sizeof(space), (struct vmount *) &space);
+	  count = mntctl(MCTL_QUERY, sizeof(space), (char *) &space);
 	  if (count == 0) {
 	    mtab = (struct vmount *) malloc(space);
 	    if (mtab != NULL) {
-	      count = mntctl(MCTL_QUERY, space, mtab);
+	      count = mntctl(MCTL_QUERY, space, (char *) mtab);
 	      if (count > 0) {
 	        aix_mtab_count = count;
 	        aix_mtab_idx   = 0;
@@ -839,10 +884,17 @@
 	    PUSHs(sv_2mortal(newSVpv(cp, strlen(cp))));
 
 	    switch(vmp->vmt_gfstype) {
-	      case MNT_AIX:   cp = "aix"; break;
 	      case MNT_NFS:   cp = "nfs"; break;
 	      case MNT_NFS3:  cp = "nfs"; break;
 	      case MNT_JFS:   cp = "jfs"; break;
+#if defined(MNT_AIX) && defined(MNT_J2) && (MNT_AIX==MNT_J2)
+	      case MNT_J2:    cp = "jfs2"; break;
+#else
+#if defined(MNT_J2)
+	      case MNT_J2:    cp = "jfs2"; break;
+#endif
+	      case MNT_AIX:   cp = "aix"; break;
+#endif
 	      case 4:         cp = "afs"; break;
 	      case MNT_CDROM: cp = "cdrom,ignore"; break;
 	      default:        cp = "unknown,ignore"; break;
@@ -883,17 +935,21 @@
 #if defined(USE_IOCTL) || defined(QCARG_MNTPT)
 	strcpy(ret, "mntpt");
 #else
+#if defined(HAVE_JFS2)
+	strcpy(ret, "any,JFS2");
+#else
 #if defined(AIX) || defined(OSF_QUOTA)
 	strcpy(ret, "any");
 #else
 #ifdef Q_CTL_V2
 	strcpy(ret, "qfile");
 #else
+/* this branch applies to Q_CTL_V3 (Linux) too */
 #ifdef SGI_XFS
 	strcpy(ret, "dev,XFS");
 #else
-/* this branch applies to Q_CTL_V3 (Linux) too */
 	strcpy(ret, "dev");
+#endif
 #endif
 #endif
 #endif
@@ -907,3 +963,4 @@
         RETVAL = ret;
 	OUTPUT:
 	RETVAL
+

Modified: branches/upstream/libquota-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/README?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/README (original)
+++ branches/upstream/libquota-perl/current/README Tue Oct  9 03:05:22 2007
@@ -3,8 +3,8 @@
 
 Author:    Tom Zoerner (email: tomzo AT nefkom DOT net)
 
-Version:   1.5.1
-Date:      July 2005
+Version:   1.5.2
+Date:      October 2007
 DSLI-code: Rdcf
            - stable release
            - support by developer
@@ -22,7 +22,7 @@
 	   VxFS (Veritas File System) on Solaris 2.
 Location:  http://www.perl.com/CPAN/authors/Tom_Zoerner/
 Author:    TOMZO  (Tom Zoerner)
-License:   Same as Perl: Artistic License or GPL;
+License:   Same as Perl: Artistic License or GPL version 2 or later;
            See also http://www.opensource.org/licenses/
 
 Documentation is in pod format at the end of Quota.pm,
@@ -273,6 +273,13 @@
      have contributed to this process; for a complete
      list of names please see the CHANGES document.
 
+     The quota module was in the public domain 1995-2001. Since 2001
+     it is licensed under both the Perl Artistic License and version 2
+     or later of the GNU General Public License as published by the
+     Free Software Foundation.  For a copy of these licenses see
+     <http://www.opensource.org/licenses/>.  The respective authors
+     of the source code are it's owner in regard to copyright.
+
 SEE ALSO
      perl(1), edquota(1m), quotactl(2) or quotactl(7I),
      mount(1m), mtab(4) or mnttab(4), quotaon(1m), setmntent(3),

Modified: branches/upstream/libquota-perl/current/afsquota.c
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/afsquota.c?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/afsquota.c (original)
+++ branches/upstream/libquota-perl/current/afsquota.c Tue Oct  9 03:05:22 2007
@@ -1,5 +1,7 @@
 /*
  *  Interface to OpenAFS
+ *
+ *  Copyright 1998,2003 Wolfgang Friebel <friebel at ifh.de>
  */
 
 #if defined( __hpux)

Added: branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.pm?rev=8109&op=file
==============================================================================
--- branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.pm (added)
+++ branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.pm Tue Oct  9 03:05:22 2007
@@ -1,0 +1,50 @@
+#
+# Documentation for JFS2 quota classes interfaces
+#
+# See also http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.aix.basetechref/doc/basetrf2/quotactl.htm
+# (Or search google for "Q_J2GETQUOTA")
+#
+
+__END__
+
+=head1 JFS2 Quota Class Interface
+
+The following commands are usable on AIX JFS2 file systems only:
+
+=over 4
+
+=item I<($bs,$bh,$bt, $is,$ih,$it) = Quota::jfs2_getlimit($dev, $class)>
+
+Returns quota limits for the given class.
+
+=item I<Quota::jfs2_putlimit($dev, $class, $bs,$bh,$bt, $is,$ih,$it)>
+
+Sets quota limits for the given class.
+Time limits are 32-bit epoch values.
+
+=item I<Quota::jfs2_newlimit($dev, $bs,$bh,$bt, $is,$ih,$it)>
+
+Creates a new limit class with the given quota limits.
+Returns the class ID, or undef upon error.
+
+=item I<Quota::jfs2_rmvlimit($dev, $class)>
+
+Deletes the given class.
+
+=item I<Quota::jfs2_deflimit($dev, $class)>
+
+Sets the given class as default class.
+
+=item I<Quota::jfs2_uselimit($dev, $class [,$uid [,isgrp]])>
+
+Sets quota for the given user or group to the one specified by
+the given class.
+
+=item I<Quota::jfs2_getnextq($dev, $class)>
+
+Used to iterate all class IDs. Returns the next class ID larger
+then the given class ID.  Return undef upon error or at the end
+of the list
+
+=back
+

Added: branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.xs?rev=8109&op=file
==============================================================================
--- branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.xs (added)
+++ branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/jfs2class.xs Tue Oct  9 03:05:22 2007
@@ -1,0 +1,185 @@
+/*
+ * Perl interface to quota classes on JFS2 (AIX 5.3)
+ *
+ * This code is untested by me and reportedly not functional yet.
+ * It's just provided as possible basis for further development.
+ *
+ * Copyright (C) 2007 Tom Zoerner.
+ */
+
+MODULE = Quota  PACKAGE = Quota::JFS2CLASS
+
+void
+jfs2_getlimit(dev,class)
+	char *	dev
+	int	class
+	PPCODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          j2qlimit_t j2q;
+          int retval;
+
+          memset(&j2q, 0, sizeof(j2q));
+          retval = quotactl (dev + 6, Q_J2GETLIMIT, class, (caddr_t)&j2q);
+          if (retval == 0) {
+            EXTEND(sp, 8);
+            PUSHs(sv_2mortal(newSViv(j2q.ql_bsoft)));
+            PUSHs(sv_2mortal(newSViv(j2q.ql_bhard)));
+            PUSHs(sv_2mortal(newSViv(j2q.ql_btime)));
+
+            PUSHs(sv_2mortal(newSViv(j2q.ql_isoft)));
+            PUSHs(sv_2mortal(newSViv(j2q.ql_ihard)));
+            PUSHs(sv_2mortal(newSViv(j2q.ql_itime)));
+          }
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          errno = ENOENT;
+        }
+
+int
+jfs2_putlimit(dev,class,bs,bh,bt,fs,fh,ft)
+	char *	dev
+	int	class
+	int	bs
+	int	bh
+	int	bt
+	int	fs
+	int	fh
+	int	ft
+	CODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          j2qlimit_t j2q;
+          memset(&j2q, 0, sizeof(j2q));
+          j2q.ql_bsoft = bs;
+          j2q.ql_bhard = bh;
+          j2q.ql_btime = bt;
+
+          j2q.ql_isoft = fs;
+          j2q.ql_ihard = fh;
+          j2q.ql_itime = ft;
+          RETVAL = quotactl (dev + 6, Q_J2PUTLIMIT, class, (caddr_t)&j2q);
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          RETVAL = -1;
+          errno = ENOENT;
+        }
+        OUTPUT:
+        RETVAL
+
+void
+jfs2_newlimit(dev,bs,bh,bt,fs,fh,ft)
+	char *	dev
+	int	bs
+	int	bh
+	int	bt
+	int	fs
+	int	fh
+	int	ft
+	PPCODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          j2qlimit_t j2q;
+          uid_t class;
+          int retval;
+
+          memset(&j2q, 0, sizeof(j2q));
+          j2q.ql_bsoft = bs;
+          j2q.ql_bhard = bh;
+          j2q.ql_btime = bt;
+
+          j2q.ql_isoft = fs;
+          j2q.ql_ihard = fh;
+          j2q.ql_itime = ft;
+
+          retval = quotactl (dev + 6, Q_J2NEWLIMIT, 0, (caddr_t)&j2q);
+          if (retval == 0) {
+            EXTEND(sp, 1);
+            class = *( (uid_t*) &j2q );
+            PUSHs(sv_2mortal(newSViv(class)));
+          }
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          errno = ENOENT;
+        }
+
+int
+jfs2_rmvlimit(dev,class)
+	char *	dev
+	int	class
+	CODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          RETVAL = quotactl (dev + 6, Q_J2RMVLIMIT, class, NULL);
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          RETVAL = -1;
+          errno = ENOENT;
+        }
+        OUTPUT:
+        RETVAL
+
+int
+jfs2_deflimit(dev,class)
+	char *	dev
+	int	class
+	CODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          RETVAL = quotactl (dev + 6, Q_J2DEFLIMIT, class, NULL);
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          RETVAL = -1;
+          errno = ENOENT;
+        }
+        OUTPUT:
+        RETVAL
+
+int
+jfs2_uselimit(dev,class,uid=getuid(),kind=0)
+	char *	dev
+	int	class
+        int     uid
+        int     kind
+	CODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          uid_t id_buf = uid;
+          RETVAL = quotactl (dev + 6, QCMD(Q_J2USELIMIT, ((kind != 0) ? GRPQUOTA : USRQUOTA)), class, (caddr_t)&id_buf);
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          RETVAL = -1;
+          errno = ENOENT;
+        }
+        OUTPUT:
+        RETVAL
+
+void
+jfs2_getnextq(dev,class)
+	char *	dev
+	int	class
+	PPCODE:
+#if defined(HAVE_JFS2)
+        if (strncmp(dev, "(JFS2)", 6) == 0) {
+          uid_t id_buf = 0;
+          int retval;
+
+          //retval = quotactl (dev + 6, QCMD(Q_J2GETNEXTQ,USRQUOTA), class, (caddr_t) &id_buf);
+          retval = quotactl (dev + 6, Q_J2GETNEXTQ, class, (caddr_t) &id_buf);
+          printf("Q_J2GETNEXTQ(%s,%d)=%d ID=%d\n",dev+6,class,retval,id_buf);
+          if (retval == 0) {
+            EXTEND(sp, 1);
+            PUSHs(sv_2mortal(newSViv(id_buf)));
+          }
+        } else
+#endif /* HAVE_JFS2 */
+        {
+          errno = ENOENT;
+        }
+

Added: branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl?rev=8109&op=file
==============================================================================
--- branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl (added)
+++ branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl Tue Oct  9 03:05:22 2007
@@ -1,0 +1,128 @@
+#!/usr/bin/perl
+
+use blib;
+use Quota;
+
+if (! -t) {
+   print STDERR "\nThis is an interactive test script - input must be a tty\nExiting now.\n";
+   exit;
+}
+
+{
+  print "\nEnter path to get quota for (JFS2 only; default '.'):\n> ";
+  chomp($path = <STDIN>);
+  $path = "." unless $path =~ /\S/;
+
+  $dev = Quota::getqcarg($path);
+  $dev || warn "$path: mount point not found\n";
+  if ($dev =~ m#JFS2#) {
+    print "Using device/argument \"$dev\"\n";
+  } else {
+    warn "$path: is not a JFS2 file system\n";
+    print "Continuing anyway...\n\n";
+  }
+}
+
+#
+# Enumerate
+#
+$class = -1;
+ at class_list = ();
+while(1) {
+  $class = Quota::jfs2_getnextq($dev, $class);
+  last if !defined $class;
+  push @class_list, $class;
+}
+print "Class enumeration returned ". ($#class_list+1) ." classes\n";
+
+
+#
+# Query all existing classes
+#
+sub print_limit {
+  my($dev,$class) = @_;
+
+  ($bs,$bh,$bt,$fs,$fh,$ft) = Quota::jfs2_getlimit($dev, $class);
+  if (defined($bs)) {
+    my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($bt);
+    $bt = sprintf("%04d-%02d-%02d/%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min) if $bt;
+    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($ft);
+    $ft = sprintf("%04d-%02d-%02d/%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min) if $ft;
+
+    print "Limits for class $class: $bs,$bh,$bt blocks - $fs,$fh,$ft files\n\n";
+
+  } else {
+    warn "Quota::jfs2_getlimit($dev,$class): ",Quota::strerr,"\n\n";
+    last;
+  }
+}
+print "\n";
+
+for $class (@class_list) {
+  print_limit($dev, $class);
+}
+
+
+#
+# Create a new class and work with it
+#
+
+print "Specify block and file limits for a new class bs,bh,fs,fh (empty to skip):\n> ";
+chomp($in = <STDIN>);
+if($in =~ /\S/) {
+  ($bs,$bh,$fs,$fh) = (split(/\s*,\s*/, $in));
+  $class = Quota::jfs2_newlimit($dev, $bs,$bh,0,$fs,$fh,0);
+  if (defined $class)  {
+    print "Successfully created class $class\n";
+
+    print "Reading back new limits:\n";
+    print_limit($dev, $class);
+
+  } else {
+    warn "Creation failed: ". Quota::strerr ."\n";
+  }
+
+  if (defined $class)
+  {
+    print "\nModify block and file limits for class $class: bs,bh,fs,fh (empty to skip):\n> ";
+    chomp($in = <STDIN>);
+    if($in =~ /\S/) {
+      ($bs,$bh,$fs,$fh) = (split(/\s*,\s*/, $in));
+      if (Quota::jfs2_putlimit($dev, $class, $bs,$bh,0,$fs,$fh,0) == 0) {
+        print "Successfully modified limits for class $class\n";
+
+        print "Reading back new limits:\n";
+        print_limit($dev, $class);
+      } else {
+        warn "Modification failed: ". Quota::strerr ."\n";
+      }
+    }
+
+    {
+      print "\nEnter a user ID to assign this class to: (empty to skip)\n";
+      chomp($uid = <STDIN>);
+      unless($uid =~ /^(\d+)?$/) {
+        print "You have to enter a numerical class id.\n";
+        redo;
+      }
+    }
+    if ($uid =~ /^\d+$/) {
+      if (Quota::jfs2_uselimit($dev, $class, $uid) == 0) {
+        print "Successfully assigned class $class to user $uid\n";
+      } else {
+        warn "Assignment failed: ". Quota::strerr ."\n";
+      }
+    }
+
+    print "\nDelete the new class? y/n > ";
+    chomp($in = <STDIN>);
+    if ($in =~ /y/) {
+      if (Quota::jfs2_rmvlimit($dev, $class) != 0) {
+        warn "Removal failed: ". Quota::strerr ."\n";
+      }
+    } else {
+      print "not confirmed\n";
+    }
+  }
+}
+

Propchange: branches/upstream/libquota-perl/current/contrib/aix_jfs2_class/test_jfs2.pl
------------------------------------------------------------------------------
    svn:executable = *

Modified: branches/upstream/libquota-perl/current/contrib/mount-list-qcarg.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/contrib/mount-list-qcarg.pl?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/contrib/mount-list-qcarg.pl (original)
+++ branches/upstream/libquota-perl/current/contrib/mount-list-qcarg.pl Tue Oct  9 03:05:22 2007
@@ -13,6 +13,8 @@
 }
 Quota::endmntent();
 
+print Quota::getqcargtype() ."\n\n";
+
 foreach (@Mtab)
 {
    $path = (split(/#/))[2];

Modified: branches/upstream/libquota-perl/current/hints/aix_4_1.h
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/hints/aix_4_1.h?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/hints/aix_4_1.h (original)
+++ branches/upstream/libquota-perl/current/hints/aix_4_1.h Tue Oct  9 03:05:22 2007
@@ -20,11 +20,17 @@
 #include "include/rquota.h"
 
 #include <jfs/quota.h>
+#include <sys/statfs.h>
 #include <sys/mntctl.h>
 #include <sys/vmount.h>
 
 #define AIX
 #define Q_CTL_V2
+
+#if defined(_AIXVERSION_530)
+#include "j2/j2_quota.h"
+#define HAVE_JFS2
+#endif
 
 #define Q_DIV(X) (X)
 #define Q_MUL(X) (X)

Modified: branches/upstream/libquota-perl/current/include/quotaio_xfs.h
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/include/quotaio_xfs.h?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/include/quotaio_xfs.h (original)
+++ branches/upstream/libquota-perl/current/include/quotaio_xfs.h Tue Oct  9 03:05:22 2007
@@ -36,6 +36,11 @@
 
 #define XQM_CMD(cmd)    ( ('X'<<8)+(cmd) )
 #define IS_XQM_CMD(cmd) ( ((int)(cmd)>>8) == 'X' )
+
+#define XQM_USRQUOTA    0       /* system call user quota type */
+#define XQM_GRPQUOTA    1       /* system call group quota type */
+#define XQM_PRJQUOTA    2       /* system call project quota type */
+#define XQM_MAXQUOTAS   3
 
 /*
  * Disk quota - quotactl(2) commands for XFS Quota Manager (XQM).

Modified: branches/upstream/libquota-perl/current/test.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libquota-perl/current/test.pl?rev=8109&op=diff
==============================================================================
--- branches/upstream/libquota-perl/current/test.pl (original)
+++ branches/upstream/libquota-perl/current/test.pl Tue Oct  9 03:05:22 2007
@@ -1,4 +1,16 @@
 #!../../../perl
+# ------------------------------------------------------------------------ #
+# Interactive test and demo script for the Perl Quota extension module
+#
+# Author: Tom Zoerner 1995-2005
+#
+# This program (test.pl) is in the public domain and can be used and
+# redistributed without restrictions.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# ------------------------------------------------------------------------ #
 
 use blib;
 use Quota;




More information about the Pkg-perl-cvs-commits mailing list