Remove file that was supposed to have disappeared a month ago.
This commit is contained in:
parent
504678827a
commit
13d5cc4020
|
@ -1,166 +0,0 @@
|
|||
%{
|
||||
#include "winsup.h"
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "devices.h"
|
||||
#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)
|
||||
|
||||
%}
|
||||
struct device;
|
||||
%%
|
||||
"/dev/tty", FH_TTY, "\\dev\\tty", 0, 0, 0, 0
|
||||
"/dev/ttys", FH_TTYS, "\\dev\\tty%d", 0, 255, 0, 0
|
||||
"/dev/console", FH_CONSOLE, "\\dev\\console", 0, 0, 0, 0
|
||||
"/dev/ttym", FH_TTYM, "\\dev\\ttym", 0, 255, 0, 0
|
||||
"/dev/ptmx", FH_PTYM, "\\dev\\ptmx", 0, 0, 0, 0
|
||||
"/dev/windows", FH_WINDOWS, "\\dev\\windows", 0, 0, 0, 0
|
||||
"/dev/dsp", FH_OSS_DSP, "\\dev\\dsp", 0, 0, 0, 0
|
||||
"/dev/conin", FH_CONIN, "conin", 0, 0, 0, 0
|
||||
"/dev/conout", FH_CONOUT, "conout", 0, 0, 0, 0
|
||||
"/dev/null", FH_NULL, "nul", 0, 0, 0, 0
|
||||
"/dev/zero", FH_ZERO, "\\dev\\zero", 0, 0, 0, 0
|
||||
"/dev/random", FH_RANDOM, "\\dev\\random", 0, 0, 0, 0
|
||||
"/dev/urandom", FH_URANDOM, "\\dev\\urandom", 0, 0, 0, 0
|
||||
"/dev/mem", FH_MEM, "\\dev\\mem", 0, 0, 0, 0
|
||||
"/dev/kmem", FH_KMEM, "\\dev\\mem", 0, 0, 0, 0
|
||||
"/dev/clipboard", FH_CLIPBOARD, "\\dev\\clipboard", 0, 0, 0, 0
|
||||
"/dev/port", FH_PORT, "\\dev\\port", 0, 0, 0, 0
|
||||
"/dev/com", FH_SERIAL, "\\.\\com%d", 1, 99
|
||||
"/dev/ttyS", FH_SERIAL, "\\.\\com%d", 0, 99, -1
|
||||
"/dev/pipe", FH_PIPE, "\\dev\\pipe", 0, 0, 0, 0
|
||||
"/dev/fifo", FH_FIFO, "\\dev\\fifo", 0, 0, 0, 0
|
||||
"/dev/st", FH_TAPE, "\\Device\\Tape%d", 0, 127
|
||||
"/dev/nst", FH_NTAPE, "\\Device\\Tape%d", 0, 127
|
||||
"/dev/fd", FH_FLOPPY, "\\Device\\Floppy%d", 0, 15
|
||||
"/dev/scd", FH_CDROM, "\\Device\\CdRom%d", 0, 15
|
||||
"/dev/sr", FH_CDROM, "\\Device\\CdRom%d", 0, 15
|
||||
"/dev/hda", FH_SDA, "\\Device\\Harddisk%d\\Partition%d", 1, 16, -1
|
||||
"/dev/hdb", FH_SDB, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 15
|
||||
"/dev/hdc", FH_SDC, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 31
|
||||
"/dev/hdd", FH_SDD, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 47
|
||||
"/dev/hde", FH_SDE, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 63
|
||||
"/dev/hdf", FH_SDF, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 79
|
||||
"/dev/hdg", FH_SDG, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 95
|
||||
"/dev/hdh", FH_SDH, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 111
|
||||
"/dev/hdi", FH_SDI, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 127
|
||||
"/dev/hdj", FH_SDJ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 143
|
||||
"/dev/hdk", FH_SDK, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 159
|
||||
"/dev/hdl", FH_SDL, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 175
|
||||
"/dev/hdm", FH_SDM, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 191
|
||||
"/dev/hdn", FH_SDN, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 207
|
||||
"/dev/hdo", FH_SDO, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 223
|
||||
"/dev/hdp", FH_SDP, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 239
|
||||
"/dev/hdq", FH_SDQ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 255 /* FIXME 8 bit lunacy */
|
||||
"/dev/hdr", FH_SDR, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 271
|
||||
"/dev/hds", FH_SDS, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 287
|
||||
"/dev/hdt", FH_SDT, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 303
|
||||
"/dev/hdu", FH_SDU, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 319
|
||||
"/dev/hdv", FH_SDV, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 335
|
||||
"/dev/hdw", FH_SDW, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 351
|
||||
"/dev/hdx", FH_SDX, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 367
|
||||
"/dev/hdy", FH_SDY, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 383
|
||||
"/dev/hdz", FH_SDZ, "\\Device\\Harddisk%d\\Partition%d", 1, 16, 399
|
||||
"/dev/rawdrive", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
|
||||
":bad:", FH_BAD, ":bad:", 0, 0, 0, 0
|
||||
%%
|
||||
void
|
||||
device::parse (const char *s)
|
||||
{
|
||||
size_t len = strlen (s);
|
||||
const device *dev = lookup (s, len);
|
||||
unsigned unit = 0;
|
||||
|
||||
if (!dev || !*dev)
|
||||
{
|
||||
size_t prior_len = len;
|
||||
while (len-- > 0 && isdigit (s[len]))
|
||||
continue;
|
||||
if (++len < prior_len)
|
||||
{
|
||||
dev = lookup (s, len);
|
||||
if (!dev || !dev->upper)
|
||||
dev = NULL;
|
||||
else
|
||||
{
|
||||
unsigned n = atoi (s + len);
|
||||
if (dev->devn == FH_TTY)
|
||||
dev = ttys_dev; // SIGH
|
||||
if (n >= dev->lower && n <= dev->upper)
|
||||
unit = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev || !*dev)
|
||||
*this = *fs_dev;
|
||||
else if (dev->devn == FH_TTY)
|
||||
tty_to_real_device ();
|
||||
else
|
||||
{
|
||||
*this = *dev;
|
||||
if (!setunit (unit))
|
||||
devn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
device::init ()
|
||||
{
|
||||
/* nothing to do... yet */
|
||||
}
|
||||
|
||||
void
|
||||
device::parse (_major_t major, _minor_t minor)
|
||||
{
|
||||
_dev_t dev = FHDEV (major, 0);
|
||||
|
||||
devn = 0;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < (sizeof (unit_devices) / sizeof (unit_devices[0])); i++)
|
||||
if (unit_devices[i]->devn == dev)
|
||||
{
|
||||
*this = *unit_devices[i];
|
||||
this->setunit (minor);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev = FHDEV (major, minor);
|
||||
for (i = 0; i < (sizeof (uniq_devices) / sizeof (uniq_devices[0])); i++)
|
||||
if (uniq_devices[i]->devn == dev)
|
||||
{
|
||||
*this = *uniq_devices[i];
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
if (!*this)
|
||||
devn = FHDEV (major, minor);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
device::parse (_dev_t dev)
|
||||
{
|
||||
parse (_major (dev), _minor (dev));
|
||||
}
|
||||
|
||||
void
|
||||
device::tty_to_real_device ()
|
||||
{
|
||||
if (!real_tty_attached (myself))
|
||||
*this = myself->ctty < 0 ? *bad_dev : *console_dev;
|
||||
else
|
||||
{
|
||||
*this = *ttys_dev;
|
||||
setunit (myself->ctty);
|
||||
}
|
||||
}
|
|
@ -1,403 +0,0 @@
|
|||
%import {
|
||||
#include "winsup.h"
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "devices.h"
|
||||
#include "sys/cygwin.h"
|
||||
#include "tty.h"
|
||||
#include "pinfo.h"
|
||||
typedef const device *KR_device_t;
|
||||
}
|
||||
%type KR_device_t
|
||||
%local {
|
||||
const device dev_cygdrive_storage =
|
||||
{"/cygdrive", FH_CYGDRIVE, "/cygdrive", 0, 0, 0, 0};
|
||||
|
||||
const device dev_fs_storage =
|
||||
{"", FH_FS, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_proc_storage =
|
||||
{"", FH_PROC, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_registry_storage =
|
||||
{"", FH_REGISTRY, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_process_storage =
|
||||
{"", FH_PROCESS, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_tcp_storage =
|
||||
{"/dev/inet/tcp", FH_TCP, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_udp_storage =
|
||||
{"/dev/inet/udp", FH_UDP, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_icmp_storage =
|
||||
{"/dev/inet/icmp", FH_ICMP, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_unix_storage =
|
||||
{"/dev/inet/unix", FH_UNIX, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_stream_storage =
|
||||
{"/dev/inet/stream", FH_STREAM, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_dgram_storage =
|
||||
{"/dev/inet/dgram", FH_DGRAM, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_piper_storage =
|
||||
{"", FH_PIPER, "", 0, 0, 0, 0};
|
||||
|
||||
const device dev_pipew_storage =
|
||||
{"", FH_PIPEW, "", 0, 0, 0, 0};
|
||||
|
||||
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_sda_storage =
|
||||
{"/dev/sda", FH_SDA, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 0};
|
||||
|
||||
const device dev_sdb_storage =
|
||||
{"/dev/sdb", FH_SDB, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 16};
|
||||
|
||||
const device dev_sdc_storage =
|
||||
{"/dev/sdc", FH_SDC, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 32};
|
||||
|
||||
const device dev_sdd_storage =
|
||||
{"/dev/sdd", FH_SDD, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 48};
|
||||
|
||||
const device dev_sde_storage =
|
||||
{"/dev/sde", FH_SDE, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 64};
|
||||
|
||||
const device dev_sdf_storage =
|
||||
{"/dev/sdf", FH_SDF, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 80};
|
||||
|
||||
const device dev_sdg_storage =
|
||||
{"/dev/sdg", FH_SDG, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 96};
|
||||
|
||||
const device dev_sdh_storage =
|
||||
{"/dev/sdh", FH_SDH, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 112};
|
||||
|
||||
const device dev_sdi_storage =
|
||||
{"/dev/sdi", FH_SDI, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 128};
|
||||
|
||||
const device dev_sdj_storage =
|
||||
{"/dev/sdj", FH_SDJ, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 144};
|
||||
|
||||
const device dev_sdk_storage =
|
||||
{"/dev/sdk", FH_SDK, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 160};
|
||||
|
||||
const device dev_sdl_storage =
|
||||
{"/dev/sdl", FH_SDL, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 176};
|
||||
|
||||
const device dev_sdm_storage =
|
||||
{"/dev/sdm", FH_SDM, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 192};
|
||||
|
||||
const device dev_sdn_storage =
|
||||
{"/dev/sdn", FH_SDN, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 208};
|
||||
|
||||
const device dev_sdo_storage =
|
||||
{"/dev/sdo", FH_SDO, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 224};
|
||||
|
||||
const device dev_sdp_storage =
|
||||
{"/dev/sdp", FH_SDP, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 240};
|
||||
|
||||
const device dev_sdq_storage =
|
||||
{"/dev/sdq", FH_SDQ, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 256};
|
||||
|
||||
const device dev_sdr_storage =
|
||||
{"/dev/sdr", FH_SDR, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 272};
|
||||
|
||||
const device dev_sds_storage =
|
||||
{"/dev/sds", FH_SDS, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 288};
|
||||
|
||||
const device dev_sdt_storage =
|
||||
{"/dev/sdt", FH_SDT, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 304};
|
||||
|
||||
const device dev_sdu_storage =
|
||||
{"/dev/sdu", FH_SDU, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 320};
|
||||
|
||||
const device dev_sdv_storage =
|
||||
{"/dev/sdv", FH_SDV, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 336};
|
||||
|
||||
const device dev_sdw_storage =
|
||||
{"/dev/sdw", FH_SDW, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 352};
|
||||
|
||||
const device dev_sdx_storage =
|
||||
{"/dev/sdx", FH_SDX, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 368};
|
||||
|
||||
const device dev_sdy_storage =
|
||||
{"/dev/sdy", FH_SDY, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 384};
|
||||
|
||||
const device dev_sdz_storage =
|
||||
{"/dev/sdz", FH_SDZ, "\\Device\\Harddisk%d\\Partition%d", 1, 15, 400};
|
||||
|
||||
const device dev_bad_storage =
|
||||
{":bad:", FH_BAD, ":bad:", 0, 0, 0, 0};
|
||||
#define bad_dev (&dev_bad_storage)
|
||||
|
||||
const device *unit_devices[] =
|
||||
{
|
||||
&dev_cdrom_storage,
|
||||
&dev_serial_storage,
|
||||
&dev_ttym_storage,
|
||||
&dev_ttys_storage,
|
||||
&dev_floppy_storage,
|
||||
&dev_tcp_storage,
|
||||
&dev_tape_storage
|
||||
};
|
||||
|
||||
const device *uniq_devices[] =
|
||||
{
|
||||
&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
|
||||
};
|
||||
}
|
||||
%%
|
||||
"/dev/tty" = tty {return &dev_tty_storage;}
|
||||
"/dev/ttys" = ttys {return &dev_ttys_storage;}
|
||||
"/dev/console" = console {return &dev_console_storage;}
|
||||
"/dev/ttym" = ttym {return &dev_ttym_storage;}
|
||||
"/dev/ptmx" = ptmx {return &dev_ptym_storage;}
|
||||
"/dev/windows" = windows {return &dev_windows_storage;}
|
||||
"/dev/dsp" = dsp {return &dev_oss_dsp_storage;}
|
||||
"/dev/conin" = conin {return &dev_conin_storage;}
|
||||
"/dev/conout" = conout {return &dev_conout_storage;}
|
||||
"/dev/null" = null {return &dev_null_storage;}
|
||||
"/dev/zero" = zero {return &dev_zero_storage;}
|
||||
"/dev/random" = random {return &dev_random_storage;}
|
||||
"/dev/urandom" = urandom {return &dev_urandom_storage;}
|
||||
"/dev/mem" = mem {return &dev_mem_storage;}
|
||||
"/dev/kmem" = kmem {return &dev_kmem_storage;}
|
||||
"/dev/clipboard" = clipboard {return &dev_clipboard_storage;}
|
||||
"/dev/port" = port {return &dev_port_storage;}
|
||||
"/dev/com" = com {return &dev_serial_storage;}
|
||||
"/dev/ttyS" = ttyS {return &dev_ttyS_storage;}
|
||||
"/dev/pipe" = pipe {return &dev_pipe_storage;}
|
||||
"/dev/fifo" = fifo {return &dev_fifo_storage;}
|
||||
"/dev/st" = st {return &dev_tape_storage;}
|
||||
"/dev/nst" = nst {return &dev_nst_storage;}
|
||||
"/dev/fd" = fd {return &dev_floppy_storage;}
|
||||
"/dev/scd" = scd {return &dev_cdrom_storage;}
|
||||
"/dev/sr" = sr {return &dev_sr_storage;}
|
||||
"/dev/sda" = sda {return &dev_sda_storage;}
|
||||
"/dev/sdb" = sdb {return &dev_sdb_storage;}
|
||||
"/dev/sdc" = sdc {return &dev_sdc_storage;}
|
||||
"/dev/sdd" = sdd {return &dev_sdd_storage;}
|
||||
"/dev/sde" = sde {return &dev_sde_storage;}
|
||||
"/dev/sdf" = sdf {return &dev_sdf_storage;}
|
||||
"/dev/sdg" = sdg {return &dev_sdg_storage;}
|
||||
"/dev/sdh" = sdh {return &dev_sdh_storage;}
|
||||
"/dev/sdi" = sdi {return &dev_sdi_storage;}
|
||||
"/dev/sdj" = sdj {return &dev_sdj_storage;}
|
||||
"/dev/sdk" = sdk {return &dev_sdk_storage;}
|
||||
"/dev/sdl" = sdl {return &dev_sdl_storage;}
|
||||
"/dev/sdm" = sdm {return &dev_sdm_storage;}
|
||||
"/dev/sdn" = sdn {return &dev_sdn_storage;}
|
||||
"/dev/sdo" = sdo {return &dev_sdo_storage;}
|
||||
"/dev/sdp" = sdp {return &dev_sdp_storage;}
|
||||
"/dev/sdq" = sdq {return &dev_sdq_storage;}
|
||||
"/dev/sdr" = sdr {return &dev_sdr_storage;}
|
||||
"/dev/sds" = sds {return &dev_sds_storage;}
|
||||
"/dev/sdt" = sdt {return &dev_sdt_storage;}
|
||||
"/dev/sdu" = sdu {return &dev_sdu_storage;}
|
||||
"/dev/sdv" = sdv {return &dev_sdv_storage;}
|
||||
"/dev/sdw" = sdw {return &dev_sdw_storage;}
|
||||
"/dev/sdx" = sdx {return &dev_sdx_storage;}
|
||||
"/dev/sdy" = sdy {return &dev_sdy_storage;}
|
||||
"/dev/sdz" = sdz {return &dev_sdz_storage;}
|
||||
%other {return NULL;}
|
||||
%%
|
||||
void
|
||||
device::parse (const char *s)
|
||||
{
|
||||
size_t len = strlen (s);
|
||||
const device *dev = KR_find_keyword (s, len);
|
||||
unsigned unit = 0;
|
||||
|
||||
if (!dev || !*dev)
|
||||
{
|
||||
size_t prior_len = len;
|
||||
while (len-- > 0 && isdigit (s[len]))
|
||||
continue;
|
||||
if (++len < prior_len)
|
||||
{
|
||||
dev = KR_find_keyword (s, len);
|
||||
if (!dev || (!dev->upper && dev->devn != FH_TTY))
|
||||
dev = NULL;
|
||||
else
|
||||
{
|
||||
unsigned n = atoi (s + len);
|
||||
if (dev->devn == FH_TTY)
|
||||
dev = ttys_dev; // SIGH
|
||||
if (n >= dev->lower && n <= dev->upper)
|
||||
unit = n;
|
||||
else
|
||||
dev = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev || !*dev)
|
||||
*this = *fs_dev;
|
||||
else if (dev->devn == FH_TTY)
|
||||
tty_to_real_device ();
|
||||
else
|
||||
{
|
||||
*this = *dev;
|
||||
if (!setunit (unit))
|
||||
devn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
device::init ()
|
||||
{
|
||||
/* nothing to do... yet */
|
||||
}
|
||||
|
||||
void
|
||||
device::parse (_major_t major, _minor_t minor)
|
||||
{
|
||||
_dev_t dev = FHDEV (major, 0);
|
||||
|
||||
devn = 0;
|
||||
|
||||
unsigned i;
|
||||
for (i = 0; i < (sizeof (unit_devices) / sizeof (unit_devices[0])); i++)
|
||||
if (unit_devices[i]->devn == dev)
|
||||
{
|
||||
*this = *unit_devices[i];
|
||||
this->setunit (minor);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev = FHDEV (major, minor);
|
||||
for (i = 0; i < (sizeof (uniq_devices) / sizeof (uniq_devices[0])); i++)
|
||||
if (uniq_devices[i]->devn == dev)
|
||||
{
|
||||
*this = *uniq_devices[i];
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
if (!*this)
|
||||
devn = FHDEV (major, minor);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
device::parse (_dev_t dev)
|
||||
{
|
||||
parse (_major (dev), _minor (dev));
|
||||
}
|
||||
|
||||
void
|
||||
device::tty_to_real_device ()
|
||||
{
|
||||
if (!real_tty_attached (myself))
|
||||
*this = myself->ctty < 0 ? *bad_dev : *console_dev;
|
||||
else
|
||||
{
|
||||
*this = *ttys_dev;
|
||||
setunit (myself->ctty);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue