gpfs_quotactl() subroutine

Manipulates disk quotas on file systems.

Library

GPFS™ Library (libgpfs.a for AIX®, libgpfs.so for Linux)

Synopsis

#include <gpfs.h>
int gpfs_quotactl(Start of changeconst End of changechar *pathname,
                  int cmd,
                  int id,
                  void *bufferP);

Description

The gpfs_quotactl() subroutine manipulates disk quotas. It enables, disables, and manipulates disk quotas for file systems on which quotas have been enabled.

Note: Compile any program that uses this subroutine with the -lgpfs flag from the following library:
  • libgpfs.a for AIX
  • libgpfs.so for Linux

Parameters

pathname
Specifies the path name of any file within the mounted file system to which the quota control command is to applied.
cmd
Specifies the quota control command to be applied and whether it is applied to a user, group, or fileset quota.
The cmd parameter can be constructed using GPFS_QCMD(qcmd, Type) contained in gpfs.h. The qcmd parameter specifies the quota control command. The Type parameter specifies one of the following quota types:
  • user (GPFS_USRQUOTA)
  • group (GPFS_GRPQUOTA)
  • fileset (GPFS_FILESETQUOTA)
The valid values for the qcmd parameter specified in gpfs.h are:
Q_QUOTAON
Enables quotas.

Enables disk quotas for the file system specified by the pathname parameter and type specified in Type. The id and bufferP parameters are unused. Root user authority is required to enable quotas.

Q_QUOTAOFF
Disables quotas.

Disables disk quotas for the file system specified by the pathname parameter and type specified in Type. The id and bufferP parameters are unused. Root user authority is required to disable quotas.

Q_GETQUOTA
Gets quota limits and usage information.

Retrieves quota limits and current usage for a user, group, or fileset specified by the id parameter. The bufferP parameter points to a gpfs_quotaInfo_t structure to hold the returned information. The gpfs_quotaInfo_t structure is defined in gpfs.h.

Root authority is required if the id value is not the current id (user id for GPFS_USRQUOTA, group id for GPFS_GRPQUOTA) of the caller.

Q_SETQUOTA
Sets quota limits

Sets disk quota limits for a user, group, or fileset specified by the id parameter. The bufferP parameter points to a gpfs_quotaInfo_t structure containing the new quota limits. The gpfs_quotaInfo_t structure is defined in gpfs.h. Root user authority is required to set quota limits.

Q_SETUSE
Sets quota usage

Sets disk quota usage for a user, group, or fileset specified by the id parameter. The bufferP parameter points to a gpfs_quotaInfo_t structure containing the new quota usage. The gpfs_quotaInfo_t structure is defined in gpfs.h. Root user authority is required to set quota usage.

Q_SYNC
Synchronizes the disk copy of a file system quota

Updates the on disk copy of quota usage information for a file system. The id and bufferP parameters are unused. Root user authority is required to synchronize a file system quota.

id
Specifies the user, group, or fileset ID to which the quota control command applies. The id parameters is interpreted by the specified quota type.
bufferP
Points to the address of an optional, command-specific data structure that is copied in or out of the system.

Exit status

If the gpfs_quotactl() subroutine is successful, it returns a value of 0.

If the gpfs_quotactl() subroutine is unsuccessful, it returns a value of -1 and sets the global error variable errno to indicate the nature of the error.

Exceptions

None.

Error status

Error codes include but are not limited to the following:

EACCES
Search permission is denied for a component of a path prefix.
EFAULT
An invalid bufferP parameter is supplied. The associated structure could not be copied in or out of the kernel.
EINVAL
One of the following errors:
  • The file system is not mounted.
  • Invalid command or quota type.
  • Invalid input limits: negative limits or soft limits are greater than hard limits.
ENOENT
No such file or directory.
EPERM
The quota control command is privileged and the caller did not have root user authority.
GPFS_E_NO_QUOTA_INST
The file system does not support quotas. This is the actual errno generated by GPFS.

Location

/usr/lpp/mmfs/lib/libgpfs.a for AIX

/usr/lpp/mmfs/lib/libgpfs.so for Linux