diff options
author | Christopher Faylor <me@cgf.cx> | 2003-09-27 09:35:02 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-09-27 09:35:02 +0400 |
commit | 3c1e8187bd172877bf56c1e0bdb1a6919f7238a2 (patch) | |
tree | 328e0c638176215a6453c736bcc20d1b7da82ff5 /winsup/cygwin/devices.cc | |
parent | dfb2ac80888863ce2fc6767c3aebc506bc2cf658 (diff) |
* cygwin-shilka: Remove '#line directives' or suffer debugging oddities. Use
-length option so that device prefixes are used.
* devices.cc: Regenerate.
* syscalls.cc (ttyname): Add debugging output.
Diffstat (limited to 'winsup/cygwin/devices.cc')
-rw-r--r-- | winsup/cygwin/devices.cc | 1403 |
1 files changed, 1120 insertions, 283 deletions
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index ffa891cbd..84e5fea42 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -1,5 +1,4 @@ -/* ANSI-C code produced by gperf version 2.7.2 */ -/* Command-line: gperf -c --key-positions=5-8,1-2,9-10 -r -t -C -E -T -L ANSI-C -Hdevhash -Ndevice::lookup -Z devstring -7 -G /cygnus/src/uberbaum/winsup/cygwin/devices.gperf */ + #include "winsup.h" #include <sys/types.h> #include <stdlib.h> @@ -9,184 +8,12 @@ #include "sys/cygwin.h" #include "tty.h" #include "pinfo.h" -#undef __GNUC__ -static unsigned int devhash (const char *, unsigned) - __attribute__ ((regparm (2))); -#define bad_dev (&dev_bad_storage) +typedef const device *KR_device_t; + + +static KR_device_t KR_find_keyword (const char *KR_keyword, int KR_length); + -enum - { - TOTAL_KEYWORDS = 54, - MIN_WORD_LENGTH = 5, - MAX_WORD_LENGTH = 14, - MIN_HASH_VALUE = 106, - MAX_HASH_VALUE = 288 - }; - -/* maximum key range = 183, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static unsigned int -devhash (register const char *str, register unsigned int len) -{ - static const unsigned short asso_values[] = - { - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 2, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 62, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 27, 289, 289, 289, 289, 289, 289, - 289, 289, 289, 289, 289, 289, 289, 29, 28, 12, - 45, 59, 32, 39, 24, 11, 19, 53, 55, 2, - 57, 35, 21, 54, 62, 9, 52, 8, 37, 10, - 16, 33, 43, 289, 289, 289, 289, 289 - }; - register int hval = len; - - switch (hval) - { - default: - case 10: - hval += asso_values[(unsigned) cyg_tolower (str[9])]; - case 9: - hval += asso_values[(unsigned) cyg_tolower (str[8])]; - case 8: - hval += asso_values[(unsigned) cyg_tolower (str[7])]; - case 7: - hval += asso_values[(unsigned) cyg_tolower (str[6])]; - case 6: - hval += asso_values[(unsigned) cyg_tolower (str[5])]; - case 5: - hval += asso_values[(unsigned) cyg_tolower (str[4])]; - case 4: - case 3: - case 2: - hval += asso_values[(unsigned) cyg_tolower (str[1])]; - case 1: - hval += asso_values[(unsigned) cyg_tolower (str[0])]; - break; - } - return hval; -} - -static NO_COPY const struct device wordlist[] = - { - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"/dev/com", FH_SERIAL, "\\.\\com%d", 1, 99}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, - {"/dev/st", FH_TAPE, "\\Device\\Tape%d", 0, 127}, - {""}, {""}, - {"/dev/mem", FH_MEM, "\\dev\\mem", 0, 0, 0, 0}, - {""}, {""}, - {"/dev/scd", FH_CDROM, "\\Device\\CdRom%d", 0, 15}, - {""}, {""}, {""}, - {"/dev/sr", FH_CDROM, "\\Device\\CdRom%d", 0, 15}, - {"/dev/hdm", FH_SDM, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 191}, - {""}, {""}, {""}, - {"/dev/dsp", FH_OSS_DSP, "\\dev\\dsp", 0, 0, 0, 0}, - {"/dev/fd", FH_FLOPPY, "\\Device\\Floppy%d", 0, 15}, - {"/dev/hdu", FH_SDU, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 319}, - {"/dev/hds", FH_SDS, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 287}, - {"/dev/hdw", FH_SDW, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 351}, - {"/dev/hdi", FH_SDI, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 127}, - {"/dev/hdc", FH_SDC, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 31}, - {""}, {""}, {""}, - {"/dev/hdx", FH_SDX, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 367}, - {""}, {""}, - {"/dev/hdj", FH_SDJ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 143}, - {""}, - {"/dev/hdp", FH_SDP, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 239}, - {""}, - {"/dev/ptmx", FH_PTYM, "\\dev\\ptmx", 0, 0, 0, 0}, - {"/dev/hdh", FH_SDH, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 111}, - {""}, {""}, {""}, - {"/dev/hdb", FH_SDB, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 15}, - {"/dev/hda", FH_SDA, "\\Device\\Harddisk%d\\Partition%d", 1, 16, -1}, - {""}, - {":bad:", FH_BAD, ":bad:", 0, 0, 0, 0}, - {"/dev/hdf", FH_SDF, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 79}, - {"/dev/hdy", FH_SDY, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 383}, - {""}, - {"/dev/hdo", FH_SDO, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 223}, - {""}, - {"/dev/hdv", FH_SDV, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 335}, - {""}, - {"/dev/hdg", FH_SDG, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 95}, - {""}, {""}, - {"/dev/fifo", FH_FIFO, "\\dev\\fifo", 0, 0, 0, 0}, - {"/dev/hdz", FH_SDZ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 399}, - {"/dev/pipe", FH_PIPE, "\\dev\\pipe", 0, 0, 0, 0}, - {"/dev/hdd", FH_SDD, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 47}, - {""}, {""}, - {"/dev/kmem", FH_KMEM, "\\dev\\mem", 0, 0, 0, 0}, - {"/dev/nst", FH_NTAPE, "\\Device\\Tape%d", 0, 127}, - {""}, {""}, - {"/dev/hdt", FH_SDT, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 303}, - {"/dev/hdk", FH_SDK, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 159}, - {"/dev/hdq", FH_SDQ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 255 /* FIXME 8 bit lunacy */}, - {"/dev/hdl", FH_SDL, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 175}, - {""}, - {"/dev/hdn", FH_SDN, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 207}, - {""}, - {"/dev/hde", FH_SDE, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 63}, - {""}, {""}, - {"/dev/hdr", FH_SDR, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 271}, - {""}, - {"/dev/clipboard", FH_CLIPBOARD, "\\dev\\clipboard", 0, 0, 0, 0}, - {""}, {""}, {""}, - {"/dev/tty", FH_TTY, "\\dev\\tty", 0, 0, 0, 0}, - {""}, {""}, - {"/dev/ttym", FH_TTYM, "\\dev\\ttym", 0, 255, 0, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"/dev/ttys", FH_TTYS, "\\dev\\tty%d", 0, 255, 0, 0}, - {""}, {""}, - {"/dev/conout", FH_CONOUT, "conout", 0, 0, 0, 0}, - {""}, - {"/dev/console", FH_CONSOLE, "\\dev\\console", 0, 0, 0, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"/dev/windows", FH_WINDOWS, "\\dev\\windows", 0, 0, 0, 0}, - {""}, {""}, - {"/dev/ttyS", FH_SERIAL, "\\.\\com%d", 0, 99, -1}, - {""}, {""}, {""}, {""}, {""}, - {"/dev/port", FH_PORT, "\\dev\\port", 0, 0, 0, 0}, - {""}, {""}, - {"/dev/conin", FH_CONIN, "conin", 0, 0, 0, 0}, - {""}, - {"/dev/null", FH_NULL, "nul", 0, 0, 0, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, - {"/dev/zero", FH_ZERO, "\\dev\\zero", 0, 0, 0, 0}, - {""}, {""}, {""}, {""}, - {"/dev/urandom", FH_URANDOM, "\\dev\\urandom", 0, 0, 0, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"/dev/rawdrive", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"/dev/random", FH_RANDOM, "\\dev\\random", 0, 0, 0, 0} - }; const device dev_cygdrive_storage = {"/cygdrive", FH_CYGDRIVE, "/cygdrive", 0, 0, 0, 0}; @@ -227,129 +54,1137 @@ const device dev_piper_storage = const device dev_pipew_storage = {"", FH_PIPEW, "", 0, 0, 0, 0}; -const device dev_fs = - {"", FH_FS, "", 0, 0, 0, 0}; -const device dev_bad_storage = wordlist[157]; -const device dev_cdrom_storage = wordlist[123]; -const device dev_cdrom1_storage = wordlist[127]; -const device dev_clipboard_storage = wordlist[190]; -const device dev_conin_storage = wordlist[231]; -const device dev_conout_storage = wordlist[207]; -const device dev_console_storage = wordlist[209]; -const device dev_fifo_storage = wordlist[168]; -const device dev_floppy_storage = wordlist[133]; -const device dev_kmem_storage = wordlist[174]; -const device dev_mem_storage = wordlist[120]; -const device dev_ntape_storage = wordlist[175]; -const device dev_null_storage = wordlist[233]; -const device dev_oss_dsp_storage = wordlist[132]; -const device dev_pipe_storage = wordlist[170]; -const device dev_port_storage = wordlist[228]; -const device dev_ptym_storage = wordlist[149]; -const device dev_random_storage = wordlist[288]; -const device dev_rawdrive_storage = wordlist[270]; -const device dev_sda_storage = wordlist[155]; -const device dev_sdb_storage = wordlist[154]; -const device dev_sdc_storage = wordlist[138]; -const device dev_sdd_storage = wordlist[171]; -const device dev_sde_storage = wordlist[185]; -const device dev_sdf_storage = wordlist[158]; -const device dev_sdg_storage = wordlist[165]; -const device dev_sdh_storage = wordlist[150]; -const device dev_sdi_storage = wordlist[137]; -const device dev_sdj_storage = wordlist[145]; -const device dev_sdk_storage = wordlist[179]; -const device dev_sdl_storage = wordlist[181]; -const device dev_sdm_storage = wordlist[128]; -const device dev_sdn_storage = wordlist[183]; -const device dev_sdo_storage = wordlist[161]; -const device dev_sdp_storage = wordlist[147]; -const device dev_sdq_storage = wordlist[180]; -const device dev_sdr_storage = wordlist[188]; -const device dev_sds_storage = wordlist[135]; -const device dev_sdt_storage = wordlist[178]; -const device dev_sdu_storage = wordlist[134]; -const device dev_sdv_storage = wordlist[163]; -const device dev_sdw_storage = wordlist[136]; -const device dev_sdx_storage = wordlist[142]; -const device dev_sdy_storage = wordlist[159]; -const device dev_sdz_storage = wordlist[169]; -const device dev_serial_storage = wordlist[106]; -const device dev_serial1_storage = wordlist[222]; -const device dev_tape_storage = wordlist[117]; -const device dev_tty_storage = wordlist[194]; -const device dev_ttym_storage = wordlist[197]; -const device dev_ttys_storage = wordlist[204]; -const device dev_urandom_storage = wordlist[262]; -const device dev_windows_storage = wordlist[219]; -const device dev_zero_storage = wordlist[257]; +const device dev_tty_storage = +{"/dev/tty", FH_TTY, "\\dev\\tty", 0, 0, 0, 0}; + +const device dev_ttys_storage = +{"/dev/ttys", FH_TTYS, "\\dev\\tty%d", 0, 255, 0, 0}; + +const device dev_console_storage = +{"/dev/console", FH_CONSOLE, "\\dev\\console", 0, 0, 0, 0}; + +const device dev_ttym_storage = +{"/dev/ttym", FH_TTYM, "\\dev\\ttym", 0, 255, 0, 0}; + +const device dev_ptym_storage = +{"/dev/ptmx", FH_PTYM, "\\dev\\ptmx", 0, 0, 0, 0}; + +const device dev_windows_storage = +{"/dev/windows", FH_WINDOWS, "\\dev\\windows", 0, 0, 0, 0}; + +const device dev_oss_dsp_storage = +{"/dev/dsp", FH_OSS_DSP, "\\dev\\dsp", 0, 0, 0, 0}; + +const device dev_conin_storage = +{"/dev/conin", FH_CONIN, "conin", 0, 0, 0, 0}; + +const device dev_conout_storage = +{"/dev/conout", FH_CONOUT, "conout", 0, 0, 0, 0}; + +const device dev_null_storage = +{"/dev/null", FH_NULL, "nul", 0, 0, 0, 0}; + +const device dev_zero_storage = +{"/dev/zero", FH_ZERO, "\\dev\\zero", 0, 0, 0, 0}; + +const device dev_random_storage = +{"/dev/random", FH_RANDOM, "\\dev\\random", 0, 0, 0, 0}; + +const device dev_urandom_storage = +{"/dev/urandom", FH_URANDOM, "\\dev\\urandom", 0, 0, 0, 0}; + +const device dev_mem_storage = +{"/dev/mem", FH_MEM, "\\dev\\mem", 0, 0, 0, 0}; + +const device dev_kmem_storage = +{"/dev/kmem", FH_KMEM, "\\dev\\mem", 0, 0, 0, 0}; + +const device dev_clipboard_storage = +{"/dev/clipboard", FH_CLIPBOARD, "\\dev\\clipboard", 0, 0, 0, 0}; + +const device dev_port_storage = +{"/dev/port", FH_PORT, "\\dev\\port", 0, 0, 0, 0}; + +const device dev_serial_storage = +{"/dev/com", FH_SERIAL, "\\.\\com%d", 1, 99}; + +const device dev_ttyS_storage = +{"/dev/ttyS", FH_SERIAL, "\\.\\com%d", 0, 99, -1}; + +const device dev_pipe_storage = +{"/dev/pipe", FH_PIPE, "\\dev\\pipe", 0, 0, 0, 0}; + +const device dev_fifo_storage = +{"/dev/fifo", FH_FIFO, "\\dev\\fifo", 0, 0, 0, 0}; + +const device dev_tape_storage = +{"/dev/st", FH_TAPE, "\\Device\\Tape%d", 0, 127}; + +const device dev_nst_storage = +{"/dev/nst", FH_NTAPE, "\\Device\\Tape%d", 0, 127}; + +const device dev_floppy_storage = +{"/dev/fd", FH_FLOPPY, "\\Device\\Floppy%d", 0, 15}; + +const device dev_cdrom_storage = +{"/dev/scd", FH_CDROM, "\\Device\\CdRom%d", 0, 15}; + +const device dev_sr_storage = +{"/dev/sr", FH_CDROM, "\\Device\\CdRom%d", 0, 15}; + +const device dev_hda_storage = +{"/dev/hda", FH_SDA, "\\Device\\Harddisk%d\\Partition%d", 1, 16, -1}; + +const device dev_hdb_storage = +{"/dev/hdb", FH_SDB, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 15}; + +const device dev_hdc_storage = +{"/dev/hdc", FH_SDC, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 31}; + +const device dev_hdd_storage = +{"/dev/hdd", FH_SDD, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 47}; + +const device dev_hde_storage = +{"/dev/hde", FH_SDE, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 63}; + +const device dev_hdf_storage = +{"/dev/hdf", FH_SDF, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 79}; + +const device dev_hdg_storage = +{"/dev/hdg", FH_SDG, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 95}; + +const device dev_hdh_storage = +{"/dev/hdh", FH_SDH, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 111}; + +const device dev_hdi_storage = +{"/dev/hdi", FH_SDI, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 127}; + +const device dev_hdj_storage = +{"/dev/hdj", FH_SDJ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 143}; + +const device dev_hdk_storage = +{"/dev/hdk", FH_SDK, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 159}; + +const device dev_hdl_storage = +{"/dev/hdl", FH_SDL, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 175}; + +const device dev_hdm_storage = +{"/dev/hdm", FH_SDM, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 191}; + +const device dev_hdn_storage = +{"/dev/hdn", FH_SDN, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 207}; + +const device dev_hdo_storage = +{"/dev/hdo", FH_SDO, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 223}; + +const device dev_hdp_storage = +{"/dev/hdp", FH_SDP, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 239}; + +const device dev_hdq_storage = +{"/dev/hdq", FH_SDQ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 255 /* FIXME 8 bit lunacy */}; + +const device dev_hdr_storage = +{"/dev/hdr", FH_SDR, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 271}; + +const device dev_hds_storage = +{"/dev/hds", FH_SDS, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 287}; + +const device dev_hdt_storage = +{"/dev/hdt", FH_SDT, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 303}; + +const device dev_hdu_storage = +{"/dev/hdu", FH_SDU, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 319}; + +const device dev_hdv_storage = +{"/dev/hdv", FH_SDV, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 335}; + +const device dev_hdw_storage = +{"/dev/hdw", FH_SDW, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 351}; + +const device dev_hdx_storage = +{"/dev/hdx", FH_SDX, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 367}; + +const device dev_hdy_storage = +{"/dev/hdy", FH_SDY, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 383}; + +const device dev_hdz_storage = +{"/dev/hdz", FH_SDZ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 399}; + +const device dev_rawdrive_storage = +{"/dev/rawdrive", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0}; + +const device dev_bad_storage = +{":bad:", FH_BAD, ":bad:", 0, 0, 0, 0}; +#define bad_dev (&dev_bad_storage) const device *unit_devices[] = { - &wordlist[123] /* cdrom */, - &wordlist[106] /* serial */, - &wordlist[197] /* ttym */, - &wordlist[204] /* ttys */, - &wordlist[133] /* floppy */, - &dev_tcp_storage /* tcp */, - &wordlist[270] /* rawdrive */, - &wordlist[117] /* tape */ + &dev_cdrom_storage, + &dev_serial_storage, + &dev_ttym_storage, + &dev_ttys_storage, + &dev_floppy_storage, + &dev_tcp_storage, + &dev_rawdrive_storage, + &dev_tape_storage }; const device *uniq_devices[] = { - &wordlist[157] /* bad */, - &dev_fs_storage /* fs */, - &dev_process_storage /* process */, - &dev_registry_storage /* registry */, - &dev_proc_storage /* proc */, - &wordlist[168] /* fifo */, - &dev_pipew_storage /* pipew */, - &dev_piper_storage /* piper */, - &wordlist[170] /* pipe */, - &wordlist[120] /* mem */, - &wordlist[174] /* kmem */, - &wordlist[233] /* null */, - &wordlist[257] /* zero */, - &wordlist[228] /* port */, - &wordlist[288] /* random */, - &wordlist[262] /* urandom */, - &wordlist[194] /* tty */, - &wordlist[209] /* console */, - &wordlist[149] /* ptym */, - &wordlist[207] /* conout */, - &wordlist[231] /* conin */, - &wordlist[190] /* clipboard */, - &wordlist[219] /* windows */, - &wordlist[132] /* oss_dsp */, - &wordlist[106] /* serial */ + &dev_bad_storage, + &dev_fs_storage, + &dev_process_storage, + &dev_registry_storage, + &dev_proc_storage, + &dev_fifo_storage, + &dev_pipew_storage, + &dev_piper_storage, + &dev_pipe_storage, + &dev_mem_storage, + &dev_kmem_storage, + &dev_null_storage, + &dev_zero_storage, + &dev_port_storage, + &dev_random_storage, + &dev_urandom_storage, + &dev_tty_storage, + &dev_console_storage, + &dev_ptym_storage, + &dev_conout_storage, + &dev_conin_storage, + &dev_clipboard_storage, + &dev_windows_storage, + &dev_oss_dsp_storage, + &dev_serial_storage }; -#ifdef __GNUC__ -__inline -#endif -const struct device * -device::lookup (register const char *str, register unsigned int len) + +static KR_device_t KR_find_keyword (const char *KR_keyword, int KR_length) { - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) + + switch (KR_length) { - register int key = devhash (str, len); + case 7: + switch (KR_keyword [6]) + { + case 't': + if (strncmp (KR_keyword, "/dev/st", 7) == 0) + { +{ +return &dev_tape_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'r': + if (strncmp (KR_keyword, "/dev/sr", 7) == 0) + { +{ +return &dev_sr_storage; + +} + } + else + { +{ +return NULL; - if (key <= MAX_HASH_VALUE && key >= 0) +} + } + case 'd': + if (strncmp (KR_keyword, "/dev/fd", 7) == 0) + { +{ +return &dev_floppy_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 8: + switch (KR_keyword [7]) { - register const char *s = wordlist[key].name; + case 'z': + if (strncmp (KR_keyword, "/dev/hdz", 8) == 0) + { +{ +return &dev_hdz_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'y': + switch (KR_keyword [5]) + { + case 't': + if (strncmp (KR_keyword, "/dev/tty", 8) == 0) + { +{ +return &dev_tty_storage; + +} + } + else + { +{ +return NULL; - if (strncasematch (str, s, len)) - return &wordlist[key]; +} + } + case 'h': + if (strncmp (KR_keyword, "/dev/hdy", 8) == 0) + { +{ +return &dev_hdy_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'x': + if (strncmp (KR_keyword, "/dev/hdx", 8) == 0) + { +{ +return &dev_hdx_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'w': + if (strncmp (KR_keyword, "/dev/hdw", 8) == 0) + { +{ +return &dev_hdw_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'v': + if (strncmp (KR_keyword, "/dev/hdv", 8) == 0) + { +{ +return &dev_hdv_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'u': + if (strncmp (KR_keyword, "/dev/hdu", 8) == 0) + { +{ +return &dev_hdu_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 't': + switch (KR_keyword [5]) + { + case 'n': + if (strncmp (KR_keyword, "/dev/nst", 8) == 0) + { +{ +return &dev_nst_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'h': + if (strncmp (KR_keyword, "/dev/hdt", 8) == 0) + { +{ +return &dev_hdt_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 's': + if (strncmp (KR_keyword, "/dev/hds", 8) == 0) + { +{ +return &dev_hds_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'r': + if (strncmp (KR_keyword, "/dev/hdr", 8) == 0) + { +{ +return &dev_hdr_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'q': + if (strncmp (KR_keyword, "/dev/hdq", 8) == 0) + { +{ +return &dev_hdq_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'p': + switch (KR_keyword [5]) + { + case 'h': + if (strncmp (KR_keyword, "/dev/hdp", 8) == 0) + { +{ +return &dev_hdp_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'd': + if (strncmp (KR_keyword, "/dev/dsp", 8) == 0) + { +{ +return &dev_oss_dsp_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'o': + if (strncmp (KR_keyword, "/dev/hdo", 8) == 0) + { +{ +return &dev_hdo_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'n': + if (strncmp (KR_keyword, "/dev/hdn", 8) == 0) + { +{ +return &dev_hdn_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'm': + switch (KR_keyword [5]) + { + case 'm': + if (strncmp (KR_keyword, "/dev/mem", 8) == 0) + { +{ +return &dev_mem_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'h': + if (strncmp (KR_keyword, "/dev/hdm", 8) == 0) + { +{ +return &dev_hdm_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'c': + if (strncmp (KR_keyword, "/dev/com", 8) == 0) + { +{ +return &dev_serial_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'l': + if (strncmp (KR_keyword, "/dev/hdl", 8) == 0) + { +{ +return &dev_hdl_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'k': + if (strncmp (KR_keyword, "/dev/hdk", 8) == 0) + { +{ +return &dev_hdk_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'j': + if (strncmp (KR_keyword, "/dev/hdj", 8) == 0) + { +{ +return &dev_hdj_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'i': + if (strncmp (KR_keyword, "/dev/hdi", 8) == 0) + { +{ +return &dev_hdi_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'h': + if (strncmp (KR_keyword, "/dev/hdh", 8) == 0) + { +{ +return &dev_hdh_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'g': + if (strncmp (KR_keyword, "/dev/hdg", 8) == 0) + { +{ +return &dev_hdg_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'f': + if (strncmp (KR_keyword, "/dev/hdf", 8) == 0) + { +{ +return &dev_hdf_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'e': + if (strncmp (KR_keyword, "/dev/hde", 8) == 0) + { +{ +return &dev_hde_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'd': + switch (KR_keyword [5]) + { + case 's': + if (strncmp (KR_keyword, "/dev/scd", 8) == 0) + { +{ +return &dev_cdrom_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'h': + if (strncmp (KR_keyword, "/dev/hdd", 8) == 0) + { +{ +return &dev_hdd_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'c': + if (strncmp (KR_keyword, "/dev/hdc", 8) == 0) + { +{ +return &dev_hdc_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'b': + if (strncmp (KR_keyword, "/dev/hdb", 8) == 0) + { +{ +return &dev_hdb_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'a': + if (strncmp (KR_keyword, "/dev/hda", 8) == 0) + { +{ +return &dev_hda_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 9: + switch (KR_keyword [8]) + { + case 'x': + if (strncmp (KR_keyword, "/dev/ptmx", 9) == 0) + { +{ +return &dev_ptym_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 't': + if (strncmp (KR_keyword, "/dev/port", 9) == 0) + { +{ +return &dev_port_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 's': + if (strncmp (KR_keyword, "/dev/ttys", 9) == 0) + { +{ +return &dev_ttys_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'o': + switch (KR_keyword [5]) + { + case 'z': + if (strncmp (KR_keyword, "/dev/zero", 9) == 0) + { +{ +return &dev_zero_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'f': + if (strncmp (KR_keyword, "/dev/fifo", 9) == 0) + { +{ +return &dev_fifo_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'm': + switch (KR_keyword [5]) + { + case 't': + if (strncmp (KR_keyword, "/dev/ttym", 9) == 0) + { +{ +return &dev_ttym_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'k': + if (strncmp (KR_keyword, "/dev/kmem", 9) == 0) + { +{ +return &dev_kmem_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 'l': + if (strncmp (KR_keyword, "/dev/null", 9) == 0) + { +{ +return &dev_null_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'e': + if (strncmp (KR_keyword, "/dev/pipe", 9) == 0) + { +{ +return &dev_pipe_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'S': + if (strncmp (KR_keyword, "/dev/ttyS", 9) == 0) + { +{ +return &dev_ttyS_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} } + case 10: + if (strncmp (KR_keyword, "/dev/conin", 10) == 0) + { +{ +return &dev_conin_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 11: + switch (KR_keyword [5]) + { + case 'r': + if (strncmp (KR_keyword, "/dev/random", 11) == 0) + { +{ +return &dev_random_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'c': + if (strncmp (KR_keyword, "/dev/conout", 11) == 0) + { +{ +return &dev_conout_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 12: + switch (KR_keyword [5]) + { + case 'w': + if (strncmp (KR_keyword, "/dev/windows", 12) == 0) + { +{ +return &dev_windows_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'u': + if (strncmp (KR_keyword, "/dev/urandom", 12) == 0) + { +{ +return &dev_urandom_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 'c': + if (strncmp (KR_keyword, "/dev/console", 12) == 0) + { +{ +return &dev_console_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} + } + case 13: + if (strncmp (KR_keyword, "/dev/rawdrive", 13) == 0) + { +{ +return &dev_rawdrive_storage; + +} + } + else + { +{ +return NULL; + +} + } + case 14: + if (strncmp (KR_keyword, "/dev/clipboard", 14) == 0) + { +{ +return &dev_clipboard_storage; + +} + } + else + { +{ +return NULL; + +} + } + default: +{ +return NULL; + +} } - return 0; } + + + + + + void device::parse (const char *s) { size_t len = strlen (s); - const device *dev = lookup (s, len); + const device *dev = KR_find_keyword (s, len); unsigned unit = 0; if (!dev || !*dev) @@ -359,7 +1194,7 @@ device::parse (const char *s) continue; if (++len < prior_len) { - dev = lookup (s, len); + dev = KR_find_keyword (s, len); if (!dev || (!dev->upper && !dev->devn == FH_TTY)) dev = NULL; else @@ -414,7 +1249,7 @@ device::parse (_major_t major, _minor_t minor) *this = *uniq_devices[i]; break; } - + out: if (!*this) devn = FHDEV (major, minor); @@ -438,3 +1273,5 @@ device::tty_to_real_device () setunit (myself->ctty); } } + + |