* 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.
This commit is contained in:
Corinna Vinschen 2010-08-11 11:01:14 +00:00
parent a5fe426282
commit 68a178b37c
3 changed files with 46 additions and 18 deletions

View File

@ -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> 2010-08-10 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* mingw: Use sysroot, if present, for mingw_dir. * mingw: Use sysroot, if present, for mingw_dir.

View File

@ -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); 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)]; char devtmp[1 + 2 * strlen (dev)];
strcpy (devtmp, dev); strcpy (devtmp, dev);
@ -426,10 +426,14 @@ mount_entries (void)
// write fstab entries for normal mount points // write fstab entries for normal mount points
while ((p = getmntent (m)) != NULL) 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")) if (!strstr (p->mnt_opts, ",noumount") && !strstr (p->mnt_opts, ",auto"))
{ {
char fsname[NT_MAX_PATH], dirname[NT_MAX_PATH]; 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), printf (format_mnt, convert_spaces (fsname, p->mnt_fsname),
convert_spaces (dirname, p->mnt_dir), convert_spaces (dirname, p->mnt_dir),
p->mnt_type, p->mnt_opts); p->mnt_type, p->mnt_opts);

View File

@ -964,22 +964,22 @@ will display the current mount table for you.</para>
<title>Displaying the current set of mount points</title> <title>Displaying the current set of mount points</title>
<screen> <screen>
<prompt>$</prompt> <userinput>mount</userinput> <prompt>$</prompt> <userinput>mount</userinput>
c:\cygwin\bin on /usr/bin type ntfs (binary) C:/cygwin/bin on /usr/bin type ntfs (binary)
c:\cygwin\lib on /usr/lib type ntfs (binary) C:/cygwin/lib on /usr/lib type ntfs (binary)
c:\cygwin on / type ntfs (binary) C:/cygwin on / type ntfs (binary)
c: on /c type ntfs (binary,user,noumount) C: on /mnt/c type ntfs (binary,user,noumount)
d: on /d type fat (binary,user,noumount) D: on /mnt/d type fat (binary,user,noumount)
</screen> </screen>
</example> </example>
<para>In this example, c:\cygwin is the POSIX root and D drive is mapped to <para>In this example, c:/cygwin is the POSIX root and the D drive is
<filename>/d</filename>. Note that in this case, the root mount is a mapped to <filename>/mnt/d</filename>. Note that in this case, the root
system-wide mount point that is visible to all users running Cygwin mount is a system-wide mount point that is visible to all users running
programs, whereas the <filename>/d</filename> mount is only visible Cygwin programs, whereas the <filename>/mnt/d</filename> mount is only
to the current user.</para> visible to the current user.</para>
<para>The <command>mount</command> utility is also the mechanism for <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 demonstrates how to mount the directory
<filename>//pollux/home/joe/data</filename> to <filename>/data</filename> <filename>//pollux/home/joe/data</filename> to <filename>/data</filename>
for the duration of the current session. for the duration of the current session.
@ -994,11 +994,11 @@ ls: /data: No such file or directory
mount: warning - /data does not exist! mount: warning - /data does not exist!
<prompt>$</prompt> <userinput>mount</userinput> <prompt>$</prompt> <userinput>mount</userinput>
//pollux/home/joe/data on /data type smbfs (binary) //pollux/home/joe/data on /data type smbfs (binary)
c:/cygwin/bin on /usr/bin type ntfs (binary) C:/cygwin/bin on /usr/bin type ntfs (binary)
c:/cygwin/lib on /usr/lib type ntfs (binary) C:/cygwin/lib on /usr/lib type ntfs (binary)
c:/cygwin on / type ntfs (binary) C:/cygwin on / type ntfs (binary)
c: on /c type ntfs (binary,user,noumount) C: on /c type ntfs (binary,user,noumount)
d: on /d type fat (binary,user,noumount) D: on /d type fat (binary,user,noumount)
</screen> </screen>
</example> </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 acl - Use the filesystem's access control lists (ACLs) to
implement real POSIX permissions (default). implement real POSIX permissions (default).
binary - Files default to binary mode (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. cygexec - Treat all files below mount point as cygwin executables.
dos - Always convert leading spaces and trailing dots and spaces to dos - Always convert leading spaces and trailing dots and spaces to
characters in the UNICODE private use area. This allows to use 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 rule that system mount points can't be removed or replaced in a running
session still applies.</para> 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> <para>
The <literal>-m</literal> option causes the <command>mount</command> utility The <literal>-m</literal> option causes the <command>mount</command> utility
to output the current mount table in a series of fstab entries. to output the current mount table in a series of fstab entries.