Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2008-08-13 20:35:04 +0400
committerCorinna Vinschen <corinna@vinschen.de>2008-08-13 20:35:04 +0400
commit56d81795705a67bef7e1e5fa934a2109e34b316f (patch)
tree33ea8a996741c876019270e53334484f42ac0c6e /winsup/utils/umount.cc
parent04a6c4efd7bd7005a37d3543186fd6b731d39a2c (diff)
* mount.cc (NT_MAX_PATH): Define.
(longopts): Rename mount-commands option to mount-entries. (opts): Remove removed options. (struct opt): Move up in file to allow using it in usage. (usage): Change text for --mount-entries option. Remove -X option. Add valid options output. (main): Remove handling -b option. (convert_spaces): New static function to convert spaces to "\040" string. (mount_entries): Renamed from mount_commands. Rewrite to emit /etc/fstab compatible output. (show_cygdrive_info): Print "nouser" rather than "system". * umount.cc (longopts): Remove remove-all-mounts, remove-cygdrive-prefix, remove-system-mounts, system and user options. (opts): Remove A, c, s, S, u options. (usage): Remove text for all removed options. (main): Remove handling for all removed options. (remove_all_mounts): Remove. (remove_all_system_mounts): Remove. (remove_cygdrive_prefix): Remove. * utils.sgml: Fix mount and umount documentation. Move description of (cyg,not)exec options to mount table section.
Diffstat (limited to 'winsup/utils/umount.cc')
-rw-r--r--winsup/utils/umount.cc100
1 files changed, 2 insertions, 98 deletions
diff --git a/winsup/utils/umount.cc b/winsup/utils/umount.cc
index bae371ba0..5be116b71 100644
--- a/winsup/utils/umount.cc
+++ b/winsup/utils/umount.cc
@@ -1,6 +1,6 @@
/* umount.cc
- Copyright 1996, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2008 Red Hat, Inc.
This file is part of Cygwin.
@@ -16,10 +16,7 @@ details. */
#include <errno.h>
#include <getopt.h>
-static void remove_all_mounts ();
static void remove_all_user_mounts ();
-static void remove_all_system_mounts ();
-static void remove_cygdrive_prefix (int flags);
static const char version[] = "$Revision$";
static const char *progname;
@@ -27,17 +24,12 @@ static const char *progname;
struct option longopts[] =
{
{"help", no_argument, NULL, 'h' },
- {"remove-all-mounts", no_argument, NULL, 'A'},
- {"remove-cygdrive-prefix", no_argument, NULL, 'c'},
- {"remove-system-mounts", no_argument, NULL, 'S'},
{"remove-user-mounts", no_argument, NULL, 'U'},
- {"system", no_argument, NULL, 's'},
- {"user", no_argument, NULL, 'u'},
{"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
-char opts[] = "AchsSuUv";
+char opts[] = "hUv";
static void
usage (FILE *where = stderr)
@@ -46,12 +38,7 @@ usage (FILE *where = stderr)
Usage: %s [OPTION] [<posixpath>]\n\
Unmount filesystems\n\
\n\
- -A, --remove-all-mounts remove all mounts\n\
- -c, --remove-cygdrive-prefix remove cygdrive prefix\n\
-h, --help output usage information and exit\n\
- -s, --system remove system mount (default)\n\
- -S, --remove-system-mounts remove all system mounts\n\
- -u, --user remove user mount\n\
-U, --remove-user-mounts remove all user mounts\n\
-v, --version output version information and exit\n\
", progname);
@@ -97,9 +84,6 @@ main (int argc, char **argv)
enum do_what
{
nada,
- saw_remove_all_mounts,
- saw_remove_cygdrive_prefix,
- saw_remove_all_system_mounts,
saw_remove_all_user_mounts
} do_what = nada;
@@ -117,30 +101,8 @@ main (int argc, char **argv)
while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
switch (i)
{
- case 'A':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_mounts;
- break;
- case 'c':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_cygdrive_prefix;
- break;
case 'h':
usage (stdout);
- case 's':
- flags |= MOUNT_SYSTEM;
- break;
- case 'S':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_system_mounts;
- break;
- case 'u':
- flags &= ~MOUNT_SYSTEM;
- default_flag = 0;
- break;
case 'U':
if (do_what != nada)
usage ();
@@ -155,21 +117,6 @@ main (int argc, char **argv)
switch (do_what)
{
- case saw_remove_all_mounts:
- if (optind != argc)
- usage ();
- remove_all_mounts ();
- break;
- case saw_remove_cygdrive_prefix:
- if (optind != argc)
- usage ();
- remove_cygdrive_prefix (flags | default_flag);
- break;
- case saw_remove_all_system_mounts:
- if (optind != argc)
- usage ();
- remove_all_system_mounts ();
- break;
case saw_remove_all_user_mounts:
if (optind != argc)
usage ();
@@ -185,14 +132,6 @@ main (int argc, char **argv)
return 0;
}
-/* remove_all_mounts: Unmount all mounts. */
-static void
-remove_all_mounts ()
-{
- remove_all_user_mounts ();
- remove_all_system_mounts ();
-}
-
/* remove_all_user_mounts: Unmount all user mounts. */
static void
remove_all_user_mounts ()
@@ -217,38 +156,3 @@ remove_all_user_mounts ()
endmntent (m);
}
-
-/* remove_all_system_mounts: Unmount all system mounts. */
-static void
-remove_all_system_mounts ()
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
-
- while ((p = getmntent (m)) != NULL)
- {
- /* Remove the mount if it's a system mount. */
- if (strncmp (p->mnt_type, "system", 6) == 0 &&
- strstr (p->mnt_opts, "noumount") == NULL)
- {
- if (cygwin_umount (p->mnt_dir, MOUNT_SYSTEM))
- error (p->mnt_dir);
-
- /* We've modified the table so we need to start over. */
- endmntent (m);
- m = setmntent ("/-not-used-", "r");
- }
- }
-
- endmntent (m);
-}
-
-/* remove_cygdrive_prefix: Remove cygdrive user or system path prefix. */
-static void
-remove_cygdrive_prefix (int flags)
-{
- int res = cygwin_umount (NULL, flags | MOUNT_CYGDRIVE);
- if (res)
- error ("remove_cygdrive_prefix");
- exit (0);
-}