4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-25 00:27:19 +08:00
Corinna Vinschen 367c1ae161 Cygwin: mount: define binary mount as default
Commit c1023ee353705671aa9a8e4e1179022277add2aa changed the way
path_conv::binmode() works.  Rather than returning three states,
O_BINARY, O_TEXT, 0, it only returned 2 states, O_BINARY, O_TEXT.  Since
mounts are only binary if they are explicitely mounted binary by setting
the MOUNT_BINARY flag, textmode is default.

This introduced a new bug.  When inheriting stdio HANDLEs from native
Windows processes, the fhandler and its path_conv are created from a
device struct only.  None of the path or mount flags get set this way.
So the mount flags are 0 and path_conv::binmode() returned 0.

After the path_conv::binmode() change it returned O_TEXT since, as
explained above, the default mount mode is textmode.

Rather than just enforcing binary mode for path_conv's created from
device structs, this patch changes the default mount mode to binary:

Replace MOUNT_BINARY flag with MOUNT_TEXT flag with opposite meaning.
Drop all explicit setting of MOUNT_BINARY.  Drop local set_flags
function, it doesn't add any value.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-02-18 10:26:53 +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_TEXT = _BIT ( 0), /* "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 */