summaryrefslogtreecommitdiffstats
path: root/utils/mount
Commit message (Collapse)AuthorAgeFilesLines
...
* mount.nfs: Create a new API to find out client's addressChuck Lever2007-08-252-0/+47
| | | | | | | | | | | | Provide a version of clnt_ping() that discovers the client's address, but doesn't do an RPC ping. The in-kernel text-based mount code already does a ping, so all we need here is address discovery. As well, add a block comment in front of clnt_ping() that hopefully elucidates the differences. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Refactor parse_devname and fill_ipv4_addrChuck Lever2007-08-251-32/+34
| | | | | | | | | We will eventually need the server address in both append_addr_opt() and append_clientaddr_opt(). Call parse_devname() and fill_ipv4_addr() from the top level functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Use dynamically allocated character buffersChuck Lever2007-08-251-27/+58
| | | | | | | | | | | Replace the use of static character arrays with buffers allocated via xstrdup() in stropts.c. I added a couple of extra length checks; not sure if these are really necessary. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Remove get_my_ipv4addr() from append_addr_opt()Chuck Lever2007-08-251-3/+1
| | | | | | | | The result of the get_my_ipv4addr() function is not used in append_addr_opt(), so remove the call and the ip_addr variable. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Don't allow the user to specify addr= or clientaddr=.Chuck Lever2007-08-251-8/+24
| | | | | | | | | | | | The current mount.nfs implementation doesn't allow users to specify their own addr= or clientaddr= option. The new string-based interface does allow this, even though nfs(5) does not document 'addr=' and specifically forbids adding 'clientaddr='. Make the addition of either option by the user a permanent error. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Fix nfs4mount_s prototype.Chuck Lever2007-08-251-2/+3
| | | | | | | | The definition of nfs4mount_s in utils/mount/stropts.c doesn't match the prototype declared in utils/mount/stropts.h. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Combine two verbose messages into oneChuck Lever2007-08-241-10/+2
| | | | | | | A little less noise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: getport() should avoid modifying passed-in argumentsChuck Lever2007-08-241-5/+9
| | | | | | | | Defensive coding: getport() shouldn't alter the passed-in server address, but should treat it as read only. Have it operate on a copy. 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: Add new files for supporting string-ified mount optionsChuck Lever2007-08-113-2/+358
| | | | | | | | | | | | | | Introduce support files which contain code that builds string mount options and passes them to the kernel. This is a pre-requisite for actually enabling /sbin/mount.nfs to do text-based mounts. This is only partially complete at the moment, but is presented so that folks can start banging on the kernel mount option string parsing code. There are clearly still parts that are not implemented quite yet, such as bg and retry support, but it should be enough to get going. 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: Treat another UDP/TCP pair of strings like the restChuck Lever2007-08-111-1/+1
| | | | | | | See the error messages at the end of utils/mount/network.c:get_socket() Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: Update umount.nfs(8)Chuck Lever2007-08-101-4/+3
| | | | | | | Account for recent changes to the umount.nfs command. 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-102-21/+10
| | | | | | | 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-045-7/+9
| | | | | | | | 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: get_socket() may clobber errno, but preserves .re_errnoChuck Lever2007-08-041-12/+4
| | | | | | | | | | get_socket() guarantees that rpc_createerr.cf_error.re_errno is set correctly after an error, but it can wipe errno if it has to print an error message. Make sure that clnt_ping() checks the correct error code when get_socket() returns. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Always close the socket at the end of getport()Chuck Lever2007-08-041-5/+4
| | | | | | | | These days, none of get_socket()'s callers pass an RPC_ANYSOCK on to the RPC code. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Shorter timeout for TCP connectsChuck Lever2007-08-041-5/+59
| | | | | | | | | | | | | | | The standard TCP connect timeout on Linux is 75 seconds, which can be too long in some cases. The timeout itself can be altered on a system-wide basis, but we'd like mount to have it's own connect timeout that's tunable, and defaults to a shorter value. The get_socket() function is a utility function that does TCP connects for getport, clnt_ping, and other functions. Add logic there to use a non-blocking connect() and select() in order to time out a connect operation that's taking too long. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: Remove a redundant port assignmentChuck Lever2007-08-041-1/+0
| | | | | | | | getport() always fills in its port number before calling GETPORT. No need for the caller to do this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: umount needs to pick up transport option from /etc/mtabChuck Lever2007-08-041-0/+12
| | | | | | | | Now that umount's default transport protocol has become more flexible, it will need to detect both proto=udp and proto=tcp in /etc/mtab. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: fix printf's normally hidden behind NFS_MOUNT_DEBUGChuck Lever2007-08-042-20/+18
| | | | | | | | After I enabled NFS_MOUNT_DEBUG the compiler started spitting out warnings. Fix up commas, output formatting, and double-wide character support. 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-045-44/+54
| | | | | | | | | | | 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>
* Fix more 'prototype' warnings and other warnings.Neil Brown2007-07-301-1/+2
| | | | Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: clean up a couple of printfs in fstab.cChuck Lever2007-07-301-9/+12
| | | | | | | Clean up for consistent use. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: eliminate another dependency on a global variableChuck Lever2007-07-303-2/+587
| | | | | | | | | | | | | | The file support/nfs/fstab.c, which is linked into libnfs.a, depends on the global variable "verbose." This variable is defined and used only in the mount command, and the functions in fstab.c are used only by the mount command. Move fstab.c and support/include/fstab.h to utils/mount. This file placement is also consistent with at least one other mount helper, mount.ocfs2. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: eliminate conn.c and conn.hChuck Lever2007-07-305-5/+20
| | | | | | | conn.[ch] are now no longer needed. Clean them out and delete them. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: use nfs_error instead of fprintf in get_socket()Chuck Lever2007-07-301-47/+53
| | | | | | | | | Use nfs_error() where appropriate. I used "goto" here to reduce string splitting and indenting past the point of readability. Gee, it would be nice if C had proper exception handling... Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move get_socket() function to utils/mount/network.cChuck Lever2007-07-301-0/+73
| | | | | | | | | | Now we can address the real problem: that get_socket() depends on the global variable "verbose" which is only available in the mount command. Move get_socket() into utils/mount/network.c, and make it static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move clnt_ping() to utils/mountChuck Lever2007-07-303-0/+83
| | | | | | | | | | Continue clean up of mount functionality in libnfs.a by moving clnt_ping() to utils/mount/network.c. Note that socklen_t is an unsigned int... the i386 gcc compiler threw a signedness warning about the 3rd argument of getsockname(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move more mount-only functions out of libnfs.aChuck Lever2007-07-302-0/+36
| | | | | | | Continue clean-up with nfsvers_to_mnt() and mntvers_to_nfs(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* libnfs.a: move mnt_{open, close}clnt calls to utils/mount/network.cChuck Lever2007-07-302-0/+53
| | | | | | | | | | | | | | | | | It turns out that get_socket() accesses a global variable, "verbose," that is only available in the mount command; yet it's in libnfs.a. This creates an undocumented API dependency that will bite someone someday. This mount-specific functionality doesn't really belong in libnfs.a anyway. The simplest way to resolve this is to move all of the functions in support/nfs/conn.c into utils/mount. network.c seems like the logical place to put these. An added benefit is we eventually get to make get_socket() static. Let's start with the mnt_{open,close}clnt functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: clean up getport() functionChuck Lever2007-07-301-19/+28
| | | | | | | | Mostly comment clarification. Also replace some naked undocumented integers with macros, and make getport() static. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: fix hang when getport() uses TCP against unavailable serversChuck Lever2007-07-301-2/+17
| | | | | | | | | If get_socket() can't get us an open TCP socket, we know the server is down, so make getport() exit early instead of hanging. This logic is copied from clnt_ping(). 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-306-14/+2
| | | | | | | | 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: Pass return codes from do_nfs_umount backChuck Lever2007-07-301-3/+4
| | | | | | | Do we really care about these return codes? Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: Make do_nfs_mount use conventional EX_ style return codesChuck Lever2007-07-301-12/+26
| | | | | | | | | do_nfs_mount() should return EX_ style return codes and not 1 or 0 in order to distinguish between usage errors and other problems (such as EX_FILEIO or RPC errors). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: make _nfsumount() staticChuck Lever2007-07-301-3/+3
| | | | | | | | | | | _nfsumount() is never called outside of nfsumount.c. Also give it a more conventional name. Note that it's return code is ignored. That will be addressed in a subsequent patch. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: make del_mtab() a static functionChuck Lever2007-07-301-1/+1
| | | | | | | Clean-up: del_mtab() isn't used outside of nfsumount.c. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* Make sure nfs_call_umount's callers are handling its return code correctlyChuck Lever2007-07-301-7/+20
| | | | | | | | umount.nfs is treating nfs_call_umount's return code like a standard mount return code (EX_SOMETHING) when its really an RPC return code. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: move nfs_call_umount to network.cChuck Lever2007-07-304-44/+36
| | | | | | | | | nfs_call_umount() is shared by nfsmount.c and nfsumount.c, and manages a network function (building the RPC umount call to the server's MNT daemon). So move it to network.c with other network-related functions. 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-303-8/+7
| | | | | | | 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>
* umount.nfs: make umount.nfs use UDP by defaultChuck Lever2007-07-301-1/+0
| | | | | | | | mount.nfs currently uses UDP by default when calling a MNT server. Make umount.nfs do the same. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* umount.nfs: some umount.nfs error return codes are confusingChuck Lever2007-07-301-5/+5
| | | | | | | | | | umount.nfs should return the standard EX_ mount return codes. At some point in the past, it was returning 0 for failure and 1 for success, and some of these have been changed and some haven't. See if we can rectify this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Neil Brown <neilb@suse.de>
* mount.nfs: fix more nits with error messagesChuck Lever2007-07-303-11/+16
| | | | | | | Catch-all. 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-294-4/+4
|