4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-25 00:27:19 +08:00
Corinna Vinschen c1023ee353 Cygwin: path_conv: decouple path_types from mount types
- Remove another unfortunate amalgamation: Mount flags (MOUNT_xxx)
  are converted to path_types (PATH_xxx) and mixed with non-mount
  path_types flags in the same storage, leading to a tangled,
  pell-mell usage of mount flags and path flags in path_conv and
  symlink_info.

- There's also the case of PC_NONULLEMPTY.  It's used in exactly
  one place with a path_conv constructor only used in this single
  place, just to override the automatic PC_NULLEMPTY addition
  when calling the other path_conv constructors.  Crazily,
  PC_NONULLEMPTY is a define, no path_types flag, despite its
  name.

- It doesn't help that the binary flag exists as mount and path
  flag, while the text flag only exists as path flag.  This leads
  to mount code using path flags to set text/binary.  Very confusing
  is the fact that a text mount/path flag is not actually required;
  the mount code sets the text flag on non binary mounts anyway, so
  there are only two states.  However, to puzzle people a bit more,
  path_conv::binary wrongly implies there's a third, non-binary/non-text
  state.

Clean up this mess:

- Store path flags separately from mount flags in path_conv and
  symlink_info classes and change all checks and testing inline
  methods accordingly.

- Make PC_NONULLEMPTY a simple path_types flag and drop the
  redundant path_check constructor.

- Clean up the definition of pathconv_arg, path_types, and mount flags.
  Use _BIT expression, newly define in cygwin/bits.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06 20:30:14 +01:00

61 lines
2.0 KiB
C

/* sys/mount.h
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#ifndef _SYS_MOUNT_H
#define _SYS_MOUNT_H
#ifdef __CYGWIN__ /* Build tweak for native Cygwin utils */
#include <cygwin/bits.h>
#endif
#define BLOCK_SIZE 1024
#define BLOCK_SIZE_BITS 10
#ifdef __cplusplus
extern "C" {
#endif
enum
{
MOUNT_BINARY = _BIT ( 1), /* "binary" format read/writes */
MOUNT_SYSTEM = _BIT ( 3), /* mount point came from system table */
MOUNT_EXEC = _BIT ( 4), /* Any file in the mounted directory
gets 'x' bit */
MOUNT_CYGDRIVE = _BIT ( 5), /* mount point refers to cygdrive
device mount */
MOUNT_CYGWIN_EXEC = _BIT ( 6), /* file or directory is or contains a
cygwin executable */
MOUNT_SPARSE = _BIT ( 7), /* Support automatic sparsifying of
files. */
MOUNT_NOTEXEC = _BIT ( 8), /* don't check files for executable magic */
MOUNT_DEVFS = _BIT ( 9), /* /device "filesystem" */
MOUNT_PROC = _BIT (10), /* /proc "filesystem" */
MOUNT_RO = _BIT (12), /* read-only "filesystem" */
MOUNT_NOACL = _BIT (13), /* support reading/writing ACLs */
MOUNT_NOPOSIX = _BIT (14), /* Case insensitve path handling */
MOUNT_OVERRIDE = _BIT (15), /* Allow overriding of root */
MOUNT_IMMUTABLE = _BIT (16), /* Mount point can't be changed */
MOUNT_AUTOMATIC = _BIT (17), /* Mount point was added automatically */
MOUNT_DOS = _BIT (18), /* convert leading spaces and trailing
dots and spaces to private use area */
MOUNT_IHASH = _BIT (19), /* Enforce hash values for inode numbers */
MOUNT_BIND = _BIT (20), /* Allows bind syntax in fstab file. */
MOUNT_USER_TEMP = _BIT (21), /* Mount the user's $TMP. */
MOUNT_DONT_USE = _BIT (31) /* conversion to signed happens. */
};
int mount (const char *, const char *, unsigned __flags);
int umount (const char *);
int cygwin_umount (const char *__path, unsigned __flags);
#ifdef __cplusplus
};
#endif
#endif /* _SYS_MOUNT_H */