summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/devices.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-03-31 17:38:00 +0000
committerChristopher Faylor <me@cgf.cx>2012-03-31 17:38:00 +0000
commit1c1294b4ce46055413bc7cea6450c96425b9c562 (patch)
treedd9c126fb8a2ef0246f611b4e7c391365a2defa7 /winsup/cygwin/devices.h
parent54440304b397a5d3f4b19415c09a5939a9074c37 (diff)
downloadcygnal-1c1294b4ce46055413bc7cea6450c96425b9c562.tar.gz
cygnal-1c1294b4ce46055413bc7cea6450c96425b9c562.tar.bz2
cygnal-1c1294b4ce46055413bc7cea6450c96425b9c562.zip
(Interim checkin while we work on this)
* devices.cc: Regenerate. * devices.h (device::noexpose): New field. (device::dev_on_fs): Make a bit field. (get_major): Use proper type for declaration. (expose): New field. (ext_dev_storage): Delete declaration. (dev_storage_size): Ditto. (dev_storage): New declaration. (dev_storage_end): Ditto. * devices.in: Mark /dev/ptym*, /dev/com*, /dev/pipe, /dev/fifo, and "/dev" as "no expose". * fhandler.h (fhandler_dev::lastrealpos): Delete declaration. (fhandler_dev::devidx): Declare new field. * fhandler_disk_file.cc: Move fhandler_dev functions into fhandler_dev.cc. * fhandler_dev.cc: Add includes needed for functions moved from fhandler_disk_file.cc. (dev_storage_scan_start): Define place to start listing devices. (dev_storage_size): Define size of array to scan. (fhandler_dev::fhandler_dev): Move here from fhandler_disk_file.cc. (fhandler_dev::opendir): Ditto. (fhandler_dev::readdir): Just check devidx for non-NULL to determine when to go to disk for /dev content. Use dev_storage rather than ext_dev_storage. Iterate over dev_storage using devidx pointer. Use accessor functions rather than raw references to the device struct. Only increment dir->__d_position when we are actually going to be returning something. Add debug_printf for exit. (fhandler_dev::rewinddir): Set devidx as appropriate depending on whether there's a /dev on disk or not. * gendevices: Don't mark dev_storage static but do put it in the _RDATA section. * path.cc (path_conv::check): Use new "device::expose()" function to decide to forbid programs from referencing internal device types.
Diffstat (limited to 'winsup/cygwin/devices.h')
-rw-r--r--winsup/cygwin/devices.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h
index 5b452ba1b..57bf2eb59 100644
--- a/winsup/cygwin/devices.h
+++ b/winsup/cygwin/devices.h
@@ -275,8 +275,9 @@ struct device
};
} d;
const char *native;
+ bool noexpose:1;
+ bool dev_on_fs:1;
_mode_t mode;
- bool dev_on_fs;
static const device *lookup (const char *, unsigned int = UINT32_MAX);
void parse (const char *);
void parse (_major_t major, _minor_t minor);
@@ -308,8 +309,9 @@ struct device
bool not_device (_dev_t n) const {return d.devn && n != d.devn; }
_minor_t get_minor () const {return d.minor;}
- _minor_t get_major () const {return d.major;}
+ _major_t get_major () const {return d.major;}
+ inline bool expose () const {return !noexpose;}
inline operator int& () {return d.devn_int;}
inline operator fh_devices () {return d.devn_fh_devices;}
inline operator bool () {return !!d.devn_int;}
@@ -320,8 +322,8 @@ struct device
inline bool is_fs_special () const {return dev_on_fs && d.devn != FH_FS;}
};
-extern const device *ext_dev_storage;
-extern const size_t dev_storage_size;
+extern const device dev_storage[];
+extern const device *dev_storage_end;
extern const device *console_dev;
extern const device *ptmx_dev;