* Makefile.in (path-mount.o): Add a rule to build stripped down version
of path.cc for usage in mount. (mount.exe): Add dependency to path-mount.o. * mount.cc (force): Convert to bool value. Accommodate throughout. (from_fstab): New function. (do_mount_from_fstab): New function. (longopts): Add --all option. (opts): Add -a option. (usage): Document -a/--all option. (main): Handle -a option as well as single parameter. * path.cc: Add FSTAB_ONLY conditional to allow building path-mount.o. (mount_table): Remove static storage class. (max_mount_entry): Ditto. (root_here): Unused. Remove. (from_fstab_line): Remove static. * path.h (struct mnt_t): Define here rather than in path.cc. (from_fstab_line): Declare. (mount_table): Declare. (max_mount_entry): Declare. * utils.sgml (mount): Document -a/--all option and mounting of single path from fstab files.
This commit is contained in:
@ -27,6 +27,7 @@ details. */
|
||||
#include "cygwin/include/mntent.h"
|
||||
#include "testsuite.h"
|
||||
|
||||
#ifndef FSTAB_ONLY
|
||||
/* Used when treating / and \ as equivalent. */
|
||||
#define isslash(ch) \
|
||||
({ \
|
||||
@ -245,25 +246,17 @@ readlink (HANDLE fh, char *path, int maxlen)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
struct mnt_t
|
||||
{
|
||||
char *native;
|
||||
char *posix;
|
||||
unsigned flags;
|
||||
};
|
||||
#endif /* !FSTAB_ONLY */
|
||||
|
||||
#ifndef TESTSUITE
|
||||
static mnt_t mount_table[255];
|
||||
static int max_mount_entry;
|
||||
mnt_t mount_table[255];
|
||||
int max_mount_entry;
|
||||
#else
|
||||
# define TESTSUITE_MOUNT_TABLE
|
||||
# include "testsuite.h"
|
||||
# undef TESTSUITE_MOUNT_TABLE
|
||||
#endif
|
||||
|
||||
mnt_t *root_here = NULL;
|
||||
|
||||
inline void
|
||||
unconvert_slashes (char* name)
|
||||
{
|
||||
@ -355,7 +348,7 @@ read_flags (char *options, unsigned &flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
bool
|
||||
from_fstab_line (mnt_t *m, char *line, bool user)
|
||||
{
|
||||
char *native_path, *posix_path, *fs_type;
|
||||
@ -440,6 +433,8 @@ from_fstab_line (mnt_t *m, char *line, bool user)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef FSTAB_ONLY
|
||||
|
||||
#define BUFSIZE 65536
|
||||
|
||||
static char *
|
||||
@ -540,7 +535,10 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
|
||||
max_mount_entry = m - mount_table;
|
||||
CloseHandle (h);
|
||||
}
|
||||
#endif
|
||||
#endif /* !FSTAB_ONLY */
|
||||
#endif /* !TESTSUITE */
|
||||
|
||||
#ifndef FSTAB_ONLY
|
||||
|
||||
static int
|
||||
mnt_sort (const void *a, const void *b)
|
||||
@ -900,3 +898,5 @@ getmntent (FILE *)
|
||||
m++;
|
||||
return &mnt;
|
||||
}
|
||||
|
||||
#endif /* !FSTAB_ONLY */
|
||||
|
Reference in New Issue
Block a user