Hi,
Looks good to me. I wonder how many coverity flagged up issues will
remain after this? Maybe a good time to review them...
Also, we might be now able to drop some library functions which were
only in use by the removed tools,
Steve.
On Fri, 2012-06-29 at 14:39 +0100, Andrew Price wrote:
> From: Andrew Price <andy@rhlaptop.andrewprice.me.uk>
>
> gfs2_tool and gfs2_quota have been destined for removal for some time
> and now that Fedora 15 has EOL'd the time has come to do so.
>
> Users of gfs2_quota should now use the generic quota utilities
> Users of gfs2_tool should now use tunegfs2, mount options and the
> generic dmsetup and chattr/lsattr tools.
>
> This also removes the mount.gfs2 manpage as mount.gfs2 was removed some
> time ago. Mount options can be found in the gfs2(5) manpage.
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> configure.ac | 2 -
> gfs2/Makefile.am | 2 +-
> gfs2/man/Makefile.am | 3 -
> gfs2/man/gfs2_quota.8 | 105 ------
> gfs2/man/gfs2_tool.8 | 117 ------
> gfs2/man/mount.gfs2.8 | 233 ------------
> gfs2/quota/Makefile.am | 14 -
> gfs2/quota/check.c | 601 -------------------------------
> gfs2/quota/gfs2_quota.h | 95 -----
> gfs2/quota/main.c | 911 -----------------------------------------------
> gfs2/quota/names.c | 83 -----
> gfs2/quota/target.mk | 3 -
> gfs2/tool/Makefile.am | 13 -
> gfs2/tool/gfs2_tool.h | 64 ----
> gfs2/tool/iflags.h | 40 ---
> gfs2/tool/main.c | 198 ----------
> gfs2/tool/misc.c | 343 ------------------
> gfs2/tool/ondisk.c | 13 -
> gfs2/tool/sb.c | 229 ------------
> gfs2/tool/target.mk | 3 -
> gfs2/tool/tune.c | 146 --------
> 21 files changed, 1 insertion(+), 3217 deletions(-)
> delete mode 100644 gfs2/man/gfs2_quota.8
> delete mode 100644 gfs2/man/gfs2_tool.8
> delete mode 100644 gfs2/man/mount.gfs2.8
> delete mode 100644 gfs2/quota/Makefile.am
> delete mode 100644 gfs2/quota/check.c
> delete mode 100644 gfs2/quota/gfs2_quota.h
> delete mode 100644 gfs2/quota/main.c
> delete mode 100644 gfs2/quota/names.c
> delete mode 100644 gfs2/quota/target.mk
> delete mode 100644 gfs2/tool/Makefile.am
> delete mode 100644 gfs2/tool/gfs2_tool.h
> delete mode 100644 gfs2/tool/iflags.h
> delete mode 100644 gfs2/tool/main.c
> delete mode 100644 gfs2/tool/misc.c
> delete mode 100644 gfs2/tool/ondisk.c
> delete mode 100644 gfs2/tool/sb.c
> delete mode 100644 gfs2/tool/target.mk
> delete mode 100644 gfs2/tool/tune.c
>
> diff --git a/configure.ac b/configure.ac
> index e58aac9..570f826 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -280,8 +280,6 @@ AC_CONFIG_FILES([Makefile
> gfs2/edit/Makefile
> gfs2/fsck/Makefile
> gfs2/mkfs/Makefile
> - gfs2/quota/Makefile
> - gfs2/tool/Makefile
> gfs2/tune/Makefile
> gfs2/man/Makefile
> gfs2/lockgather/Makefile
> diff --git a/gfs2/Makefile.am b/gfs2/Makefile.am
> index 1011739..710ba8b 100644
> --- a/gfs2/Makefile.am
> +++ b/gfs2/Makefile.am
> @@ -1,4 +1,4 @@
> MAINTAINERCLEANFILES = Makefile.in
>
> -SUBDIRS = libgfs2 convert edit fsck mkfs quota tool man
> +SUBDIRS = libgfs2 convert edit fsck mkfs man
> tune include lockgather #init.d
> diff --git a/gfs2/man/Makefile.am b/gfs2/man/Makefile.am
> index 648ed84..caf4658 100644
> --- a/gfs2/man/Makefile.am
> +++ b/gfs2/man/Makefile.am
> @@ -6,9 +6,6 @@ dist_man_MANS = fsck.gfs2.8
> gfs2_edit.8
> gfs2_grow.8
> gfs2_jadd.8
> - gfs2_quota.8
> - gfs2_tool.8
> mkfs.gfs2.8
> gfs2_lockgather.8
> - mount.gfs2.8
> tunegfs2.8
> diff --git a/gfs2/man/gfs2_quota.8 b/gfs2/man/gfs2_quota.8
> deleted file mode 100644
> index 04e09e8..0000000
> --- a/gfs2/man/gfs2_quota.8
> +++ /dev/null
> @@ -1,105 +0,0 @@
> -.TH gfs2_quota 8
> -
> -.SH NAME
> -gfs2_quota - Manipulate GFS2 disk quotas
> -
> -.SH SYNOPSIS
> -.B gfs2_quota
> -<list|sync|get|limit|warn|check|init|reset> [fIOPTIONfR]...
> -
> -.SH DESCRIPTION
> -gfs2_quota is used to examine and change quota values in a GFS2 filesystem.
> -This command has a number of different actions.
> -
> -GFS2 introduced a new linked list format for the quotas in the quota file.
> -This list format allows for faster fBlistfP, fBcheckfP and fBinitfP
> -operations. Older GFS2 quota files may be migrated to this newer format using
> -the fBgfs2_quota resetfP command.
> -
> -.SH ACTIONS
> -.TP
> -fBlistfP
> -List the contents of the quota file. Only IDs that have a non-zero hard limit,
> -warn limit, or value are printed.
> -.TP
> -fBsyncfP
> -Sync any local quota changes to the quota file.
> -.TP
> -fBgetfP
> -Get the current data for the ID specified by the -u or -g argument.
> -.TP
> -fBlimitfP
> -Set the current hard limit for the ID specified by the -u or -g argument to
> -the value specified by the -l argument on the specified filesystem.
> -The filesystem won't let the user or group use more than this much space.
> -A value of zero here means that no limit is enforced.
> -.TP
> -fBwarnfP
> -Set the current warn limit for the ID specified by the -u or -g argument to
> -the value specified by the -l argument on the specified filesystem.
> -The filesystem will start complaining to the user or group when more
> -than this much space is used. A value of zero here means that the
> -user won't ever be warned.
> -.TP
> -fBcheckfP
> -Scan a filesystem and make sure that what's out there on the disk matches
> -what's in the quota file. This is only accurate if the filesystem is
> -idle when this is running. If there is a mismatch, it is printed to
> -stdout. Note: GFS2 quotas are transactional and a quota check is fBnotfP
> -needed every time there is a system crash.
> -.TP
> -fBinitfP
> -Scan a filesystem and initialize the quota file with the values obtained
> -from the scan. The filesystem should be idle when this is run. You should
> -only need to do this if you upgrade a pre-quota GFS2 filesystem (pre-GFS2 5.1).
> -.TP
> -fBresetfP
> -The fBresetfP operation will truncate the quota file and all quota
> -information (values, limits, warnings) will be lost. All quota limits and
> -warnings will have to be reassigned after this operation.
> -
> -.SH OPTIONS
> -fB-bfP
> -The units for disk space are filesystem blocks.
> -.TP
> -fB-ffP fIDirectoryfR
> -Specifies which filesystem to perform the action on.
> -.TP
> -fB-gfP fIGIDfR
> -Specifies the group ID for get, limit, or warn. It can be either
> -the group name from the group file, or the GID number.
> -.TP
> -fB-hfP
> -Print out a help message describing available
> -options, then exit.
> -.TP
> -fB-kfP
> -The units for disk space are kilobytes.
> -.TP
> -fB-lfP fISizefR
> -Specifies the new value for the limit or warn actions.
> -The value is assumed to be in the units specified by the
> --m, -k, -s, -b arguments. The default is megabytes.
> -.TP
> -fB-mfP
> -The units for disk space are megabytes. This is the default.
> -.TP
> -fB-nfP
> -Don't try to resolve UIDs and GIDs into user and group names.
> -.TP
> -fB-sfP
> -The units for disk space are sectors (512-byte blocks).
> -.TP
> -fB-ufP fIUIDfR
> -Specifies the user ID for get, limit, or warn. It can be either
> -the username from the password file, or the UID number.
> -.TP
> -fB-VfP
> -Print program version information, then exit.
> -
> -.SH EXAMPLE
> -To set the hard limit for user "nobody" to
> -1048576 kilobytes on filesystem /gfs20
> -
> -gfs2_quota limit -l 1048576 -k -u nobody -f /gfs20
> -
> diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8
> deleted file mode 100644
> index dccd631..0000000
> --- a/gfs2/man/gfs2_tool.8
> +++ /dev/null
> @@ -1,117 +0,0 @@
> -.TH gfs2_tool 8
> -
> -.SH NAME
> -gfs2_tool - interface to gfs2 ioctl/sysfs calls
> -
> -.SH SYNOPSIS
> -.B gfs2_tool
> -fICOMMANDfR [fIOPTIONfR]...
> -
> -.SH DESCRIPTION
> -gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls. Some
> -of the functions of gfs_tool have been replaced by standard system tools
> -such as mount and chattr, so gfs2_tool doesn't have as many options
> -as gfs_tool used to.
> -
> -.SH COMMANDS
> -.TP
> -fBclearflagfP fIFlagfR fIFile1fR fIFile2fR fI...fR
> -Clear an attribute flag on a file. This is now obsolete and kept
> -only for backward compatibility, chattr is the preferred way to
> -clear attribute flags. See fBsetflagfP for available flags. This
> -option will probably be removed at a future date.
> -.TP
> -fBfreezefP fIMountPointfR
> -Freeze (quiesce) a GFS2 cluster.
> -.TP
> -fBgettunefP fIMountPointfR
> -Print out the current values of the tuning parameters in a running
> -filesystem. A better source of similar (more comprehensive) information
> -is that in the /proc/mounts file. Running the mount command with no
> -arguments will also provide the same information. This option is
> -considered obsolete and will probably be removed at some future
> -date.
> -.TP
> -fBjournalsfP fIMountPointfR
> -Print out information about the journals in a mounted filesystem.
> -.TP
> -fBlockdumpfP fIMountPointfR
> -Print out information about the locks this machine holds for a given
> -filesystem. This information is also available via the debugfs
> -glock dump file, and accessing that file is the preferred method
> -of obtaining a dump of the glock state.
> -.".TP
> -."fBrindexfP fIMountPointfR
> -."Print out the resource group index of a mounted filesystem.
> -.TP
> -fBsbfP fIdevicefR fBprotofP fI[newvalue]fR
> -View (and possibly replace) the name of the locking protocol in the
> -file system superblock. The file system shouldn't be mounted by any
> -client when you do this.
> -.TP
> -fBsbfP fIdevicefR fBtablefP fI[newvalue]fR
> -View (and possibly replace) the name of the locking table in the
> -file system superblock. The file system shouldn't be mounted by any
> -client when you do this.
> -.TP
> -fBsbfP fIdevicefR fBondiskfP fI[newvalue]fR
> -View (and possibly replace) the ondisk format number in the
> -file system superblock. The file system shouldn't be mounted by any
> -client when you do this. No one should have to use this.
> -.TP
> -fBsbfP fIdevicefR fBmultihostfP fI[newvalue]fR
> -View (and possibly replace) the multihost format number in the
> -file system superblock. The file system shouldn't be mounted by any
> -client when you do this. No one should have to use this.
> -.TP
> -fBsbfP fIdevicefR fBuuidfP fI[newvalue]fR
> -View (and possibly replace) the uuid in the file system superblock.
> -The file system shouldn't be mounted by any client when you do this.
> -The new uuid value should be in the standard uuid format. For
> -example: 1AEA8269-15C5-72BD-6D83-8720B17AA4EE
> -.TP
> -fBsbfP fIdevicefR fBallfP
> -Print out the superblock.
> -.TP
> -fBsetflagfP fIFlagfR fIFile1fR fIFile2fR fI...fR
> -Set an attribute flag on a file. The currently supported flags are
> -jdata, immutable, appendonly, noatime, and sync. The
> -chattr command is the preferred way to set attributes on
> -files. This option will probably be removed at a future date.
> -
> -The fIjdatafR flag causes all the data written to a file
> -to be journaled. If the fIjdatafR flag is set for a directory,
> -all files and directories subsequently created within that directory
> -are also journaled. This behavior replaces the old fIinherit_jdatafR
> -flag from gfs. Same as chattr +j.
> -
> -The fIimmutablefR flag marks the file immutable. The behavior is
> -similar to the immutable flag in the ext2/3 filesystems. All write
> -access is denied. Same as chattr +i.
> -
> -The fIappendonlyfR flag causes all data to be written at the end of
> -the file. Same as chattr +a.
> -
> -The fInoatimefR flag disables updates to the file's access time.
> -Same as chattr +A.
> -
> -The fIsyncfR flag causes data written to the file to be sync'ed to
> -stable storage immediately. Same as chattr +S.
> -.TP
> -fBsettunefP fIMountPointfR fIparameterfR fInewvaluefR
> -Set the value of tuning parameter. Use fBgettunefP for a listing of
> -tunable parameters. The mount -oremount command is the preferred way
> -to set the values of tunable parameters. At some future stage, when
> -all parameters can be set via mount, this option will be removed.
> -.TP
> -fBunfreezefP fIMountPointfR
> -Unfreeze a GFS2 cluster.
> -.TP
> -fBversionfP
> -Print out the version of GFS2 that this program goes with.
> -.TP
> -fBwithdrawfP fIMountPointfR
> -Cause GFS2 to abnormally shutdown a given filesystem on this node.
> -This feature is only useful for testing and should not be used
> -during normal filesystem operation.
> -
> diff --git a/gfs2/man/mount.gfs2.8 b/gfs2/man/mount.gfs2.8
> deleted file mode 100644
> index 4f0f7b3..0000000
> --- a/gfs2/man/mount.gfs2.8
> +++ /dev/null
> @@ -1,233 +0,0 @@
> -.TH mount.gfs2 8
> -
> -.SH NAME
> -mount.gfs2 - GFS2 mount options
> -
> -.SH SYNOPSIS
> -.BI "mount -a [-fnrsvw] -t " gfs2 " [-O " options "]
> -.br
> -.BI "mount [-fnrsvw] -t " gfs2 " [-o " options " ] " "device dir"
> -
> -.SH DESCRIPTION
> -For details on the common mount options, please see the
> -fBmountfP(8) command man page.
> -The fIdevicefR may be any block device on which you
> -have created a GFS2 filesystem. Examples include a
> -single disk partition (e.g. /dev/sdb3), a loopback device, a device exported
> -from another node (e.g. an iSCSI device), or a
> -logical volume (typically comprised of a number of individual disks).
> -
> -fIdevicefR does not necessarily need to match the device name as seen on
> -another node in the cluster, nor does it need to be a logical volume. However,
> -the use of a cluster-aware volume manager such as CLVM2 (see fBlvmfP(8))
> -will guarantee that the managed devices are named identically on each node in a
> -cluster (for much easier management), and will allow you to configure a very
> -large volume from multiple storage units (e.g. disk drives).
> -
> -fIdevicefR must make the entire filesystem storage area visible to the
> -computer. That is, you cannot mount different parts of a single filesystem on
> -different computers. Each computer must see an entire filesystem. You
> -may, however, mount several GFS2 filesystems if you want to distribute your
> -data storage in a controllable way.
> -
> -This man page describes GFS2-specific options that can be passed to the GFS2
> -file system at mount time, using the fB-ofP flag. There are many other
> -fB-ofP options handled by the generic mount command fBmountfP(8).
> -However, the options described below are specifically for GFS2, and are not
> -interpreted by the mount command nor by the kernel's Virtual File System. GFS2
> -and non-GFS2 options may be intermingled after the fB-ofP, separated by
> -commas (but no spaces).
> -
> -The options commit, discard, errors, quota_quantum, statfs_quantum, statfs_percent, barrier, acl, quota, suiddir, and data can be
> -changed after mount using the "mount -o remount,option /mountpoint" command.
> -The options quota, discard, barrier, acl, and suiddir support the "no"
> -prefix. For example, "noacl" turns off what "acl" turns on.
> -
> -If you have trouble mounting GFS2, check the syslog (e.g. /var/log/messages)
> -for specific error messages.
> -
> -.SH OPTIONS
> -.TP
> -fBlockproto=fPfILockProtoNamefR
> -This specifies which inter-node lock protocol is used by the GFS2 filesystem
> -for this mount, overriding the default lock protocol name stored in the
> -filesystem's on-disk superblock.
> -
> -The fILockProtoNamefR must be one of the supported locking protocols,
> -currently these are fIlock_nolockfR and fIlock_dlmfR.
> -
> -The default lock protocol name is written to disk initially when creating the
> -filesystem with fBmkfs.gfs2fP(8), -p option. It can be changed on-disk by
> -using the fBgfs2_toolfP(8) utility's fBsb protofP command.
> -
> -The fBlockprotofP mount option should be used only under special
> -circumstances in which you want to temporarily use a different lock protocol
> -without changing the on-disk default. Using the incorrect lock protocol
> -on a cluster filesystem mounted from more than one node will almost
> -certainly result in filesystem corruption.
> -.TP
> -fBlocktable=fPfILockTableNamefR
> -This specifies the identity of the cluster and of the filesystem for this
> -mount, overriding the default cluster/filesystem identify stored in the
> -filesystem's on-disk superblock. The cluster/filesystem name is recognized
> -globally throughout the cluster, and establishes a unique namespace for
> -the inter-node locking system, enabling the mounting of multiple GFS2
> -filesystems.
> -
> -The format of fILockTableNamefR is lock-module-specific. For
> -fIlock_dlmfR, the format is fIclustername:fsnamefR. For
> -fIlock_nolockfR, the field is ignored.
> -
> -The default cluster/filesystem name is written to disk initially when creating
> -the filesystem with fBmkfs.gfs2fP(8), -t option. It can be changed on-disk
> -by using the fBgfs2_toolfP(8) utility's fBsb tablefP command.
> -
> -The fBlocktablefP mount option should be used only under special
> -circumstances in which you want to mount the filesystem in a different cluster,
> -or mount it as a different filesystem name, without changing the on-disk
> -default.
> -.TP
> -fBlocalcachingfP
> -This flag tells GFS2 that it is running as a local (not clustered) filesystem,
> -so it can turn on some block caching optimizations that can't be used when
> -running in cluster mode.
> -
> -This is turned on automatically by the lock_nolock module,
> -but can be overridden by using the fBignore_local_fsfP option.
> -.TP
> -fBlocalflocksfP
> -This flag tells GFS2 that it is running as a local (not clustered) filesystem,
> -so it can allow the kernel VFS layer to do all flock and fcntl file locking.
> -When running in cluster mode, these file locks require inter-node locks,
> -and require the support of GFS2. When running locally, better performance
> -is achieved by letting VFS handle the whole job.
> -
> -This is turned on automatically by the lock_nolock module,
> -but can be overridden by using the fBignore_local_fsfP option.
> -.TP
> -fBerrors=fPfI[panic|withdraw]fR
> -Setting errors=panic causes GFS2 to oops when encountering an error that
> -would otherwise cause the
> -mount to withdraw or print an assertion warning. The default setting
> -is errors=withdraw. This option should not be used in a production system.
> -It replaces the earlier fBdebugfP option on kernel versions 2.6.31 and
> -above.
> -.TP
> -fBignore_local_fsfP
> -By default, using the nolock lock module automatically turns on the
> -fBlocalcachingfP and fBlocalflocksfP optimizations. fBignore_local_fsfP
> -forces GFS2 to treat the filesystem as if it were a multihost (clustered)
> -filesystem, with fBlocalcachingfP and fBlocalflocksfP optimizations
> -turned off.
> -.TP
> -fBupgradefP
> -This flag tells GFS2 to upgrade the filesystem's on-disk format to the version
> -supported by the current GFS2 software installation on this computer.
> -If you try to mount an old-version disk image, GFS2 will notify you via a syslog
> -message that you need to upgrade. Try mounting again, using the
> -fB-o upgradefP option. When upgrading, only one node may mount the GFS2
> -filesystem.
> -.TP
> -fBaclfP
> -Enables POSIX Access Control List fBaclfP(5) support within GFS2.
> -.TP
> -fBspectatorfP
> -Mount this filesystem using a special form of read-only mount. The mount
> -does not use one of the filesystem's journals. The node is unable to
> -recover journals for other nodes.
> -.TP
> -fBsuiddirfP
> -Sets owner of any newly created file or directory to be that of parent
> -directory, if parent directory has S_ISUID permission attribute bit set.
> -Sets S_ISUID in any new directory, if its parent directory's S_ISUID is set.
> -Strips all execution bits on a new file, if parent directory owner is different
> -from owner of process creating the file. Set this option only if you know
> -why you are setting it.
> -.TP
> -fBquota=fPfI[off/account/on]fR
> -Turns quotas on or off for a filesystem. Setting the quotas to be in
> -the "account" state causes the per UID/GID usage statistics to be
> -correctly maintained by the filesystem, limit and warn values are
> -ignored. The default value is "off".
> -.TP
> -fBdiscardfP
> -Causes GFS2 to generate "discard" I/O requests for blocks which have
> -been freed. These can be used by suitable hardware to implement
> -thin-provisioning and similar schemes. This feature is supported
> -in kernel version 2.6.30 and above.
> -.TP
> -fBbarrierfP
> -This option, which defaults to on, causes GFS2 to send I/O barriers
> -when flushing the journal. The option is automatically turned off
> -if the underlying device does not support I/O barriers. We highly
> -recommend the use of I/O barriers with GFS2 at all times unless
> -the block device is designed so that it cannot lose its write cache
> -content (e.g. its on a UPS, or it doesn't have a write cache)
> -.TP
> -fBcommit=fPfIsecsfR
> -This is similar to the ext3 fBcommit=fP option in that it sets
> -the maximum number of seconds between journal commits if there is
> -dirty data in the journal. The default is 60 seconds. This option
> -is only provided in kernel versions 2.6.31 and above.
> -.TP
> -fBdata=fPfI[ordered|writeback]fR
> -When data=ordered is set, the user data modified by a transaction is
> -flushed to the disk before the transaction is committed to disk. This
> -should prevent the user from seeing uninitialized blocks in a file
> -after a crash. Data=writeback mode writes the user data to the disk
> -at any time after it's dirtied. This doesn't provide the same
> -consistency guarantee as ordered mode, but it should be slightly
> -faster for some workloads. The default is ordered mode.
> -.TP
> -fBmetafP
> -This option results in selecting the meta filesystem root rather than
> -the normal filesystem root. This option is normally only used by
> -the GFS2 utility functions. Altering any file on the GFS2 meta filesystem
> -may render the filesystem unusable, so only experts in the GFS2
> -on-disk layout should use this option.
> -.TP
> -fBquota_quantum=fPfIsecsfR
> -This sets the number of seconds for which a change in the quota
> -information may sit on one node before being written to the quota
> -file. This is the preferred way to set this parameter. The value
> -is an integer number of seconds greater than zero. The default is
> -60 seconds. Shorter settings result in faster updates of the lazy
> -quota information and less likelihood of someone exceeding their
> -quota. Longer settings make filesystem operations involving quotas
> -faster and more efficient.
> -.TP
> -fBstatfs_quantum=fPfIsecsfR
> -Setting statfs_quantum to 0 is the preferred way to set the slow version
> -of statfs. The default value is 30 secs which sets the maximum time
> -period before statfs changes will be syned to the master statfs file.
> -This can be adjusted to allow for faster, less accurate statfs values
> -or slower more accurate values. When set to 0, statfs will always
> -report the true values.
> -.TP
> -fBstatfs_percent=fPfIvaluefR
> -This setting provides a bound on the maximum percentage change in
> -the statfs information on a local basis before it is synced back
> -to the master statfs file, even if the time period has not
> -expired. If the setting of statfs_quantum is 0, then this setting
> -is ignored.
> -
> -.SH BUGS
> -
> -GFS2 doesn't support fBerrors=fPfIremount-rofR or fBdata=fPfIjournalfR.
> -It is not possible to switch support for user and group quotas on and
> -off independently of each other. Some of the error messages are rather
> -cryptic, if you encounter one of these messages check firstly that gfs_controld
> -is running and secondly that you have enough journals on the filesystem
> -for the number of nodes in use.
> -
> -.SH SEE ALSO
> -
> -fBgfs2fP(5),
> -fBmountfP(8) for general mount options,
> -fBchmodfP(1) and fBchmodfP(2) for access permission flags,
> -fBaclfP(5) for access control lists,
> -fBlvmfP(8) for volume management,
> -fBccsfP(7) for cluster management,
> -fBumountfP(8),
> -fBinitrdfP(4).
> -
> diff --git a/gfs2/quota/Makefile.am b/gfs2/quota/Makefile.am
> deleted file mode 100644
> index 9d75d20..0000000
> --- a/gfs2/quota/Makefile.am
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -MAINTAINERCLEANFILES = Makefile.in
> -
> -sbin_PROGRAMS = gfs2_quota
> -
> -noinst_HEADERS = gfs2_quota.h
> -
> -gfs2_quota_SOURCES = check.c main.c names.c
> -
> -gfs2_quota_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
> - -DHELPER_PROGRAM
> - -I$(top_srcdir)/gfs2/include
> - -I$(top_srcdir)/gfs2/libgfs2
> -
> -gfs2_quota_LDADD = $(top_builddir)/gfs2/libgfs2/libgfs2.la
> diff --git a/gfs2/quota/check.c b/gfs2/quota/check.c
> deleted file mode 100644
> index 9afb0ad..0000000
> --- a/gfs2/quota/check.c
> +++ /dev/null
> @@ -1,601 +0,0 @@
> -#include "clusterautoconfig.h"
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -#include <unistd.h>
> -#include <errno.h>
> -#include <sys/ioctl.h>
> -#include <time.h>
> -#include <dirent.h>
> -#include <limits.h>
> -#include <stdint.h>
> -#include <inttypes.h>
> -#include <linux/types.h>
> -#include <linux/fiemap.h>
> -
> -#define __user
> -#include "osi_list.h"
> -
> -#include "gfs2_quota.h"
> -
> -#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
> -
> -struct values {
> - osi_list_t v_list;
> -
> - uint32_t v_id;
> - int64_t v_blocks;
> -};
> -typedef struct values values_t;
> -
> -struct hardlinks {
> - osi_list_t hl_list;
> -
> - ino_t hl_ino;
> -};
> -typedef struct hardlinks hardlinks_t;
> -
> -/**
> - * add_value - add a ID / Allocated Blocks pair to the list
> - * @list: the list
> - * @id: the ID number
> - * @blocks: the number of blocks to add
> - *
> - */
> -
> -static void
> -add_value(osi_list_t *list, uint32_t id, int64_t blocks)
> -{
> - osi_list_t *tmp;
> - values_t *v;
> -
> - for (tmp = list->next; tmp != list; tmp = tmp->next) {
> - v = osi_list_entry(tmp, values_t, v_list);
> - if (v->v_id != id)
> - continue;
> -
> - v->v_blocks += blocks;
> -
> - osi_list_del(&v->v_list);
> - osi_list_add(&v->v_list, list);
> -
> - return;
> - }
> -
> - type_zalloc(v, values_t, 1);
> -
> - v->v_id = id;
> - v->v_blocks = blocks;
> -
> - osi_list_add(&v->v_list, list);
> -}
> -
> -/**
> - * test_and_add_hard_link - Add a inode that has hard links to the list
> - * @list: the list of inodes with hard links
> - * @ino: the number of the inode to add
> - *
> - * Returns: Returns TRUE if the inode was already on the list, FALSE if it wasn't
> - */
> -
> -static int
> -test_and_add_hard_link(osi_list_t *list, ino_t ino)
> -{
> - osi_list_t *tmp;
> - hardlinks_t *hl;
> -
> - for (tmp = list->next; tmp != list; tmp = tmp->next) {
> - hl = osi_list_entry(tmp, hardlinks_t, hl_list);
> - if (hl->hl_ino != ino)
> - continue;
> -
> - return TRUE;
> - }
> -
> - type_zalloc(hl, hardlinks_t, 1);
> -
> - hl->hl_ino = ino;
> -
> - osi_list_add(&hl->hl_list, list);
> -
> - return FALSE;
> -}
> -
> -/**
> - * scan_fs - recursively scan a filesystem and figure out what IDs have what
> - * @device: the device the filesystem is on
> - * @dirname: the name of the directory to read
> - * @uid: returned list of UIDs for this FS
> - * @gid: returned list of GIDs for this FS
> - * @hl: returned list of hard links for this FS
> - *
> - */
> -
> -static void
> -scan_fs(dev_t device, char *dirname,
> - osi_list_t *uid, osi_list_t *gid, osi_list_t *hl)
> -{
> - DIR *dir;
> - struct dirent *de;
> - struct stat st;
> - char *name;
> - int error;
> -
> - dir = opendir(dirname);
> - if (!dir)
> - die("can't open directory %s: %s
", dirname, strerror(errno));
> -
> - while ((de = readdir(dir))) {
> - if (strcmp(de->d_name, "..") == 0)
> - continue;
> -
> - type_alloc(name, char,
> - strlen(dirname) + strlen(de->d_name) + 2);
> - if (dirname[strlen(dirname) - 1] == '/')
> - sprintf(name, "%s%s", dirname, de->d_name);
> - else
> - sprintf(name, "%s/%s", dirname, de->d_name);
> -
> - error = lstat(name, &st);
> - if (error)
> - die("can't stat file %s: %s
", name, strerror(errno));
> -
> - if (st.st_dev != device)
> - die("umount %s and try again
", name);
> -
> - if (S_ISDIR(st.st_mode)) {
> - if (strcmp(de->d_name, ".") == 0) {
> - add_value(uid, st.st_uid, st.st_blocks);
> - add_value(gid, st.st_gid, st.st_blocks);
> - } else
> - scan_fs(device, name, uid, gid, hl);
> - } else if (st.st_nlink == 1 ||
> - !test_and_add_hard_link(hl, st.st_ino)) {
> - add_value(uid, st.st_uid, st.st_blocks);
> - add_value(gid, st.st_gid, st.st_blocks);
> - }
> -
> - free(name);
> - }
> -
> - closedir(dir);
> -}
> -
> -/**
> - * read_quota_file - read the quota file and return list of its contents
> - * @comline: the command line arguments
> - * @uid: returned list of UIDs for the filesystem
> - * @gid: returned list of GIDs for the filesystem
> - *
> - */
> -static void
> -read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
> - osi_list_t *uid, osi_list_t *gid)
> -{
> - int fd;
> - uint32_t id, startq;
> - int error = 0;
> - char quota_file[BUF_SIZE];
> - uint64_t quota_file_size = 0;
> - struct fiemap fmap = { 0, }, *fmap2;
> - struct stat statbuf;
> -
> - strcpy(sdp->path_name, comline->filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_RDONLY);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't open file %s: %s
", comline->filesystem,
> - strerror(errno));
> - }
> - if (fstat(fd, &statbuf) < 0) {
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't stat file %s: %s
", quota_file,
> - strerror(errno));
> - }
> - quota_file_size = statbuf.st_size;
> - /* First find the number of extents in the quota file */
> - fmap.fm_flags = 0;
> - fmap.fm_start = 0;
> - fmap.fm_length = (~0ULL);
> - error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
> - if (error == -1) {
> - fprintf(stderr, "fiemap error (%d): %s
", errno, strerror(errno));
> - goto out;
> - }
> - fmap2 = malloc(sizeof(struct fiemap) +
> - fmap.fm_mapped_extents * sizeof(struct fiemap_extent));
> - if (fmap2 == NULL) {
> - fprintf(stderr, "malloc error (%d): %s
", errno, strerror(errno));
> - goto out;
> - }
> - fmap2->fm_flags = 0;
> - fmap2->fm_start = 0;
> - fmap2->fm_length = (~0ULL);
> - fmap2->fm_extent_count = fmap.fm_mapped_extents;
> - error = ioctl(fd, FS_IOC_FIEMAP, fmap2);
> - if (error == -1) {
> - fprintf(stderr, "fiemap error (%d): %s
", errno, strerror(errno));
> - goto fmap2_free;
> - }
> - if (fmap2->fm_mapped_extents) {
> - int i;
> - for (i=0; i<fmap2->fm_mapped_extents; i++) {
> - struct fiemap_extent *fe = &fmap2->fm_extents[i];
> - uint64_t end = fe->fe_logical + fe->fe_length, val_off;
> - unsigned int v_off;
> -
> - end = end > quota_file_size ? quota_file_size : end;
> - /* we only need to get the value fields, not the whole quota
> - * This also works when struct gfs2_quota straddle page
> - * boundaries. Getting only the value field avoids the
> - * complexity of fetching two parts of the struct gfs2_quota
> - * from two successive pages
> - */
> - /* offset of the value field within struct gfs2_quota */
> - v_off = (unsigned long)(&((struct gfs2_quota *)NULL)->qu_value);
> - /* startq could be at the end of previous extent... */
> - startq = fe->fe_logical / sizeof(struct gfs2_quota);
> - /* but the value field could be in this extent */
> - if ((startq * sizeof(struct gfs2_quota) + v_off) >= fe->fe_logical)
> - val_off = startq * sizeof(struct gfs2_quota) + v_off;
> - else /* if the start of the extent doesn't have a split quota */
> - val_off = ++startq * sizeof(struct gfs2_quota) + v_off;
> -
> - while ((val_off + sizeof(uint64_t)) <= end)
> - {
> - uint64_t value;
> - /* read hidden quota file here */
> - lseek(fd, val_off, SEEK_SET);
> - error = read(fd, (unsigned char*)&value, sizeof(uint64_t));
> - if (error < 0) {
> - fprintf(stderr, "read error (%d): %s
",
> - errno, strerror(errno));
> - goto fmap2_free;
> - }
> - value = be64_to_cpu(value);
> - id = startq >> 1;
> - /* We want value in 512 byte blocks (1 << 9 = 512) */
> - value <<= sdp->sd_sb.sb_bsize_shift - 9;
> - if (value) {
> - /* if startq is even, it's a uid, else gid */
> - if (startq % 2)
> - add_value(gid, id, value);
> - else
> - add_value(uid, id, value);
> - }
> - startq++;
> - val_off += sizeof(struct gfs2_quota);
> - }
> - }
> - }
> -fmap2_free:
> - free(fmap2);
> -out:
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> -}
> -
> -/**
> - * do_compare - compare to ID lists and see if they match
> - * @type: the type of list (UID or GID)
> - * @fs_list: the list derived from scaning the FS
> - * @qf_list: the list derived from reading the quota file
> - *
> - * Returns: TRUE if there was a mismatch
> - */
> -
> -static int
> -do_compare(const char *type, osi_list_t *fs_list, osi_list_t *qf_list)
> -{
> - osi_list_t *tmp1, *tmp2;
> - values_t *v1, *v2;
> - int found;
> - int mismatch = FALSE;
> -
> - for (tmp1 = fs_list->next; tmp1 != fs_list; tmp1 = tmp1->next) {
> - v1 = osi_list_entry(tmp1, values_t, v_list);
> -
> - found = FALSE;
> -
> - for (tmp2 = qf_list->next; tmp2 != qf_list; tmp2 = tmp2->next) {
> - v2 = osi_list_entry(tmp2, values_t, v_list);
> - if (v1->v_id != v2->v_id)
> - continue;
> -
> - if (v1->v_blocks != v2->v_blocks) {
> - printf("mismatch: %s %u: scan = %lld, quotafile = %lld
",
> - type, v1->v_id,
> - (long long)v1->v_blocks, (long long)v2->v_blocks);
> - mismatch = TRUE;
> - }
> -
> - osi_list_del(&v2->v_list);
> - free(v2);
> -
> - found = TRUE;
> - break;
> - }
> -
> - if (!found) {
> - printf("mismatch: %s %u: scan = %lld, quotafile = %lld
",
> - type, v1->v_id,
> - (long long)v1->v_blocks, 0LL);
> - mismatch = TRUE;
> - }
> - }
> -
> - for (tmp2 = qf_list->next; tmp2 != qf_list; tmp2 = tmp2->next) {
> - v2 = osi_list_entry(tmp2, values_t, v_list);
> -
> - printf("mismatch: %s %u: scan = %lld, quotafile = %lld
",
> - type, v2->v_id,
> - 0LL, (long long)v2->v_blocks);
> - mismatch = TRUE;
> - }
> -
> - return mismatch;
> -}
> -
> -/**
> - * verify_pathname - make sure the path on the command line is a mount point
> - * @comline: the command line arguments
> - *
> - * Returns: the device the filesystem is on
> - */
> -
> -static dev_t
> -verify_pathname(commandline_t *comline)
> -{
> - struct stat st1, st2;
> - dev_t device;
> - char *name;
> - int error;
> -
> - if (!*comline->filesystem)
> - die("need a filesystem to work on
");
> -
> - error = lstat(comline->filesystem, &st1);
> - if (error)
> - die("can't stat %s: %s
", comline->filesystem,
> - strerror(errno));
> -
> - if (!S_ISDIR(st1.st_mode))
> - die("%s must be a directory
", comline->filesystem);
> -
> - device = st1.st_dev;
> -
> - for (;

{
> - type_alloc(name, char, strlen(comline->filesystem) + 4);
> - sprintf(name, "%s/..", comline->filesystem);
> -
> - error = lstat(name, &st2);
> - if (error)
> - die("can't stat %s: %s
", name, strerror(errno));
> -
> - if (st2.st_dev != device || st2.st_ino == st1.st_ino) {
> - free(name);
> - break;
> - }
> -
> - if (!realpath(name, comline->filesystem))
> - die("error resolving filesystem pathname: %s
",
> - strerror(errno));
> -
> - free(name);
> -
> - st1 = st2;
> - }
> -
> - return device;
> -}
> -
> -/**
> - * do_check - Check what's in the quota file
> - * @comline: the struct containing the parsed command line arguments
> - *
> - */
> -
> -void
> -do_check(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - dev_t device;
> - osi_list_t fs_uid, fs_gid, qf_uid, qf_gid;
> - osi_list_t hl;
> - int mismatch;
> -
> - osi_list_init(&fs_uid);
> - osi_list_init(&fs_gid);
> - osi_list_init(&qf_uid);
> - osi_list_init(&qf_gid);
> - osi_list_init(&hl);
> -
> - device = verify_pathname(comline);
> -
> - scan_fs(device, comline->filesystem, &fs_uid, &fs_gid, &hl);
> - read_quota_file(sdp, comline, &qf_uid, &qf_gid);
> -
> - mismatch = do_compare("user", &fs_uid, &qf_uid);
> - mismatch |= do_compare("group", &fs_gid, &qf_gid);
> -
> - if (mismatch)
> - exit(EXIT_FAILURE);
> -}
> -
> -/**
> - * set_list - write a list of IDs into the quota file
> - * @comline: the command line arguments
> - * @user: TRUE if this is a list of UIDs, FALSE if it is a list of GIDs
> - * @list: the list of IDs and block counts
> - * @multiplier: multiply block counts by this
> - *
> - */
> -
> -static void
> -set_list(struct gfs2_sbd *sdp, commandline_t *comline, int user,
> - osi_list_t *list, int64_t multiplier)
> -{
> - int fd;
> - osi_list_t *tmp;
> - values_t *v;
> - uint64_t offset, max_off = 0;
> - int64_t value;
> - int error;
> - char quota_file[BUF_SIZE];
> - char id_str[16];
> - char *fs;
> - struct stat st;
> -
> - strcpy(sdp->path_name, comline->filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_WRONLY);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't open file %s: %s
", comline->filesystem,
> - strerror(errno));
> - }
> -
> - for (tmp = list->next; tmp != list; tmp = tmp->next) {
> - v = osi_list_entry(tmp, values_t, v_list);
> -
> - offset = (2 * (uint64_t)v->v_id + ((user) ? 0 : 1)) *
> - sizeof(struct gfs2_quota);
> - if (offset > max_off)
> - max_off = offset;
> - offset += (unsigned long)(&((struct gfs2_quota *)NULL)->qu_value);
> -
> - value = v->v_blocks * multiplier;
> - value >>= sdp->sd_sb.sb_bsize_shift - 9;
> - value = cpu_to_be64(value);
> -
> - lseek(fd, offset, SEEK_SET);
> - error = write(fd, (char*)&value, sizeof(uint64_t));
> - if (error != sizeof(uint64_t)) {
> - fprintf(stderr, "can't write quota file (%d): %s
",
> - error, strerror(errno));
> - goto out;
> - }
> -
> - fs = mp2fsname(comline->filesystem);
> - if (!fs) {
> - fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s
",
> - comline->filesystem);
> - exit(-1);
> - }
> -
> - /* Write the id to sysfs quota refresh file to refresh gfs quotas */
> - sprintf(id_str, "%d", comline->id);
> - if (set_sysfs(fs, (user) ? "quota_refresh_user" : "quota_refresh_group",
> - id_str)) {
> - fprintf(stderr, "Error writing id to sysfs quota refresh file: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> - }
> - /* If we wrote a value that extended the quota file size,
> - * round the size off to the nearest quota boundary
> - */
> - error = fstat(fd, &st);
> - if (error) {
> - fprintf(stderr, "can't stat quota file (%d): %s
",
> - error, strerror(errno));
> - goto out;
> - }
> - if (st.st_size < (max_off + sizeof(struct gfs2_quota))) {
> - error = ftruncate(fd, (max_off + sizeof(struct gfs2_quota)));
> - if (error)
> - fprintf(stderr, "can't truncate quota file(%d): %s
",
> - error, strerror(errno));
> - }
> -out:
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> -}
> -
> -/**
> - * do_quota_init - initialize the quota file
> - * @comline: the command line arguments
> - *
> - */
> -
> -void
> -do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - dev_t device;
> - osi_list_t fs_uid, fs_gid, qf_uid, qf_gid;
> - osi_list_t hl;
> - values_t *v;
> -
> - osi_list_init(&fs_uid);
> - osi_list_init(&fs_gid);
> - osi_list_init(&qf_uid);
> - osi_list_init(&qf_gid);
> - osi_list_init(&hl);
> -
> - device = verify_pathname(comline);
> -
> - scan_fs(device, comline->filesystem, &fs_uid, &fs_gid, &hl);
> - read_quota_file(sdp, comline, &qf_uid, &qf_gid);
> -
> - type_zalloc(v, values_t, 1);
> - v->v_id = 0;
> - v->v_blocks = 0;
> - osi_list_add(&v->v_list, &qf_uid);
> -
> - type_zalloc(v, values_t, 1);
> - v->v_id = 0;
> - v->v_blocks = 0;
> - osi_list_add(&v->v_list, &qf_gid);
> -
> - set_list(sdp, comline, TRUE, &qf_uid, 0);
> - set_list(sdp, comline, FALSE, &qf_gid, 0);
> - set_list(sdp, comline, TRUE, &fs_uid, 1);
> - set_list(sdp, comline, FALSE, &fs_gid, 1);
> -
> - do_sync(sdp, comline);
> - do_check(sdp, comline);
> -}
> diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
> deleted file mode 100644
> index 744f02b..0000000
> --- a/gfs2/quota/gfs2_quota.h
> +++ /dev/null
> @@ -1,95 +0,0 @@
> -#ifndef __GFS2_QUOTA_DOT_H__
> -#define __GFS2_QUOTA_DOT_H__
> -
> -#include <stdarg.h>
> -#include "libgfs2.h"
> -#include <linux/gfs2_ondisk.h>
> -
> -#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
> -
> -#define type_zalloc(ptr, type, count)
> -do {
> - (ptr) = (type *)malloc(sizeof(type) * (count));
> - if ((ptr))
> - memset((char *)(ptr), 0, sizeof(type) * (count));
> - else
> - die("unable to allocate memory on line %d of file %s
",
> - __LINE__, __FILE__);
> -} while (0)
> -
> -#define type_alloc(ptr, type, count)
> -do {
> - (ptr) = (type *)malloc(sizeof(type) * (count));
> - if (!(ptr))
> - die("unable to allocate memory on line %d of file %s
",
> - __LINE__, __FILE__);
> -} while (0)
> -
> -#define GQ_OP_LIST (12)
> -#define GQ_OP_SYNC (13)
> -#define GQ_OP_GET (14)
> -#define GQ_OP_LIMIT (15)
> -#define GQ_OP_WARN (16)
> -#define GQ_OP_CHECK (17)
> -#define GQ_OP_INIT (18)
> -#define GQ_OP_RESET (19)
> -
> -#define GQ_ID_USER (23)
> -#define GQ_ID_GROUP (24)
> -
> -#define GQ_UNITS_MEGABYTE (0)
> -#define GQ_UNITS_KILOBYTE (34)
> -#define GQ_UNITS_FSBLOCK (35)
> -#define GQ_UNITS_BASICBLOCK (36)
> -
> -#define BUF_SIZE 4096
> -
> -struct commandline {
> - unsigned int operation;
> -
> - uint64_t new_value;
> - int new_value_set;
> -
> - unsigned int id_type;
> - uint32_t id;
> -
> - unsigned int units;
> -
> - int numbers;
> -
> - char filesystem[PATH_MAX];
> -};
> -typedef struct commandline commandline_t;
> -
> -/* main.c */
> -
> -void do_get_super(int fd, struct gfs2_sb *sb);
> -void do_sync(struct gfs2_sbd *sdp, commandline_t *comline);
> -void cleanup(void);
> -void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
> -void read_quota_internal(int fd, unsigned int id, int id_type,
> - struct gfs2_quota *q);
> -
> -/* check.c */
> -
> -void do_check(struct gfs2_sbd *sdp, commandline_t *comline);
> -void do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline);
> -
> -/* names.c */
> -
> -uint32_t name_to_id(int user, char *name, int numbers);
> -char *id_to_name(int user, uint32_t id, int numbers);
> -
> -/* die() used to be in libgfs2.h */
> -static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
> -void die(const char *fmt, ...)
> -{
> - va_list ap;
> - fprintf(stderr, "%s: ", __FILE__);
> - va_start(ap, fmt);
> - vfprintf(stderr, fmt, ap);
> - va_end(ap);
> - exit(-1);
> -}
> -
> -#endif /* __GFS2_QUOTA_DOT_H__ */
> diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
> deleted file mode 100644
> index 733f69d..0000000
> --- a/gfs2/quota/main.c
> +++ /dev/null
> @@ -1,911 +0,0 @@
> -#include "clusterautoconfig.h"
> -
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <stdarg.h>
> -#include <string.h>
> -#include <ctype.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <sys/file.h>
> -#include <fcntl.h>
> -#include <unistd.h>
> -#include <errno.h>
> -#include <sys/ioctl.h>
> -#include <time.h>
> -#include <limits.h>
> -#include <sys/param.h>
> -#include <sys/mount.h>
> -#include <stdint.h>
> -#include <inttypes.h>
> -
> -#include <linux/types.h>
> -#include <linux/fiemap.h>
> -#include "gfs2_quota.h"
> -
> -#define __user
> -
> -#include "copyright.cf"
> -
> -
> -/* Constants */
> -
> -#define OPTION_STRING ("bdf:g:hkl:mnsu:V")
> -#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
> -
> -/**
> - * This function is for libgfs2's sake.
> - */
> -void print_it(const char *label, const char *fmt, const char *fmt2, ...)
> -{
> - va_list args;
> -
> - va_start(args, fmt2);
> - printf("%s: ", label);
> - vprintf(fmt, args);
> - va_end(args);
> -}
> -
> -/**
> - * print_usage - print usage info to the user
> - * @prog_name: The name of this program
> - */
> -
> -static void
> -print_usage(const char *prog_name)
> -{
> - printf("Usage:
");
> - printf("
");
> - printf("%s <list|sync|get|limit|warn|check|init> [options]
",
> - prog_name);
> - printf("
");
> - printf("Actions:
");
> - printf(" list list the whole quota file
");
> - printf(" sync sync out unsynced quotas
");
> - printf(" get get quota values for an ID
");
> - printf(" limit set a quota limit value for an ID
");
> - printf(" warn set a quota warning value for an ID
");
> - printf(" check check the quota file
");
> - printf(" init initialize the quota file
");
> - printf(" reset reset the quota file
");
> - printf("
");
> - printf("Options:
");
> - printf(" -b sizes are in FS blocks
");
> - printf(" -f <directory> the filesystem to work on
");
> - printf(" -g <gid> get/set a group ID
");
> - printf(" -h Print this help, then exit
");
> - printf(" -k sizes are in KB
");
> - printf(" -l <size> the new limit or warn value
");
> - printf(" -m sizes are in MB
");
> - printf(" -n print out UID/GID numbers instead of names
");
> - printf(" -s sizes are in 512-byte blocks
");
> - printf(" -u <uid> get/set a user ID
");
> - printf(" -V Print program version information, then exit
");
> -}
> -
> -/**
> - * decode_arguments - parse command line arguments
> - * @argc: well, it's argc...
> - * @argv: well, it's argv...
> - * @comline: the structure filled in with the parsed arguments
> - *
> - * Function description
> - *
> - * Returns: what is returned
> - */
> -
> -static void
> -decode_arguments(int argc, char *argv[], commandline_t *comline)
> -{
> - int cont = TRUE;
> - int optchar;
> -
> - while (cont) {
> - optchar = getopt(argc, argv, OPTION_STRING);
> -
> - switch (optchar) {
> - case 'u':
> - comline->id_type = GQ_ID_USER;
> - comline->id = name_to_id(TRUE, optarg, comline->numbers);
> - break;
> -
> - case 'g':
> - comline->id_type = GQ_ID_GROUP;
> - comline->id = name_to_id(FALSE, optarg, comline->numbers);
> - break;
> -
> - case 'l':
> - if (!isdigit(*optarg))
> - die("argument to -l must be a number
");
> - sscanf(optarg, "%"SCNu64, &comline->new_value);
> - comline->new_value_set = TRUE;
> - break;
> -
> - case 'f':
> - if (!realpath(optarg, comline->filesystem))
> - die("can't find %s: %s
", optarg,
> - strerror(errno));
> - break;
> -
> - case 'm':
> - comline->units = GQ_UNITS_MEGABYTE;
> - break;
> -
> - case 'k':
> - comline->units = GQ_UNITS_KILOBYTE;
> - break;
> -
> - case 'b':
> - comline->units = GQ_UNITS_FSBLOCK;
> - break;
> -
> - case 's':
> - comline->units = GQ_UNITS_BASICBLOCK;
> - break;
> -
> - case 'n':
> - comline->numbers = TRUE;
> - break;
> -
> - case 'V':
> - printf("gfs2_quota %s (built %s %s)
", VERSION,
> - __DATE__, __TIME__);
> - printf("%s
", REDHAT_COPYRIGHT);
> - exit(EXIT_SUCCESS);
> - break;
> -
> - case 'h':
> - print_usage(argv[0]);
> - exit(EXIT_SUCCESS);
> - break;
> -
> - case ':':
> - case '?':
> - fprintf(stderr, "Please use '-h' for usage.
");
> - exit(EXIT_FAILURE);
> - break;
> -
> - case EOF:
> - cont = FALSE;
> - break;
> -
> - default:
> - die("unknown option: %c
", optchar);
> - break;
> - };
> - }
> -
> - while (optind < argc) {
> - if (strcmp(argv[optind], "list") == 0 ||
> - strcmp(argv[optind], "dump") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_LIST;
> - } else if (strcmp(argv[optind], "sync") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_SYNC;
> - } else if (strcmp(argv[optind], "get") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_GET;
> - } else if (strcmp(argv[optind], "limit") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_LIMIT;
> - } else if (strcmp(argv[optind], "warn") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_WARN;
> - } else if (strcmp(argv[optind], "check") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_CHECK;
> - } else if (strcmp(argv[optind], "init") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_INIT;
> - } else if (strcmp(argv[optind], "reset") == 0) {
> - if (comline->operation)
> - die("can't specify two operations
");
> - comline->operation = GQ_OP_RESET;
> - } else
> - die("unknown option %s
", argv[optind]);
> -
> - optind++;
> - }
> -}
> -
> -/**
> - * print_quota - Print out a quota entry
> - * @comline: the struct containing the parsed command line arguments
> - * @user: TRUE if this is a user quota, FALSE if it's a group quota
> - * @id: the ID
> - * @q: the quota value
> - * @sb: the superblock of the filesystem this quota belongs to
> - *
> - */
> -
> -static void
> -print_quota(commandline_t *comline,
> - int user, uint32_t id,
> - struct gfs2_quota *q,
> - struct gfs2_sb *sb)
> -{
> - printf("%-5s %10s: ", (user) ? "user" : "group",
> - id_to_name(user, id, comline->numbers));
> -
> - switch (comline->units) {
> - case GQ_UNITS_MEGABYTE:
> - printf("limit: %-10.1f warn: %-10.1f value: %-10.1f
",
> - (double) q->qu_limit * sb->sb_bsize / 1048576,
> - (double) q->qu_warn * sb->sb_bsize / 1048576,
> - (double) q->qu_value * sb->sb_bsize / 1048576);
> - break;
> -
> - case GQ_UNITS_KILOBYTE:
> - if (sb->sb_bsize == 512)
> - printf("limit: %-10llu warn: %-10lluvalue: %-10llu
",
> - (unsigned long long)q->qu_limit / 2,
> - (unsigned long long)q->qu_warn / 2,
> - (unsigned long long)q->qu_value / 2);
> - else
> - printf("limit: %-10llu warn: %-10lluvalue: %-10llu
",
> - (unsigned long long)
> - q->qu_limit << (sb->sb_bsize_shift - 10),
> - (unsigned long long)
> - q->qu_warn << (sb->sb_bsize_shift - 10),
> - (unsigned long long)
> - q->qu_value << (sb->sb_bsize_shift - 10));
> - break;
> -
> - case GQ_UNITS_FSBLOCK:
> - printf("limit: %-10llu warn: %-10llu value: %-10llu
",
> - (unsigned long long)q->qu_limit,
> - (unsigned long long)q->qu_warn,
> - (unsigned long long)q->qu_value);
> - break;
> -
> - case GQ_UNITS_BASICBLOCK:
> - printf("limit: %-10llu warn: %-10llu value: %-10llu
",
> - (unsigned long long)
> - q->qu_limit << (sb->sb_bsize_shift - 9),
> - (unsigned long long)
> - q->qu_warn << (sb->sb_bsize_shift - 9),
> - (unsigned long long)
> - q->qu_value << (sb->sb_bsize_shift - 9));
> - break;
> -
> - default:
> - die("bad units
");
> - break;
> - }
> -}
> -
> -void
> -read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp)
> -{
> - int fd;
> - char buf[PATH_MAX];
> - struct gfs2_buffer_head dummy_bh;
> -
> - dummy_bh.b_data = buf;
> - fd = open(sdp->device_name, O_RDONLY);
> - if (fd < 0) {
> - die("Could not open the block device %s: %s
",
> - sdp->device_name, strerror(errno));
> - }
> - if (lseek(fd, 0x10 * 4096, SEEK_SET) != 0x10 * 4096) {
> - fprintf(stderr, "bad seek: %s from %s:%d: "
> - "superblock
",
> - strerror(errno), __FUNCTION__, __LINE__);
> -
> - exit(-1);
> - }
> - if (read(fd, buf, PATH_MAX) != PATH_MAX) {
> - fprintf(stderr, "bad read: %s from %s:%d: superblock
",
> - strerror(errno), __FUNCTION__, __LINE__);
> - exit(-1);
> - }
> - gfs2_sb_in(sb, &dummy_bh);
> -
> - close(fd);
> -}
> -
> -void
> -read_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
> -{
> - /* seek to the appropriate offset in the quota file and read the
> - quota info */
> - uint64_t offset;
> - char buf[256];
> - int error;
> - if (id_type == GQ_ID_USER)
> - offset = (2 * (uint64_t)id) * sizeof(struct gfs2_quota);
> - else
> - offset = (2 * (uint64_t)id + 1) * sizeof(struct gfs2_quota);
> - lseek(fd, offset, SEEK_SET);
> - error = read(fd, buf, sizeof(struct gfs2_quota));
> - if (error < 0)
> - die("failed to read from quota file: %s
", strerror(errno));
> - if (error != sizeof(struct gfs2_quota))
> - die("Couldn't read %lu bytes from quota file at offset %llu
",
> - (unsigned long)sizeof(struct gfs2_quota),
> - (unsigned long long)offset);
> - gfs2_quota_in(q, buf);
> -}
> -
> -static inline void
> -write_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
> -{
> - /* seek to the appropriate offset in the quota file and write the
> - quota info */
> - uint64_t offset;
> - char buf[256];
> - int error;
> - if (id_type == GQ_ID_USER)
> - offset = (2 * (uint64_t)id) * sizeof(struct gfs2_quota);
> - else
> - offset = (2 * (uint64_t)id + 1) * sizeof(struct gfs2_quota);
> - lseek(fd, offset, SEEK_SET);
> - gfs2_quota_out(q, buf);
> - error = write(fd, buf, sizeof(struct gfs2_quota));
> - if (error != sizeof(struct gfs2_quota))
> - die("failed to write to quota file: %s
", strerror(errno));
> -}
> -
> -/**
> - * do_reset - Reset all the quota data for a filesystem
> - * @comline: the struct containing the parsed command line arguments
> - */
> -
> -static void
> -do_reset(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - int fd;
> - char quota_file[BUF_SIZE], c;
> - struct gfs2_quota q;
> -
> - if (!*comline->filesystem)
> - die("need a filesystem to work on
");
> -
> - printf("This operation will permanently erase all quota information.
"
> - "You will have to re-assign all quota limit/warn values.
"
> - "Proceed [y/N]? ");
> - c = getchar();
> - if (c != 'y' && c != 'Y')
> - return;
> -
> - strcpy(sdp->path_name, comline->filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_RDWR);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't open file %s: %s
", quota_file,
> - strerror(errno));
> - }
> -
> - read_quota_internal(fd, 0, GQ_ID_USER, &q);
> - write_quota_internal(fd, 0, GQ_ID_USER, &q);
> -
> - read_quota_internal(fd, 0, GQ_ID_GROUP, &q);
> - write_quota_internal(fd, 0, GQ_ID_GROUP, &q);
> -
> - /* truncate the quota file such that only the first
> - * two quotas(uid=0 and gid=0) remain.
> - */
> - if (ftruncate(fd, (sizeof(struct gfs2_quota)) * 2))
> - die("couldn't truncate quota file %s
", strerror(errno));
> -
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> -}
> -
> -/**
> - * do_list - List all the quota data for a filesystem
> - * @comline: the struct containing the parsed command line arguments
> - *
> - */
> -
> -static void
> -do_list(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - int fd;
> - struct gfs2_quota q;
> - char buf[sizeof(struct gfs2_quota)];
> - uint64_t offset;
> - uint32_t id, startid;
> - int pass = 0;
> - int error = 0;
> - char quota_file[BUF_SIZE];
> - uint64_t quota_file_size = 0;
> - struct fiemap fmap = { 0, }, *fmap2;
> - struct stat statbuf;
> -
> - if (!*comline->filesystem)
> - die("need a filesystem to work on
");
> -
> - strcpy(sdp->path_name, comline->filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_RDONLY);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't open file %s: %s
", quota_file,
> - strerror(errno));
> - }
> - if (fstat(fd, &statbuf) < 0) {
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't stat file %s: %s
", quota_file,
> - strerror(errno));
> - }
> - quota_file_size = statbuf.st_size;
> - /* First find the number of extents in the quota file */
> - fmap.fm_flags = 0;
> - fmap.fm_start = 0;
> - fmap.fm_length = (~0ULL);
> - error = ioctl(fd, FS_IOC_FIEMAP, &fmap);
> - if (error == -1) {
> - fprintf(stderr, "fiemap error (%d): %s
", errno, strerror(errno));
> - goto out;
> - }
> - fmap2 = malloc(sizeof(struct fiemap) +
> - fmap.fm_mapped_extents * sizeof(struct fiemap_extent));
> - if (fmap2 == NULL) {
> - fprintf(stderr, "malloc error (%d): %s
", errno, strerror(errno));
> - goto out;
> - }
> - fmap2->fm_flags = 0;
> - fmap2->fm_start = 0;
> - fmap2->fm_length = (~0ULL);
> - fmap2->fm_extent_count = fmap.fm_mapped_extents;
> -
> - error = ioctl(fd, FS_IOC_FIEMAP, fmap2);
> - if (error == -1) {
> - fprintf(stderr, "fiemap error (%d): %s
", errno, strerror(errno));
> - goto fmap2_free;
> - }
> - if (fmap2->fm_mapped_extents) {
> - int i;
> - again:
> - for (i=0; i<fmap2->fm_mapped_extents; i++) {
> - struct fiemap_extent *fe = &fmap2->fm_extents[i];
> - uint64_t end = fe->fe_logical + fe->fe_length;
> -
> - end = end > quota_file_size ? quota_file_size : end;
> - startid = DIV_RU(fe->fe_logical, sizeof(struct gfs2_quota));
> - if (startid % 2 != pass)
> - startid++;
> - offset = startid * sizeof(struct gfs2_quota);
> - do {
> - memset(buf, 0, sizeof(struct gfs2_quota));
> - /* read hidden quota file here */
> - lseek(fd, offset, SEEK_SET);
> - error = read(fd, buf, sizeof(struct gfs2_quota));
> - if (error < 0) {
> - fprintf(stderr, "read error (%d): %s
",
> - errno, strerror(errno));
> - goto fmap2_free;
> - }
> - gfs2_quota_in(&q, buf);
> - id = (offset / sizeof(struct gfs2_quota)) >> 1;
> - if (q.qu_limit || q.qu_warn || q.qu_value)
> - print_quota(comline, (pass) ? FALSE : TRUE, id,
> - &q, &sdp->sd_sb);
> - offset += 2 * sizeof(struct gfs2_quota);
> - } while (offset < end);
> - }
> - if (!pass) {
> - pass = 1;
> - goto again;
> - }
> - }
> -
> -fmap2_free:
> - free(fmap2);
> -out:
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> -}
> -
> -/**
> - * do_get_one - Get a quota value from one FS
> - * @comline: the struct containing the parsed command line arguments
> - * @filesystem: the filesystem to get from
> - *
> - */
> -
> -static void
> -do_get_one(struct gfs2_sbd *sdp, commandline_t *comline, char *filesystem)
> -{
> - int fd;
> - char buf[256];
> - struct gfs2_quota q;
> - uint64_t offset;
> - int error;
> - char quota_file[BUF_SIZE];
> -
> - strcpy(sdp->path_name, filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_RDONLY);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't open file %s: %s
", quota_file,
> - strerror(errno));
> - }
> -
> - if (comline->id_type == GQ_ID_USER)
> - offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs2_quota);
> - else
> - offset = (2 * (uint64_t)comline->id + 1) * sizeof(struct gfs2_quota);
> -
> - memset(&q, 0, sizeof(struct gfs2_quota));
> -
> - lseek(fd, offset, SEEK_SET);
> - error = read(fd, buf, sizeof(struct gfs2_quota));
> - if (error < 0) {
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> - die("can't get quota info (%d): %s
",
> - error, strerror(errno));
> - }
> -
> - gfs2_quota_in(&q, buf);
> - print_quota(comline,
> - (comline->id_type == GQ_ID_USER), comline->id,
> - &q, &sdp->sd_sb);
> -
> - close(fd);
> - close(sdp->metafs_fd);
> - cleanup_metafs(sdp);
> -}
> -
> -/**
> - * do_get - Get a quota value
> - * @comline: the struct containing the parsed command line arguments
> - *
> - */
> -
> -static void
> -do_get(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - int first = TRUE;
> -
> - if (*comline->filesystem)
> - do_get_one(sdp, comline, comline->filesystem);
> - else {
> - char buf[256], device[256], path[256], type[256];
> - FILE *file;
> -
> - file = fopen("/proc/mounts", "r");
> - if (!file)
> - die("can't open /proc/mounts: %s
", strerror(errno));
> -
> - while (fgets(buf, 256, file)) {
> - if (sscanf(buf, "%s %s %s", device, path, type) != 3)
> - continue;
> - if (strcmp(type, "gfs2") != 0)
> - continue;
> -
> - if (first)
> - first = FALSE;
> - else
> - printf("
");
> -
> - printf("%s
", path);
> - do_get_one(sdp, comline, path);
> - }
> -
> - fclose(file);
> - }
> -}
> -
> -/**
> - * do_sync_one - sync the quotas on one GFS2 filesystem
> - * @path: a file/directory in the filesystem
> - *
> - */
> -static void
> -do_sync_one(struct gfs2_sbd *sdp, char *filesystem)
> -{
> - char *fsname;
> -
> - fsname = mp2fsname(filesystem);
> - if (!fsname) {
> - fprintf(stderr, "Couldn't find GFS2 filesystem mounted at %s
",
> - filesystem);
> - exit(-1);
> - }
> - if (set_sysfs(fsname, "quota_sync", "1")) {
> - fprintf(stderr, "Error writing to sysfs quota sync file: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -}
> -
> -/**
> - * do_sync - sync out unsyned quotas
> - * @comline: the struct containing the parsed command line arguments
> - *
> - */
> -
> -void
> -do_sync(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - sync();
> -
> - if (*comline->filesystem)
> - do_sync_one(sdp, comline->filesystem);
> - else {
> - char buf[256], device[256], path[256], type[256];
> - FILE *file;
> -
> - file = fopen("/proc/mounts", "r");
> - if (!file)
> - die("can't open /proc/mounts: %s
", strerror(errno));
> -
> - while (fgets(buf, 256, file)) {
> - if (sscanf(buf, "%s %s %s", device, path, type) != 3)
> - continue;
> - if (strcmp(type, "gfs2") != 0)
> - continue;
> -
> - do_sync_one(sdp, path);
> - }
> -
> - fclose(file);
> - }
> -}
> -
> -/**
> - * do_set - Set a quota value
> - * @comline: the struct containing the parsed command line arguments
> - *
> - */
> -
> -static void
> -do_set(struct gfs2_sbd *sdp, commandline_t *comline)
> -{
> - int fd;
> - uint64_t offset;
> - uint64_t new_value;
> - char quota_file[BUF_SIZE];
> - char id_str[16];
> - struct stat stat_buf;
> - struct gfs2_quota q;
> - char *fs;
> -
> - if (!*comline->filesystem)
> - die("need a filesystem to work on
");
> - if (!comline->new_value_set)
> - die("need a new value
");
> -
> - strcpy(sdp->path_name, comline->filesystem);
> - if (check_for_gfs2(sdp)) {
> - if (errno == EINVAL)
> - fprintf(stderr, "Not a valid GFS2 mount point: %s
",
> - sdp->path_name);
> - else
> - fprintf(stderr, "%s
", strerror(errno));
> - exit(-1);
> - }
> - read_superblock(&sdp->sd_sb, sdp);
> - if (mount_gfs2_meta(sdp)) {
> - fprintf(stderr, "Error mounting GFS2 metafs: %s
",
> - strerror(errno));
> - exit(-1);
> - }
> -
> - strcpy(quota_file, sdp->metafs_path);
> - strcat(quota_file, "/quota");
> -
> - fd = open(quota_file, O_RDWR);
> - if (fd < 0) {
> - close(sdp->metafs_fd);
> - cleanup_metafs(s