summaryrefslogtreecommitdiffstats
path: root/mount
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:46 +0100
committerKarel Zak2006-12-07 00:25:46 +0100
commitc07ebfa1e02d208ab12430e6791ea147bcfaf9c0 (patch)
treed44a755098286f5d553c7aea1a73d98c2995d6ec /mount
parentImported from util-linux-2.10s tarball. (diff)
downloadkernel-qcow2-util-linux-c07ebfa1e02d208ab12430e6791ea147bcfaf9c0.tar.gz
kernel-qcow2-util-linux-c07ebfa1e02d208ab12430e6791ea147bcfaf9c0.tar.xz
kernel-qcow2-util-linux-c07ebfa1e02d208ab12430e6791ea147bcfaf9c0.zip
Imported from util-linux-2.11b tarball.
Diffstat (limited to 'mount')
-rw-r--r--mount/Makefile10
-rw-r--r--mount/fstab.510
-rw-r--r--mount/fstab.c12
-rw-r--r--mount/lomount.c11
-rw-r--r--mount/mntent.c2
-rw-r--r--mount/mount.8130
-rw-r--r--mount/mount.c31
-rw-r--r--mount/mount_by_label.c2
-rw-r--r--mount/mount_constants.h9
-rw-r--r--mount/mount_guess_fstype.c91
-rw-r--r--mount/mount_guess_rootdev.c2
-rw-r--r--mount/nfs.53
-rw-r--r--mount/nfsmount.c256
-rw-r--r--mount/sundries.c2
-rw-r--r--mount/swapon.c2
-rw-r--r--mount/umount.c4
16 files changed, 367 insertions, 210 deletions
diff --git a/mount/Makefile b/mount/Makefile
index 18e30cde6..ef65601f7 100644
--- a/mount/Makefile
+++ b/mount/Makefile
@@ -24,14 +24,10 @@ PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
MAYBE = pivot_root swapoff
-# comment these out if you are not compiling in NFS support
+LO_OBJS = lomount.o $(LIB)/xstrncpy.o
NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
-# uncomment this if you don't have libc-4.2 but do have the rpclib
GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
-# comment these out if you are not compiling in loop support
-LO_OBJS=lomount.o
-
all: $(PROGS)
install: $(PROGS)
@@ -58,10 +54,10 @@ umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
swapon: swapon.o version.o
$(LINK) $^ -o $@
-losetup.o: lomount.c
+main_losetup.o: lomount.c
$(COMPILE) -DMAIN lomount.c -o $@
-losetup: losetup.o
+losetup: main_losetup.o $(LIB)/xstrncpy.o
$(LINK) $^ -o $@
mount.o umount.o nfsmount.o losetup.o fstab.o realpath.o sundries.o: sundries.h
diff --git a/mount/fstab.5 b/mount/fstab.5
index 6d7638e4a..608f81d82 100644
--- a/mount/fstab.5
+++ b/mount/fstab.5
@@ -76,9 +76,11 @@ For NFS mounts one will have <host>:<dir>, e.g., `knuth.aeb.nl:/'.
For procfs, use `proc'.
.LP
Instead of giving the device explicitly, one may indicate
-the (ext2) filesystem that is to be mounted by its UUID or
+the (ext2 or XFS) filesystem that is to be mounted by its UUID or
volume label (cf.
-.BR e2label (8)),
+.BR e2label (8)
+or
+.BR xfs_admin (8)),
writing LABEL=<label> or UUID=<uuid>,
e.g., `LABEL=Boot' or `UUID=3e6be9de\%-8139\%-11d1\%-9106\%-a43f08d823a6'.
This will make the system more robust: adding or removing a SCSI disk
@@ -113,6 +115,10 @@ features.
a local filesystem with longer filenames, larger inodes, and lots of other
features.
.TP
+.I xfs
+a local filesystem with journaling, scalability and lots of other
+features.
+.TP
.I msdos
a local filesystem for MS-DOS partitions.
.TP
diff --git a/mount/fstab.c b/mount/fstab.c
index 3ee1f36a1..9329d1ce6 100644
--- a/mount/fstab.c
+++ b/mount/fstab.c
@@ -1,4 +1,4 @@
-/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@@ -538,6 +538,16 @@ update_mtab (const char *dir, struct mntent *instead) {
}
my_endmntent (mftmp);
+ { /*
+ * If mount is setuid and some non-root user mounts sth,
+ * then mtab.tmp might get the group of this user. Copy uid/gid
+ * from the present mtab before renaming.
+ */
+ struct stat sbuf;
+ if (stat (MOUNTED, &sbuf) == 0)
+ chown (MOUNTED_TEMP, sbuf.st_uid, sbuf.st_gid);
+ }
+
/* rename mtemp to mtab */
if (rename (MOUNTED_TEMP, MOUNTED) < 0) {
int errsv = errno;
diff --git a/mount/lomount.c b/mount/lomount.c
index cabc44461..26e895018 100644
--- a/mount/lomount.c
+++ b/mount/lomount.c
@@ -2,7 +2,7 @@
/* Added vfs mount options - aeb - 960223 */
/* Removed lomount - aeb - 960224 */
-/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@@ -27,6 +27,7 @@
#include "loop.h"
#include "lomount.h"
+#include "xstrncpy.h"
#include "nls.h"
extern int verbose;
@@ -217,8 +218,7 @@ set_loop (const char *device, const char *file, int offset,
*loopro = (mode == O_RDONLY);
memset (&loopinfo, 0, sizeof (loopinfo));
- strncpy (loopinfo.lo_name, file, LO_NAME_SIZE);
- loopinfo.lo_name[LO_NAME_SIZE - 1] = 0;
+ xstrncpy (loopinfo.lo_name, file, LO_NAME_SIZE);
if (encryption && (loopinfo.lo_encrypt_type = crypt_type (encryption))
< 0) {
fprintf (stderr, _("Unsupported encryption type %s\n"),
@@ -233,7 +233,7 @@ set_loop (const char *device, const char *file, int offset,
* passwd etc being swapped out and left somewhere on disk.
*/
- if(mlockall(MCL_CURRENT|MCL_FUTURE)) {
+ if(mlockall(MCL_CURRENT | MCL_FUTURE)) {
perror("memlock");
fprintf(stderr, _("Couldn't lock into memory, exiting.\n"));
exit(1);
@@ -246,8 +246,7 @@ set_loop (const char *device, const char *file, int offset,
break;
case LO_CRYPT_XOR:
pass = getpass (_("Password: "));
- strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
- loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0;
+ xstrncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
break;
case LO_CRYPT_DES:
diff --git a/mount/mntent.c b/mount/mntent.c
index d28171b98..a9a334fed 100644
--- a/mount/mntent.c
+++ b/mount/mntent.c
@@ -1,7 +1,7 @@
/* Private version of the libc *mntent() routines. */
/* Note slightly different prototypes. */
-/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+/* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*/
diff --git a/mount/mount.8 b/mount/mount.8
index f90341198..42a7a4a72 100644
--- a/mount/mount.8
+++ b/mount/mount.8
@@ -95,7 +95,7 @@ prints a version string; and just
.RE
lists all mounted file systems (of type
.IR type ).
-The option \-l adds the (ext2) labels in this listing.
+The option \-l adds the (ext2 and XFS) labels in this listing.
See below.
.\" In fact since 2.3.99. At first the syntax was mount -t bind.
@@ -280,12 +280,12 @@ command is trying to do. It can also be used to add entries for devices
that were mounted earlier with the -n option.
.TP
.B \-l
-Add the ext2 labels in the mount output. Mount must have permission to
+Add the ext2 and XFS labels in the mount output. Mount must have permission to
read the disk device (e.g. be suid root) for this to work.
-One can set such a label
-using the
+One can set such a label for ext2 using the
.BR e2label (8)
-utility.
+utility, or for XFS using
+.BR xfs_admin (8).
.TP
.B \-n
Mount without writing in
@@ -323,13 +323,13 @@ These two options require the file
The argument following the
.B \-t
is used to indicate the file system type. The file system types which are
-currently supported are listed in
-.IR linux/fs/filesystems.c :
+currently supported are:
.IR adfs ,
.IR affs ,
.IR autofs ,
.IR coda ,
.IR coherent ,
+.IR cramfs ,
.IR devpts ,
.IR efs ,
.IR ext ,
@@ -352,6 +352,7 @@ currently supported are listed in
.IR umsdos ,
.IR vfat ,
.IR xenix ,
+.IR xfs ,
.IR xiafs .
Note that coherent, sysv and xenix are equivalent and that
.I xenix
@@ -391,7 +392,8 @@ option is given, or if the
.B auto
type is specified, the superblock is probed for the filesystem type
.RI ( minix ", " ext ", " ext2 ", " xiafs ", " iso9660 ", " romfs
-.RI , ufs ", " ntfs ", " qnx4 ", " bfs
+.RI , ufs ", " ntfs ", " qnx4 ", " bfs ", " xfs ", " cramfs ", " hfs
+.RI , hpfs ", " adfs
are supported).
If this probe fails, mount will try to read the file
.IR /etc/filesystems ,
@@ -494,7 +496,7 @@ This is the default.
.B remount
Attempt to remount an already-mounted file system. This is commonly
used to change the mount flags for a file system, especially to make a
-readonly file system writeable.
+readonly file system writeable. It does not change device or mount point.
.TP
.B ro
Mount the file system read-only.
@@ -522,7 +524,16 @@ The following options apply only to certain file systems.
We sort them by file system. They all follow the
.B \-o
flag.
-
+.SH "Mount options for adfs"
+.TP
+\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
+Set the owner and group of the files in the file system (default: uid=gid=0).
+.TP
+\fBownmask=\fP\fIvalue\fP and \fBothmask=\fP\fIvalue\fP
+Set the permission mask for ADFS 'owner' permissions and 'other' permissions,
+respectively (default: 0700 and 0077, respectively).
+See also
+.IR /usr/src/linux/Documentation/filesystems/adfs.txt .
.SH "Mount options for affs"
.TP
\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
@@ -863,6 +874,7 @@ that it is read-only, of course).
.B norock
Disable the use of Rock Ridge extensions, even if available. Cf.\&
.BR map .
+.TP
.B nojoliet
Disable the use of Microsoft Joliet extensions, even if available. Cf.\&
.BR map .
@@ -1218,6 +1230,102 @@ If `uni_xlate' gets set, UTF8 gets disabled.
.SH "Mount options for xenix"
None.
+.SH "Mount options for xfs"
+.TP
+.BI biosize= size
+Sets the preferred buffered I/O size (default size is 64K).
+.I size
+must be expressed as the logarithm (base2) of the desired I/O size.
+Valid values for this option are 14 through 16, inclusive
+(i.e. 16K, 32K, and 64K bytes).
+On machines with a 4K pagesize, 13 (8K bytes) is also a valid
+.IR size .
+The preferred buffered I/O size can also be altered on an individual
+file basis using the
+.BR ioctl (2)
+system call.
+.TP
+.B dmapi " / " xdsm
+Enable the DMAPI (Data Management API) event callouts.
+.TP
+.BI logbufs= value
+Set the number of in-memory log buffers.
+Valid numbers range from 2-8 inclusive.
+The default value is 8 buffers for filesystems with a blocksize of 64K,
+4 buffers for filesystems with a blocksize of 32K,
+3 buffers for filesystems with a blocksize of 16K,
+and 2 buffers for all other configurations.
+Increasing the number of buffers may increase performance on
+some workloads at the cost of the memory used for the
+additional log buffers and their associated control structures.
+.TP
+.BI logbsize= value
+Set the size of each in-memory log buffer.
+Valid sizes are 16384 (16K) and 32768 (32K).
+The default value for machines with more than 32MB of memory is 32768,
+machines with less memory use 16384 by default.
+.TP
+\fBlogdev=\fP\fIdevice\fP and \fBrtdev=\fP\fIdevice\fP
+Use an external log (metadata journal) and/or real-time device.
+An XFS filesystem has up to three parts: a data section, a log section,
+and a real-time section.
+The real-time section is optional, and the log section can be separate
+from the data section or contained within it.
+Refer to
+.BR xfs (5).
+.TP
+.B noalign
+Data allocations will not be aligned at stripe unit boundaries.
+.TP
+.B noatime
+Access timestamps are not updated when a file is read.
+.TP
+.B norecovery
+The filesystem will be mounted without running log recovery.
+If the filesystem was not cleanly unmounted, it is likely to
+be inconsistent when mounted in
+.B norecovery
+mode.
+Some files or directories may not be accessible because of this.
+Filesystems mounted
+.B norecovery
+must be mounted read-only or the mount will fail.
+.TP
+.B osyncisdsync
+Make writes to files opened with the O_SYNC flag set behave
+as if the O_DSYNC flag had been used instead.
+This can result in better performance without compromising
+data safety.
+However if this option is in effect, timestamp updates from
+O_SYNC writes can be lost if the system crashes.
+.TP
+.BR quota " / " usrquota " / " uqnoenforce
+User disk quota accounting enabled, and limits (optionally) enforced.
+.TP
+.BR grpquota " / " gqnoenforce
+Group disk quota accounting enabled and limits (optionally) enforced.
+.TP
+\fBsunit=\fP\fIvalue\fP and \fBswidth=\fP\fIvalue\fP
+Used to specify the stripe unit and width for a RAID device or a stripe
+volume.
+.I value
+must be specified in 512-byte block units.
+If this option is not specified and the filesystem was made on a stripe
+volume or the stripe width or unit were specified for the RAID device at
+mkfs time, then the mount system call will restore the value from the
+superblock.
+For filesystems that are made directly on RAID devices, these options can be
+used to override the information in the superblock if the underlying disk
+layout changes after the filesystem has been created.
+The
+.B swidth
+option is required if the
+.B sunit
+option has been specified,
+and must be a multiple of the
+.B sunit
+value.
+
.SH "Mount options for xiafs"
None. Although nothing is wrong with xiafs, it is not used much,
and is not maintained. Probably one shouldn't use it.
@@ -1275,7 +1383,9 @@ temporary file
.BR umount (8),
.BR swapon (8),
.BR nfs (5),
+.BR xfs (5),
.BR e2label (8),
+.BR xfs_admin (8),
.BR mountd (8),
.BR nfsd (8),
.BR mke2fs (8),
diff --git a/mount/mount.c b/mount/mount.c
index 39ccd3e63..dc7e9823f 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -26,7 +26,7 @@
* Improve support for noncanonical names in /etc/fstab.
* Add support for volume labels and UUIDs.
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 1999-03-21 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
@@ -101,10 +101,7 @@ static int optfork = 0;
/* Add volumelabel in a listing of mounted devices (-l). */
static int list_with_volumelabel = 0;
-/* Nonzero for mount --bind */
-static int bind = 0;
-
-/* Nonzero for mount {--replace|--before|--after|--over} */
+/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move} */
static int mounttype = 0;
/* True if ruid != euid. */
@@ -341,8 +338,6 @@ parse_opts (char *opts, int *flags, char **extra_opts) {
if (readwrite)
*flags &= ~MS_RDONLY;
*flags |= mounttype;
- if (bind)
- *flags |= MS_BIND;
}
/* Try to build a canonical options string. */
@@ -466,7 +461,7 @@ guess_fstype_and_mount (char *spec, char *node, char **type,
if (*type && strcasecmp (*type, "auto") == 0)
*type = NULL;
- if (!*type && (flags & MS_BIND))
+ if (!*type && (flags & (MS_BIND | MS_MOVE)))
*type = "none"; /* random, but not "bind" */
if (!*type && !(flags & MS_REMOUNT)) {
@@ -1092,7 +1087,7 @@ mount_one (const char *spec, const char *node, char *type, const char *opts,
/* if -a then we may be rescued by a noauto option */
}
- if (type == NULL && !bind) {
+ if (type == NULL && !mounttype) {
if (strchr (spec, ':') != NULL) {
type = "nfs";
if (verbose)
@@ -1292,6 +1287,7 @@ static struct option longopts[] = {
{ "after", 0, 0, 130 },
{ "before", 0, 0, 131 },
{ "over", 0, 0, 132 },
+ { "move", 0, 0, 133 },
{ NULL, 0, 0, 0 }
};
@@ -1317,11 +1313,13 @@ usage (FILE *fp, int n) {
" mount --bind olddir newdir\n"
"A device can be given by name, say /dev/hda1 or /dev/cdrom,\n"
"or by label, using -L label or by uuid, using -U uuid .\n"
- "Union or stack mounts are specified using one of\n"
- " --replace, --after, --before, --over\n"
"Other options: [-nfFrsvw] [-o options].\n"
"For many more details, say man 8 mount .\n"
));
+/*
+ "Union or stack mounts are specified using one of\n"
+ " --replace, --after, --before, --over\n"
+*/
unlock_mtab();
exit (n);
}
@@ -1408,7 +1406,7 @@ main (int argc, char *argv[]) {
break;
case 128: /* bind */
- ++bind;
+ mounttype = MS_BIND;
break;
case 129: /* replace */
mounttype = MS_REPLACE;
@@ -1422,6 +1420,9 @@ main (int argc, char *argv[]) {
case 132: /* over */
mounttype = MS_OVER;
break;
+ case 133: /* move */
+ mounttype = MS_MOVE;
+ break;
case '?':
default:
@@ -1435,15 +1436,15 @@ main (int argc, char *argv[]) {
specseen = (uuid || volumelabel) ? 1 : 0; /* yes, .. i know */
if (argc+specseen == 0 && !all) {
- if (options || mounttype || bind)
+ if (options || mounttype)
usage (stderr, EX_USAGE);
return print_all (types);
}
if (getuid () != geteuid ()) {
suid = 1;
- if (types || options || readwrite || nomtab || all || fake ||
- bind || mounttype || (argc + specseen) != 1)
+ if (types || options || readwrite || nomtab || all ||
+ fake || mounttype || (argc + specseen) != 1)
die (EX_USAGE, _("mount: only root can do that"));
}
diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c
index e24d880d2..ad3b5ebd2 100644
--- a/mount/mount_by_label.c
+++ b/mount/mount_by_label.c
@@ -1,7 +1,7 @@
/*
* mount_by_label.c - aeb
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* 2000-01-20 James Antill <james@and.org>
* - Added error message if /proc/partitions cannot be opened
diff --git a/mount/mount_constants.h b/mount/mount_constants.h
index 5fd290829..cdbced881 100644
--- a/mount/mount_constants.h
+++ b/mount/mount_constants.h
@@ -36,13 +36,16 @@ if we have a stack or plain mount - mount atop of it, forming a stack. */
#define MS_OVER 0x200 /* 512 */
#endif
#ifndef MS_NOATIME
-#define MS_NOATIME 1024 /* Do not update access times. */
+#define MS_NOATIME 0x400 /* 1024: Do not update access times. */
#endif
#ifndef MS_NODIRATIME
-#define MS_NODIRATIME 2048 /* Do not update directory access times */
+#define MS_NODIRATIME 0x800 /* 2048: Don't update directory access times */
#endif
#ifndef MS_BIND
-#define MS_BIND 4096
+#define MS_BIND 0x1000 /* 4096: Mount existing tree also elsewhere */
+#endif
+#ifndef MS_MOVE
+#define MS_MOVE 0x2000 /* 8192: Atomically move tree */
#endif
/*
* Magic mount flag number. Has to be or-ed to the flag values.
diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c
index 5a3733f98..a87409295 100644
--- a/mount/mount_guess_fstype.c
+++ b/mount/mount_guess_fstype.c
@@ -17,7 +17,7 @@
* detect *fat and then assume vfat, so perhaps /etc/filesystems isnt
* so useful anymore.]
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* Fri Dec 1 23:31:00 2000: Sepp Wijnands <mrrazz@garbage-coderz.net>
@@ -175,6 +175,9 @@ fstype(const char *device) {
|| read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb))
goto io_error;
+ /* ext2 has magic in little-endian on disk, so "swapped" is
+ superfluous; however, there have existed strange byteswapped
+ PPC ext2 systems */
if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC
|| ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC
|| ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC))
@@ -365,39 +368,55 @@ is_in_procfs(const char *type) {
int
procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args,
char **type) {
- FILE *procfs;
- char *fsname;
- int ret = 1;
- int errsv = 0;
-
- *type = NULL;
-
- procfs = fopen(ETC_FILESYSTEMS, "r");
- if (!procfs) {
- procfs = fopen(PROC_FILESYSTEMS, "r");
- if (!procfs)
- return 1;
- }
- while ((fsname = procfsnext(procfs)) != NULL) {
- if (tested (fsname))
- continue;
- args->type = fsname;
- if (verbose) {
- printf(_("Trying %s\n"), fsname);
- fflush(stdout);
- }
- if ((*mount_fn) (args) == 0) {
- *type = fsname;
- ret = 0;
- break;
- } else if (errno != EINVAL && is_in_procfs(fsname) == 1) {
- *type = "guess";
- ret = -1;
- errsv = errno;
- break;
- }
- }
- fclose(procfs);
- errno = errsv;
- return ret;
+ char *files[2] = { ETC_FILESYSTEMS, PROC_FILESYSTEMS };
+ FILE *procfs;
+ char *fsname;
+ int ret = 1;
+ int errsv = 0;
+ int i;
+
+ *type = NULL;
+
+ /* Use PROC_FILESYSTEMS only when ETC_FILESYSTEMS does not exist.
+ In some cases trying a filesystem that the kernel knows about
+ on the wrong data will crash the kernel; in such cases
+ ETC_FILESYSTEMS can be used to list the filesystems that we
+ are allowed to try, and in the order they should be tried.
+ End ETC_FILESYSTEMS with a line containing a single '*' only,
+ if PROC_FILESYSTEMS should be tried afterwards. */
+
+ for (i=0; i<2; i++) {
+ procfs = fopen(files[i], "r");
+ if (!procfs)
+ continue;
+ while ((fsname = procfsnext(procfs)) != NULL) {
+ if (!strcmp(fsname, "*")) {
+ fclose(procfs);
+ goto nexti;
+ }
+ if (tested (fsname))
+ continue;
+ args->type = fsname;
+ if (verbose) {
+ printf(_("Trying %s\n"), fsname);
+ fflush(stdout);
+ }
+ if ((*mount_fn) (args) == 0) {
+ *type = fsname;
+ ret = 0;
+ break;
+ } else if (errno != EINVAL &&
+ is_in_procfs(fsname) == 1) {
+ *type = "guess";
+ ret = -1;
+ errsv = errno;
+ break;
+ }
+ }
+ fclose(procfs);
+ errno = errsv;
+ return ret;
+ nexti:;
+ }
+ return 1;
}
diff --git a/mount/mount_guess_rootdev.c b/mount/mount_guess_rootdev.c
index 072c09fc4..7246d319a 100644
--- a/mount/mount_guess_rootdev.c
+++ b/mount/mount_guess_rootdev.c
@@ -25,7 +25,7 @@ rootdev(char *p) {
char *type = "hd";
char let;
int ma, mi;
- char devname[8];
+ char devname[32];
devno = strtoul(p, &ep, 16);
if ((ep == p+3 || ep == p+4) && (*ep == ' ' || *ep == 0)) {
diff --git a/mount/nfs.5 b/mount/nfs.5
index 59f199b2b..6ffce6cdf 100644
--- a/mount/nfs.5
+++ b/mount/nfs.5
@@ -192,6 +192,9 @@ server performance penalty but it allows two different NFS clients
to get reasonable good results when both clients are actively
writing to common filesystem on the server.
.TP 1.5i
+.I nolock
+Do not use locking. Do not start lockd.
+.TP 1.5i
.I tcp
Mount the NFS filesystem using the TCP protocol instead of the
default UDP protocol. Many NFS severs only support UDP.
diff --git a/mount/nfsmount.c b/mount/nfsmount.c
index 6fc917db5..70298e0c6 100644
--- a/mount/nfsmount.c
+++ b/mount/nfsmount.c
@@ -21,7 +21,7 @@
* Wed Oct 1 23:55:28 1997: Dick Streefland <dick_streefland@tasking.com>
* Implemented the "bg", "fg" and "retry" mount options for NFS.
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
* Modified by Olaf Kirch and Trond Myklebust for new NFS code,
@@ -132,45 +132,45 @@ get_mountport(struct sockaddr_in *server_addr,
long unsigned proto,
long unsigned port)
{
-struct pmaplist *pmap;
-static struct pmap p = {0, 0, 0, 0};
-
-server_addr->sin_port = PMAPPORT;
-pmap = pmap_getmaps(server_addr);
-
-if (version > MAX_NFSPROT)
- version = MAX_NFSPROT;
-if (!prog)
- prog = MOUNTPROG;
-p.pm_prog = prog;
-p.pm_vers = version;
-p.pm_prot = proto;
-p.pm_port = port;
-
-while (pmap) {
- if (pmap->pml_map.pm_prog != prog)
- goto next;
- if (!version && p.pm_vers > pmap->pml_map.pm_vers)
- goto next;
- if (version > 2 && pmap->pml_map.pm_vers != version)
- goto next;
- if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
- goto next;
- if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
- (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
- (port && pmap->pml_map.pm_port != port))
- goto next;
- memcpy(&p, &pmap->pml_map, sizeof(p));
-next:
- pmap = pmap->pml_next;
-}
-if (!p.pm_vers)
- p.pm_vers = MOUNTVERS;
-if (!p.pm_port)
- p.pm_port = MOUNTPORT;
-if (!p.pm_prot)
- p.pm_prot = IPPROTO_TCP;
-return &p;
+ struct pmaplist *pmap;
+ static struct pmap p = {0, 0, 0, 0};
+
+ server_addr->sin_port = PMAPPORT;
+ pmap = pmap_getmaps(server_addr);
+
+ if (version > MAX_NFSPROT)
+ version = MAX_NFSPROT;
+ if (!prog)
+ prog = MOUNTPROG;
+ p.pm_prog = prog;
+ p.pm_vers = version;
+ p.pm_prot = proto;
+ p.pm_port = port;
+
+ while (pmap) {
+ if (pmap->pml_map.pm_prog != prog)
+ goto next;
+ if (!version && p.pm_vers > pmap->pml_map.pm_vers)
+ goto next;
+ if (version > 2 && pmap->pml_map.pm_vers != version)
+ goto next;
+ if (version && version <= 2 && pmap->pml_map.pm_vers > 2)
+ goto next;
+ if (pmap->pml_map.pm_vers > MAX_NFSPROT ||
+ (proto && p.pm_prot && pmap->pml_map.pm_prot != proto) ||
+ (port && pmap->pml_map.pm_port != port))
+ goto next;
+ memcpy(&p, &pmap->pml_map, sizeof(p));
+ next:
+ pmap = pmap->pml_next;
+ }
+ if (!p.pm_vers)
+ p.pm_vers = MOUNTVERS;
+ if (!p.pm_port)
+ p.pm_port = MOUNTPORT;
+ if (!p.pm_prot)
+ p.pm_prot = IPPROTO_TCP;
+ return &p;
}
int nfsmount(const char *spec, const char *node, int *flags,
@@ -230,7 +230,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
mclient = NULL;
if (strlen(spec) >= sizeof(hostdir)) {
fprintf(stderr, _("mount: "
- "excessively long host:dir argument\n"));
+ "excessively long host:dir argument\n"));
goto fail;
}
strcpy(hostdir, spec);
@@ -243,11 +243,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
if ((s = strchr(hostdir, ','))) {
*s = '\0';
fprintf(stderr, _("mount: warning: "
- "multiple hostnames not supported\n"));
+ "multiple hostnames not supported\n"));
}
} else {
fprintf(stderr, _("mount: "
- "directory to mount not in host:dir format\n"));
+ "directory to mount not in host:dir format\n"));
goto fail;
}
@@ -281,7 +281,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
fprintf(stderr, _("mount: "
- "excessively long option argument\n"));
+ "excessively long option argument\n"));
goto fail;
}
sprintf(new_opts, "%s%saddr=%s",
@@ -356,7 +356,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
mountport = val;
else if (!strcmp(opt, "mounthost"))
mounthost=xstrndup(opteq+1,
- strcspn(opteq+1," \t\n\r,"));
+ strcspn(opteq+1," \t\n\r,"));
else if (!strcmp(opt, "mountprog"))
mountprog = val;
else if (!strcmp(opt, "mountvers"))
@@ -379,12 +379,12 @@ int nfsmount(const char *spec, const char *node, int *flags,
data.namlen = val;
else
#endif
- printf(_("Warning: Option namlen is not supported.\n"));
+ printf(_("Warning: Option namlen is not supported.\n"));
} else if (!strcmp(opt, "addr"))
/* ignore */;
else {
printf(_("unknown nfs mount parameter: "
- "%s=%d\n"), opt, val);
+ "%s=%d\n"), opt, val);
goto fail;
}
}
@@ -424,7 +424,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
} else {
if (!sloppy) {
printf(_("unknown nfs mount option: "
- "%s%s\n"), val ? "" : "no", opt);
+ "%s%s\n"), val ? "" : "no", opt);
goto fail;
}
}
@@ -469,22 +469,22 @@ int nfsmount(const char *spec, const char *node, int *flags,
#ifdef NFS_MOUNT_DEBUG
printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
- data.rsize, data.wsize, data.timeo, data.retrans);
+ data.rsize, data.wsize, data.timeo, data.retrans);
printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
- data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
+ data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
- port, bg, retry, data.flags);
+ port, bg, retry, data.flags);
printf("mountprog = %d, mountvers = %d, nfsprog = %d, nfsvers = %d\n",
- mountprog, mountvers, nfsprog, nfsvers);
+ mountprog, mountvers, nfsprog, nfsvers);
printf("soft = %d, intr = %d, posix = %d, nocto = %d, noac = %d\n",
- (data.flags & NFS_MOUNT_SOFT) != 0,
- (data.flags & NFS_MOUNT_INTR) != 0,
- (data.flags & NFS_MOUNT_POSIX) != 0,
- (data.flags & NFS_MOUNT_NOCTO) != 0,
- (data.flags & NFS_MOUNT_NOAC) != 0);
+ (data.flags & NFS_MOUNT_SOFT) != 0,
+ (data.flags & NFS_MOUNT_INTR) != 0,
+ (data.flags & NFS_MOUNT_POSIX) != 0,
+ (data.flags & NFS_MOUNT_NOCTO) != 0,
+ (data.flags & NFS_MOUNT_NOAC) != 0);
#if NFS_MOUNT_VERSION >= 2
printf("tcp = %d\n",
- (data.flags & NFS_MOUNT_TCP) != 0);
+ (data.flags & NFS_MOUNT_TCP) != 0);
#endif
#endif
@@ -509,25 +509,25 @@ int nfsmount(const char *spec, const char *node, int *flags,
/* create mount deamon client */
/* See if the nfs host = mount host. */
if (mounthost) {
- if (mounthost[0] >= '0' && mounthost[0] <= '9') {
- mount_server_addr.sin_family = AF_INET;
- mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
- } else {
- if ((hp = gethostbyname(mounthost)) == NULL) {
- fprintf(stderr, _("mount: can't get address for %s\n"),
- hostname);
- goto fail;
- } else {
- if (hp->h_length > sizeof(struct in_addr)) {
- fprintf(stderr,
- _("mount: got bad hp->h_length?\n"));
- hp->h_length = sizeof(struct in_addr);
- }
- mount_server_addr.sin_family = AF_INET;
- memcpy(&mount_server_addr.sin_addr,
- hp->h_addr, hp->h_length);
- }
- }
+ if (mounthost[0] >= '0' && mounthost[0] <= '9') {
+ mount_server_addr.sin_family = AF_INET;
+ mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
+ } else {
+ if ((hp = gethostbyname(mounthost)) == NULL) {
+ fprintf(stderr, _("mount: can't get address for %s\n"),
+ hostname);
+ goto fail;
+ } else {
+ if (hp->h_length > sizeof(struct in_addr)) {
+ fprintf(stderr,
+ _("mount: got bad hp->h_length?\n"));
+ hp->h_length = sizeof(struct in_addr);
+ }
+ mount_server_addr.sin_family = AF_INET;
+ memcpy(&mount_server_addr.sin_addr,
+ hp->h_addr, hp->h_length);
+ }
+ }
}
/*
@@ -554,8 +554,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
prevt = 0;
t = 30;
val = 1;
+
for (;;) {
if (bg && stat(node, &statbuf) == -1) {
+ /* no mount point yet - sleep */
if (running_bg) {
sleep(val); /* 1, 2, 4, 8, 16, 30, ... */
val *= 2;
@@ -568,10 +570,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
sleep(30);
pm_mnt = get_mountport(&mount_server_addr,
- mountprog,
- mountvers,
- proto,
- mountport);
+ mountprog,
+ mountvers,
+ proto,
+ mountport);
/* contact the mount daemon via TCP */
mount_server_addr.sin_port = htons(pm_mnt->pm_port);
@@ -580,53 +582,60 @@ int nfsmount(const char *spec, const char *node, int *flags,
switch (pm_mnt->pm_prot) {
case IPPROTO_UDP:
mclient = clntudp_create(&mount_server_addr,
- pm_mnt->pm_prog,
- pm_mnt->pm_vers,
- retry_timeout,
- &msock);
- if (mclient)
- break;
- mount_server_addr.sin_port = htons(pm_mnt->pm_port);
- msock = RPC_ANYSOCK;
- case IPPROTO_TCP:
- mclient = clnttcp_create(&mount_server_addr,
- pm_mnt->pm_prog,
- pm_mnt->pm_vers,
- &msock, 0, 0);
- break;
- default:
- mclient = 0;
+ pm_mnt->pm_prog,
+ pm_mnt->pm_vers,
+ retry_timeout,
+ &msock);
+ if (mclient)
+ break;
+ mount_server_addr.sin_port = htons(pm_mnt->pm_port);
+ msock = RPC_ANYSOCK;
+ case IPPROTO_TCP:
+ mclient = clnttcp_create(&mount_server_addr,
+ pm_mnt->pm_prog,
+ pm_mnt->pm_vers,
+ &msock, 0, 0);
+ break;
+ default:
+ mclient = 0;
}
+
if (mclient) {
/* try to mount hostname:dirname */
mclient->cl_auth = authunix_create_default();
- /* make pointers in xdr_mountres3 NULL so
- * that xdr_array allocates memory for us
- */
- memset(&status, 0, sizeof(status));
-
- if (pm_mnt->pm_vers == 3)
- clnt_stat = clnt_call(mclient, MOUNTPROC3_MNT,
- (xdrproc_t) xdr_dirpath,
- (caddr_t) &dirname,
- (xdrproc_t) xdr_mountres3,
- (caddr_t) &status,
- total_timeout);
- else
- clnt_stat = clnt_call(mclient, MOUNTPROC_MNT,
- (xdrproc_t) xdr_dirpath,
- (caddr_t) &dirname,
- (xdrproc_t) xdr_fhstatus,
- (caddr_t) &status,
- total_timeout);
+ /* make pointers in xdr_mountres3 NULL so
+ * that xdr_array allocates memory for us
+ */
+ memset(&status, 0, sizeof(status));
+
+ if (pm_mnt->pm_vers == 3)
+ clnt_stat = clnt_call(mclient,
+ MOUNTPROC3_MNT,
+ (xdrproc_t) xdr_dirpath,
+ (caddr_t) &dirname,
+ (xdrproc_t) xdr_mountres3,
+ (caddr_t) &status,
+ total_timeout);
+ else
+ clnt_stat = clnt_call(mclient,
+ MOUNTPROC_MNT,
+ (xdrproc_t) xdr_dirpath,
+ (caddr_t) &dirname,
+ (xdrproc_t) xdr_fhstatus,
+ (caddr_t) &status,
+ total_timeout);
if (clnt_stat == RPC_SUCCESS)
break; /* we're done */
+#if 0
+ /* errno? who sets errno? */
+ /* this fragment breaks bg mounting */
if (errno != ECONNREFUSED) {
clnt_perror(mclient, "mount");
goto fail; /* don't retry */
}
+#endif
if (!running_bg && prevt == 0)
clnt_perror(mclient, "mount");
auth_destroy(mclient->cl_auth);
@@ -639,6 +648,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
}
prevt = t;
}
+
if (!bg)
goto fail;
if (!running_bg) {
@@ -713,7 +723,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (port == 0) {
server_addr.sin_port = PMAPPORT;
port = pmap_getport(&server_addr, nfsprog, nfsvers,
- tcp ? IPPROTO_TCP : IPPROTO_UDP);
+ tcp ? IPPROTO_TCP : IPPROTO_UDP);
if (port == 0)
port = NFS_PORT;
#ifdef NFS_MOUNT_DEBUG
@@ -725,11 +735,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
printf(_("using port %d for nfs deamon\n"), port);
#endif
server_addr.sin_port = htons(port);
- /*
- * connect() the socket for kernels 1.3.10 and below only,
- * to avoid problems with multihomed hosts.
- * --Swen
- */
+ /*
+ * connect() the socket for kernels 1.3.10 and below only,
+ * to avoid problems with multihomed hosts.
+ * --Swen
+ */
if (linux_version_code() <= 66314
&& connect(fsock, (struct sockaddr *) &server_addr,
sizeof (server_addr)) < 0) {
@@ -752,7 +762,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
/* abort */
-fail:
+ fail:
if (msock != -1) {
if (mclient) {
auth_destroy(mclient->cl_auth);
diff --git a/mount/sundries.c b/mount/sundries.c
index de17b256d..1da3b666e 100644
--- a/mount/sundries.c
+++ b/mount/sundries.c
@@ -4,7 +4,7 @@
*
* added fcntl locking by Kjetil T. (kjetilho@math.uio.no) - aeb, 950927
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
*
*/
diff --git a/mount/swapon.c b/mount/swapon.c
index 2e49b627d..829acadd4 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -3,7 +3,7 @@
* swapon.c,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
* Added '-s' (Summary option) <Vincent.Renardias@waw.com> 02/1997.
*
- * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
+ * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
* - added Native Language Support
* Sun Mar 21 1999 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - fixed strerr(errno) in gettext calls
diff --git a/mount/umount.c b/mount/umount.c
index 24622bc98..1843e08e5 100644
--- a/mount/umount.c
+++ b/mount/umount.c
@@ -52,7 +52,7 @@
#include <arpa/inet.h>
#endif
-#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__)
+#if defined(MNT_FORCE) && !defined(__sparc__) && !defined(__arm__) && !defined(__mips__)
/* Interesting ... it seems libc knows about MNT_FORCE and presumably
about umount2 as well -- need not do anything */
#else /* MNT_FORCE */
@@ -378,7 +378,7 @@ umount_one_bw (const char *file, struct mntentchn *mc) {
}
/* Unmount all filesystems of type VFSTYPES found in mtab. Since we are
- concurrently updating mtab after every succesful umount, we have to
+ concurrently updating mtab after every successful umount, we have to
slurp in the entire file before we start. This isn't too bad, because
in any case it's important to umount mtab entries in reverse order
to mount, e.g. /usr/spool before /usr. */