diff options
author | Christopher Faylor <me@cgf.cx> | 2002-12-28 10:10:30 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-12-28 10:10:30 +0300 |
commit | 657f6f68e5bb466b67ea52b5ef6978c0d742e9bb (patch) | |
tree | 6c420c870cf0483882b2da6b0445e068e426931e | |
parent | 4378bd7bc16e2bd1d53b1d41d0a74f310280ed11 (diff) |
Introduce device class to cygwin throughout. Rename FH_DISK to FH_FS
throughout.
* dcrt0.cc (dll_crt0_1): Initialize device globals via device::init.
* dtable.cc (dtable::init_std_file_from_handle): Use device numbers rather than
names when they are known. Should speed up process startup slightly.
(dtable::build_fhandler_from_name): Pass path_conv device to build_fhandler.
(dtable::build_fhandler): Accept device argument rather than separate
device/unit arguments.
(dtable::build_fhandler): Ditto. Separate switch statement by devices which
take units and those which don't. Build unix/win32 names from device if
required.
(dtable::dup_worker): Reflect changes to build_fhandler arguments.
* dtable.h (dtable::build_fhandler): Ditto.
* fhandler.cc (fhandler_base::set_name): Eliminate unit argument. Use get_unit
to derive unit.
* fhandler.h: Separate FH device defines into devices.h include. Define
is_slow as appropriate for each fhandler_class.
(fhandler_base::dev): New element.
(fhandler_base::fhandler_base): Eliminate unit argument.
(fhandler_base::get_device): Return device number.
(fhandler_base::get_major): Return device major number.
(fhandler_base::get_minor): Return device minor number.
(fhandler_base::get_unit): Ditto.
(fhandler_base::get_native_name): Return device format field.
(fhandler_fifo): New class.
(select_stuff::device_specific): Remove array.
(select_stuff::device_specific_pipe): New class element.
(select_stuff::device_specific_socket): New class element.
(select_stuff::device_specific_serial): New class element.
(select_stuff::select_stuff): Initialize new elements.
* fhandler_disk_file.cc (fhandler_cygdrive::fhandler_cygdrive): Remove unit
initialization.
* fhandler_tty.cc (fhandler_tty_master::init_console): Use "console_dev" global
to initialize captive console used by tty master.
* mmap.cc (mmap_record::devtype_): Remove.
(mmap_record::dev): New.
(mmap_record::mmap_record): Use dev.
(mmap_record::get_device): Implement via dev.
* net.cc (fdsock): Use socket_dev global to initialize socket fhandler.
* path.cc (path_conv::check): Accommodate new path_conv::dev element.
(get_devn): Eliminate.
(get_raw_device_number): Ditto.
(get_device_number): Ditto.
(win32_device_name): Accept dev argument. Use it. Use device::parse to derive
potential device name.
(mount_info::conv_to_win32_path): Accept dev argument. Use it.
* path.h (path_conv::devn): Eliminate.
(path_conv::unit): Ditto.
(path_conv::dev): Declare.
(path_conv::path_conv): Don't initialize deleted members.
(path_conv::is_device): Implement via dev element.
(path_conv::get_devn): Ditto.
(path_conv::get_unitn): Ditto.
* pipe.cc (make_pipe): Use pipe[rw]_dev in fhandler construction.
* select.cc: Use new device_specific_* select class elements
* shared_info.h (CURR_MOUNT_MAGIC): Update.
(mount_info::conv_to_win32_path): Reflect new arguments.
* syscalls.cc (fstat64): Just use get_device() without interpretation for
st_dev element.
(stat_worker): Ditto.
* tty.cc (create_tty_master): Use ttym_dev in fhandler constructor.
(tty::common_init): Check for tty major device number rather than FH_TTYM.
-rw-r--r-- | winsup/cygwin/fhandler.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index b9d6a1236..ab5db45f4 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -150,7 +150,7 @@ fhandler_base::get_readahead_into_buffer (char *buf, size_t buflen) be too long (e.g. devices or some such). The unix_path_name is also used by virtual fhandlers. */ void -fhandler_base::set_name (const char *unix_path, const char *win32_path, int unit) +fhandler_base::set_name (const char *unix_path, const char *win32_path) { if (unix_path == NULL || !*unix_path) return; @@ -161,7 +161,7 @@ fhandler_base::set_name (const char *unix_path, const char *win32_path, int unit { const char *fmt = get_native_name (); char *w = (char *) cmalloc (HEAP_STR, strlen (fmt) + 16); - __small_sprintf (w, fmt, unit); + __small_sprintf (w, fmt, get_unit ()); win32_path_name = w; } @@ -425,7 +425,7 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) file_attributes |= FILE_FLAG_OVERLAPPED; #ifdef HIDDEN_DOT_FILES - if (flags & O_CREAT && get_device () == FH_DISK) + if (flags & O_CREAT && get_device () == FH_FS) { char *c = strrchr (get_win32_name (), '\\'); if ((c && c[1] == '.') || *get_win32_name () == '.') @@ -449,7 +449,7 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) /* If the file should actually be created and ntsec is on, set files attributes. */ - if (flags & O_CREAT && get_device () == FH_DISK && allow_ntsec && has_acls ()) + if (flags & O_CREAT && get_device () == FH_FS && allow_ntsec && has_acls ()) set_security_attribute (mode, &sa, alloca (4096), 4096); x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution, @@ -481,7 +481,7 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) /* Attributes may be set only if a file is _really_ created. This code is now only used for ntea here since the files security attributes are set in CreateFile () now. */ - if (flags & O_CREAT && get_device () == FH_DISK + if (flags & O_CREAT && get_device () == FH_FS && GetLastError () != ERROR_ALREADY_EXISTS && !allow_ntsec && allow_ntea) set_file_attribute (has_acls (), get_win32_name (), mode); |