summaryrefslogtreecommitdiffstats
path: root/utils/mount/mount.c
Commit message (Collapse)AuthorAgeFilesLines
* Added the sys/stat.h header file to a number ofSteve Dickson2010-01-221-0/+1
| | | | | | files which ensure the S_ISDIR() macro is defined. Signed-off-by: Steve Dickson <steved@redhat.com>
* mount options can be lost when using bg optionHarshula Jayasuriya2009-11-161-0/+3
| | | | | | | | | | | | | | | | | | When mounting an NFS export *without* the "bg" option, try_mount() is called only once. Before calling it, the variables mount_opts and extra_opts are set up. Then try_mount() calls nfsmount(), the latter assumes that the aforementioned variables can be modified. Most significantly, it allows the variable extra_opts to be modified. When the "bg" mount option is used *and* the first try_mount() attempt fails, it daemonizes the process and calls try_mount() again, unfortunately, we've lost the required mount options in the variable extra_opts. See https://bugzilla.redhat.com/show_bug.cgi?id=529370 for details. Signed-off-by: Harshula Jayasuriya <harshula@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Cleaned up parsing errors to hopeful be more preciseSteve Dickson2009-08-171-1/+1
| | | | | | | Also had mount_config_init() call xlog_open() so the program name is set on xlog() calls. Signed-off-by: Steve Dickson <steved@redhat.com>
* Added hooks to the mount command that allowSteve Dickson2009-08-161-0/+7
| | | | | | mount options to be set in a configuration file Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Remove unused parameter in try_mount()Chuck Lever2009-07-141-3/+3
| | | | | | | | | | Address compiler warning: mount.c: At top level: mount.c:420: warning: unused parameter nomtab Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* mount.nfs: Use correct data type in discover_nfs_mount_data_version()Chuck Lever2009-07-141-1/+1
| | | | | | | | | | | | | | | | | Address compiler warning: mount.c: In function discover_nfs_mount_data_version¿: mount.c:162: warning: comparison between signed and unsigned mount.c:164: warning: comparison between signed and unsigned mount.c:166: warning: comparison between signed and unsigned mount.c:168: warning: comparison between signed and unsigned mount.c:170: warning: comparison between signed and unsigned mount.c:178: warning: comparison between signed and unsigned linux_version_code() and MAKE_VERSION() both return an unsigned int. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Clean up: Include the bare minimum of legacy RPC headers inChuck Lever2008-07-151-1/+0
| | | | | | | utils/mount/network.h. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Moved the kernel version-ing code into a new version.hChuck Lever2008-07-151-17/+1
| | | | | | | header file which allows the code to be shared Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Ported the create_mtab() routine from util-linux-ng as wellChristiaan Welvaart2008-07-151-34/+80
| | | | | | | | some add_mtab() updates to better hand the instances where /etc/mtab does not exist or is not writable Signed-off-by: Christiaan Welvaart <cjw@daneel.dyndns.org> Signed-off-by: Steve Dickson <steved@redhat.com>
* If mount.nfs is not installed setuid, an attempt to perform a "user"NeilBrown2008-05-081-0/+6
| | | | | | | | | | or "users" mount will fail with a fairly obscure error message, typically about getting "permission denied" from the server. This patch gives a more helpful message in that case. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Recently #include directives for autoconf's config.h file were added inChuck Lever2008-03-111-1/+4
| | | | | | | | | | | | | | | | | utils/mount/error.c and utils/mount/mount.c, but appropriate HAVE_CONFIG_H checks were not added at the same time. In addition, several other .c files under utils/mount reference autoconf-generated HAVE_ macros, but don't appear to include config.h Also, Heinz-Ado Arnolds <arnolds@MPA-Garching.MPG.DE> reports that this patch is needed to ensure START_STATD is properly defined in utils/mount/network.c. Otherwise start_statd() is always a no-op, even if the configure script defines an appropriate statd start-up script. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Heinz-Ado Arnolds <arnolds@MPA-Garching.MPG.DE> Signed-off-by: Steve Dickson <steved@dickson.boston.devel.redhat.com>
* The mount(5) man page states that the noquota, quota, usrquota andSteinar H. Gunderson2008-03-101-0/+4
| | | | | | | | | | | grpquota options are ignored. (They are, however, used by the quota tools, so having them in fstab can be useful.) Make mount.nfs ignore them properly, matching the man page. There are a few aliases (like usrjquota) that are parsed by quota, but as these are not documented nor seem to be widely used, they are not included. Signed-off-by: Steinar H. Gunderson <sgunderson@bigfoot.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Added in relatime mount option so mount.nfs staysSteve Dickson2008-01-241-0/+6
| | | | | | compatible with the mount command in util-linux-ng Signed-off-by: Steve Dickson <steved@redhat.com>
* Address an inconsistency: the mount.nfs command uses the glibc routinesSteve Dickson2008-01-161-5/+7
| | | | | | | | | | | | to manipulate /etc/mtab (setmntent) but, everything else in nfs-utils uses a local private version (nfs_setmntent). The local version does some extra mangling of the mtab entries. We should check what util-linux does these days to be sure, but for now, let's make the mount.nfs command use the nfs_ variants of setmntent(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* add_mtab() calls unlock_mtab() twice in one of its error exit paths.Steve Dickson2008-01-161-1/+0
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Get rid of the "-i" option for mount.nfs[4] and always use the text-Steve Dickson2008-01-041-17/+4
| | | | | | | based mount(2) system call for kernel version 2.6.23 and later. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* text-based mount.nfs: combine nfsmount_s() and nfs4mount_s() pathsChuck Lever2007-10-091-8/+4
| | | | | | | | | The top-level logic that handles text-based mount options is mostly the same for NFS and NFSv4 mounts. To improve maintainability, let's combine the nfsmount_s() and nfs4mount_s() functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Don't leak mount_optsChuck Lever2007-09-251-6/+11
| | | | | | | | A C string containing the user's requested mount options is constructed by the main mount function in utils/mount/mount.c, but is never freed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Don't leak extra_optsChuck Lever2007-09-251-0/+1
| | | | | | | The mount.nfs[4] command should properly release extra_opts before exiting. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* text-based mount.nfs: Fix memory leak in add_mtab()Chuck Lever2007-09-251-0/+2
| | | | | | | | The add_mtab() function in utils/mount/mount.c calls fix_opts_string() to construct an /etc/mtab entry, but never frees the result. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: teach [u]mount.nfs[4] to exit with EX_SUCCESS instead of 0Chuck Lever2007-09-251-4/+4
| | | | | | | Use the newly defined EX_SUCCESS exit code in all the right places. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Replace fork() with daemon() for backgrounding mountsChuck Lever2007-08-241-3/+8
| | | | | | | | | | Neil recommended this change to address a problem with background mount processes handling signals properly during an init level change. It is also useful for preventing background mount processes from reporting progress on the parent's tty, which is generally just annoying noise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount: Small tidy up.Neil Brown2007-08-241-3/+1
| | | | | | | 1/ remove confusing sentence from a comment. 2/ remove needless 'exit' - just fall through to common exit. Signed-off-by: Neil Brown <neilb@suse.de>
* Restrict -i option to root.Neil Brown2007-08-111-0/+5
| | | | | | As it is still under development, don't expose it - just in case. Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Enable mount.nfs to do text-based mount supportChuck Lever2007-08-111-8/+30
| | | | | | | | | | | | | | | | | A new command line option, "-i", is added to mount.nfs to force the use of the string interface for testing purposes. "-s", "-t", and "-r" are already taken or have legacy meaning so I picked "-i". At some later point, when everyone is comfortable with the string mount option parsing implementation, we will add a switch based on kernel version, and remove the "-i" command line option. For now, I am more comfortable enabling it by hand instead. Since this is a temporary arrangement, I'm leaving the option undocumented in the mount.nfs man page. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Replace a "return 0; " that should be an "exit(0); "Chuck Lever2007-08-111-1/+1
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Update the mount.nfs(8) man pageChuck Lever2007-08-101-2/+2
| | | | | | | Account for recent changes to the mount.nfs command. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Fix background mountsChuck Lever2007-08-041-1/+23
| | | | | | | | The new mount.nfs helper does not support background mounts. Add support for background mounts. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Refactor mount logic to allow support for "bg" optionChuck Lever2007-08-041-16/+27
| | | | | | | Refactor main() a bit to make adding support for "bg" option easier. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: restore bg argument to nfsmount() and nfs4mount()Chuck Lever2007-08-041-2/+4
| | | | | | | | To enable background mounting again, restore the "bg" argument to nfsmount() and nfs4mount() that was recently removed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Support double-wide characters in printed stringsChuck Lever2007-08-041-18/+17
| | | | | | | | | | | Previous NLS changes missed a spot or two. This patch tries to get most of them, but probably misses a few more. In errors.c:mount_errors() I've removed a period at the end of the error messages; this is consistent with other error messages I've examined. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: eliminate a nearly empty header file.Chuck Lever2007-07-301-1/+0
| | | | | | | | Clean-up: move nfsumount() global declaration to nfs_mount.h, and remove nfsumount.h. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: make umount_usage() staticChuck Lever2007-07-301-6/+1
| | | | | | | No good reason to export umount_usage. Make it static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Add -Wstrict-prototypes to compiler args, and fix warnings caused.Neil Brown2007-07-291-1/+1
|
* mount.nfs: White space clean upChuck Lever2007-07-201-22/+34
| | | | | Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Error handling clean-upChuck Lever2007-07-201-21/+30
| | | | | | | | | o Use nfs_error( _() ) instead of fprintf(stderr, o Use the mount return code macros instead of bare integers o Free mount_point after it has been canonicalized Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: When -v is set and the mount succeeds, print the mount infoChuck Lever2007-07-201-0/+15
| | | | | | | Add a bit of logic that appears to be in other mount helpers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Remove the running_bg parameterChuck Lever2007-07-201-2/+2
| | | | | | | | Clean up: when nfsmount and nfs4mount are called, running_bg is always set to zero. Remove the parameter from the call. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Change *flags to flagsChuck Lever2007-07-201-2/+2
| | | | | | | | | It's not necessary to treat the *flags parameter to nfsmount and nfs4mount as an output parameter. Nothing is passed back. Replace it with a normal call-by-value. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: No need to return nfs_mount_data structsChuck Lever2007-07-201-20/+2
| | | | | | | | | | | | | | | | Refactor mount processing slightly to remove an output parameter and an unnecessary type cast. The mount syscall is now made from inside nfs_mount or nfs4mount, rather than in common code after those are called. Code review suggests that EX_BG was never returned by mount.nfs because the logic I just replaced was always returning EX_FAIL. The new logic should properly return EX_BG when appropriate. However, it is unclear whether /bin/mount handles backgrounding the mount request, or whether mount.nfs should. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move MS_DUMMY and friends to header fileChuck Lever2007-07-201-5/+0
| | | | | | | | | We move the definitions of MS_USER and friends to our local copy of mount_constants.h. These will need to be available in nfsmount.c and nfs4mount.c when we move the mount system call out of mount.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move start_statd into nfs_mountChuck Lever2007-07-201-59/+2
| | | | | | | | | | | | | | Move start_startd into network.c, and move the call inside of nfs_mount, instead of immediately after - conceptually a better place for it. Also fix a minor nit: Since the mount actually fails if start_statd doesn't work, cause mount.nfs to exit with a status of EX_FAIL. Still need to do something about "running_bg" in nfsmount.c:nfsmount(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Move network functions into a common source moduleChuck Lever2007-07-201-6/+1
| | | | | | | | Separate network oriented functions from filesystem oriented functions, for general cleanliness. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Always preset nfs_mount_versionChuck Lever2007-07-201-0/+49
| | | | | | | | | | | | nfs_mount_version is a global integer that is set based on a guess about which nfs_mount_data version is appropriate for the kernel we're running on. Make it always available and have the correct value before calling mount and unmount so they don't have to worry about setting it themselves. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Create a common source module for reporting mount errorsChuck Lever2007-07-201-28/+5
| | | | | | | Clean up, and pre-requisite for subsequent fixes. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: clean-up add_mtabChuck Lever2007-07-201-24/+28
| | | | | | | | | | Clean up add_mtab(), and make /sbin/mount.nfs[4] return a proper error if it fails. Also include an unbalanced unlock_mtab() noticed by Steve D. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: /bin/mount already handles --bind & friendsChuck Lever2007-07-201-30/+0
| | | | | | | | | | | | | Clean-up: remove logic to handle --bind and other such command-line options from mount.nfs[4]. These options are already handled in /bin/mount, and the logic for handling them in the NFS helper is currently disabled. Other helpers such as mount.ocfs2 appear not to support --bind (ie. they rely on /bin/mount to do it). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Remove support for "-t" optionChuck Lever2007-07-201-36/+26
| | | | | | | | /bin/mount will never pass "-t" to a mount helper, since it passes the fs-type in the name of the program it is executing. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Simplify generation of prognameChuck Lever2007-07-201-7/+2
| | | | | | | Use basename() instead of our own majick. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Fix umount.nfs exit statusSteinar H. Gunderson2007-07-161-1/+1
| | | | | | | | | | | | | | | | Hi, As per a bug report from a user: mount.c seems to assume that nfsumount() uses standard C true/false return values, and inverts them for the exit status (where 0 is traditionally considered success). However, nfsumount() consistently seems to use 0 for success, and thus a success gets returned as exit status 1 and a failure as exit status 0. This confuses at least the GNOME drive manager applet, and probably others as well. Signed-off-by: Steinar H. Gunderson <sesse@debian.org> Signed-off-by: Neil Brown <neilb@suse.de>