diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-08-11 11:01:14 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-08-11 11:01:14 +0000 |
commit | 68a178b37ca1fb6c05b508a92314c22a00f6ebd9 (patch) | |
tree | d69b1ec4aed7d93dc1edeee4a2f2e5f01d805fdd /winsup/utils | |
parent | a5fe426282c0586415642baf7fb0c880f5f163de (diff) | |
download | cygnal-68a178b37ca1fb6c05b508a92314c22a00f6ebd9.tar.gz cygnal-68a178b37ca1fb6c05b508a92314c22a00f6ebd9.tar.bz2 cygnal-68a178b37ca1fb6c05b508a92314c22a00f6ebd9.zip |
* mount.cc (do_mount): Don't treat "bind" mount as remote mount.
(mount_entries): Drop the "bind" option from output.
* utils.sgml (mount): Match examples to actual mount output. Add
"bind" option and add example.
Diffstat (limited to 'winsup/utils')
-rw-r--r-- | winsup/utils/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/utils/mount.cc | 8 | ||||
-rw-r--r-- | winsup/utils/utils.sgml | 49 |
3 files changed, 46 insertions, 18 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 1f0829104..8bcad9b43 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,10 @@ +2010-08-11 Corinna Vinschen <corinna@vinschen.de> + + * mount.cc (do_mount): Don't treat "bind" mount as remote mount. + (mount_entries): Drop the "bind" option from output. + * utils.sgml (mount): Match examples to actual mount output. Add + "bind" option and add example. + 2010-08-10 Yaakov Selkowitz <yselkowitz@users.sourceforge.net> * mingw: Use sysroot, if present, for mingw_dir. diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 3e342af5d..be6ad03d0 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -86,7 +86,7 @@ do_mount (const char *dev, const char *where, int flags) fprintf (stderr, "%s: warning: %s is not a directory.\n", progname, where); } - if (!force && !(flags & EXEC_FLAGS) && strlen (dev)) + if (!force && !(flags & (EXEC_FLAGS | MOUNT_BIND)) && strlen (dev)) { char devtmp[1 + 2 * strlen (dev)]; strcpy (devtmp, dev); @@ -426,10 +426,14 @@ mount_entries (void) // write fstab entries for normal mount points while ((p = getmntent (m)) != NULL) - // Only list non-cygdrives + // Only list non-cygdrives and non-automounts if (!strstr (p->mnt_opts, ",noumount") && !strstr (p->mnt_opts, ",auto")) { char fsname[NT_MAX_PATH], dirname[NT_MAX_PATH]; + /* Drop the "bind" option since it can't be reverted. */ + char *c = strstr (p->mnt_opts, ",bind"); + if (c) + memmove (c, c + 5, strlen (c + 5) + 1); printf (format_mnt, convert_spaces (fsname, p->mnt_fsname), convert_spaces (dirname, p->mnt_dir), p->mnt_type, p->mnt_opts); diff --git a/winsup/utils/utils.sgml b/winsup/utils/utils.sgml index f25fc72f6..77cb17b2e 100644 --- a/winsup/utils/utils.sgml +++ b/winsup/utils/utils.sgml @@ -964,22 +964,22 @@ will display the current mount table for you.</para> <title>Displaying the current set of mount points</title> <screen> <prompt>$</prompt> <userinput>mount</userinput> -c:\cygwin\bin on /usr/bin type ntfs (binary) -c:\cygwin\lib on /usr/lib type ntfs (binary) -c:\cygwin on / type ntfs (binary) -c: on /c type ntfs (binary,user,noumount) -d: on /d type fat (binary,user,noumount) +C:/cygwin/bin on /usr/bin type ntfs (binary) +C:/cygwin/lib on /usr/lib type ntfs (binary) +C:/cygwin on / type ntfs (binary) +C: on /mnt/c type ntfs (binary,user,noumount) +D: on /mnt/d type fat (binary,user,noumount) </screen> </example> -<para>In this example, c:\cygwin is the POSIX root and D drive is mapped to -<filename>/d</filename>. Note that in this case, the root mount is a -system-wide mount point that is visible to all users running Cygwin -programs, whereas the <filename>/d</filename> mount is only visible -to the current user.</para> +<para>In this example, c:/cygwin is the POSIX root and the D drive is +mapped to <filename>/mnt/d</filename>. Note that in this case, the root +mount is a system-wide mount point that is visible to all users running +Cygwin programs, whereas the <filename>/mnt/d</filename> mount is only +visible to the current user.</para> <para>The <command>mount</command> utility is also the mechanism for -adding new mounts to the mount table. The following example +adding new mounts to the mount table in memory. The following example demonstrates how to mount the directory <filename>//pollux/home/joe/data</filename> to <filename>/data</filename> for the duration of the current session. @@ -994,11 +994,11 @@ ls: /data: No such file or directory mount: warning - /data does not exist! <prompt>$</prompt> <userinput>mount</userinput> //pollux/home/joe/data on /data type smbfs (binary) -c:/cygwin/bin on /usr/bin type ntfs (binary) -c:/cygwin/lib on /usr/lib type ntfs (binary) -c:/cygwin on / type ntfs (binary) -c: on /c type ntfs (binary,user,noumount) -d: on /d type fat (binary,user,noumount) +C:/cygwin/bin on /usr/bin type ntfs (binary) +C:/cygwin/lib on /usr/lib type ntfs (binary) +C:/cygwin on / type ntfs (binary) +C: on /c type ntfs (binary,user,noumount) +D: on /d type fat (binary,user,noumount) </screen> </example> @@ -1019,6 +1019,13 @@ most of the options are duplicates of other mount flags):</para> acl - Use the filesystem's access control lists (ACLs) to implement real POSIX permissions (default). binary - Files default to binary mode (default). + bind - Allows to remount part of the file hierarchy somewhere else. + Different from other mount calls, the first argument + specifies an absolute POSIX path, rather than a Win32 path. + This POSIX path is remounted to the POSIX path specified as + the second parameter. The conversion to a Win32 path is done + within Cygwin immediately at the time of the call. Note that + symlinks are ignored while performing this path conversion. cygexec - Treat all files below mount point as cygwin executables. dos - Always convert leading spaces and trailing dots and spaces to characters in the UNICODE private use area. This allows to use @@ -1071,6 +1078,16 @@ all such added mount points are added as user mount points, and that the rule that system mount points can't be removed or replaced in a running session still applies.</para> +<para>To bind a POSIX path to another POSIX path, use the +<literal>bind</literal> mount flag.</para> + +<screen> +<prompt>$</prompt> <userinput>mount -o bind /var /usr/var</userinput> +</screen> + +<para>This command makes the file hirarchy under <filename>/var</filename> +additionally available under <filename>/usr/var</filename>.</para> + <para> The <literal>-m</literal> option causes the <command>mount</command> utility to output the current mount table in a series of fstab entries. |