remove errnoneously added files

This commit is contained in:
Christopher Faylor 2003-01-16 01:57:08 +00:00
parent 188132541b
commit df9b825c9f
3 changed files with 0 additions and 446 deletions

View File

@ -1,116 +0,0 @@
#!/usr/bin/perl
use strict;
sub read_devices($%);
my $infile = shift;
my $incfile = shift;
open(GPERF, "gperf -c --key-positions='1-2,5-7,9-10' -r -t -C -E " .
"-T -L 'ANSI-C' -Hdevhash -N'device::lookup' -Z devstring " .
"-7 -G $infile |");
my @lines = <GPERF>;
my $ix = 0;
my $i = 0;
my $n = -1;
my $findclose = 0;
my $add_device = '';
my %fh_static;
my %fh_declare = (
'cygdrive_dev' => '&cygdrive_dev_storage',
'fs_dev' => '&fs_dev_storage',
'proc_dev' => '&proc_dev_storage',
'registry_dev' => '&registry_dev_storage',
'process_dev' => '&process_dev_storage'
);
foreach (@lines) {
$i++;
s/\[(str\[[^\]]*\])\]/[(unsigned) cyg_tolower ($1)]/o and next;
s/static (.* )wordlist/static NO_COPY $1wordlist/o and do {
$findclose = 1;
};
s/([ ]*)if \(\*str.*$/$1if (strncasematch (str, s, len))/o and next;
$findclose and /};/o and do {
$_ .= "\n";
$_ .=<<'EOF';
static const device cygdrive_dev_storage =
{"/cygdrive", FH_CYGDRIVE, "/cygdrive", 0, 0, 0, 0};
static const device fs_dev_storage =
{"", FH_CYGDRIVE, "", 0, 0, 0, 0};
static const device proc_dev_storage =
{"", FH_PROC, "", 0, 0, 0, 0};
static const device registry_dev_storage =
{"", FH_REGISTRY, "", 0, 0, 0, 0};
static const device process_dev_storage =
{"", FH_PROCESS, "", 0, 0, 0, 0};
EOF
for my $f (sort keys %fh_declare) {
$_ .= "const device *$f = $fh_declare{$f};\n";
}
$_ .= "\n";
$_ .= read_devices($incfile, %fh_declare);
$findclose = 0;
};
/^(\s+)(\{".*)/ or next;
my $indent = $1;
my $rest = $2;
for my $f ($rest =~ /\{([^}]+)\}/g) {
$f eq '""' and do {
$ix++;
next;
};
my ($str, $fh) = (split(/, /, $f))[0..1];
if ($str !~ "/dev") {
$ix++;
} else {
my $what = lc(($fh =~ /FH_(.+)/o)[0]) . '_dev' ;
my $addon = '';
while (defined $fh_static{$what . $addon} &&
$fh_static{$what . $addon} ne $f) {
$addon++;
}
$what .= $addon;
$fh_static{$what} = $f;
$fh_declare{$what} = "wordlist + $ix";
$ix++;
}
}
}
print @lines;
sub read_devices($%) {
my $fn = shift;
my %fh_declare = @_;
open(F, "$fn") or die "$0: couldn't open $fn - $!\n";
my (%dev, %fh);
local $_;
while (<F>) {
/^\s*DEV_([A-Z_0-9]+)_MAJOR\s*=\s*(\d+)/ and do {
my $a = sprintf "%08d", $2;
$dev{$2} = $fh_declare{lc($1) . '_dev'} . " /* \L$1 */";
next;
};
/^\s*FH_([A-Z_0-9]+)\s*=\s*FHDEV\s*\((\d+),\s*(\d+)\)/ and do {
my $a = sprintf "%08d.%08d", $2, $3;
$fh{$a} = $fh_declare{lc($1) . '_dev'} . " /* \L$1 */";
};
};
close F;
my $toprint = '';
$toprint = "const device *unit_devices[] =\n{";
for my $f (sort keys %dev) {
$toprint .= "\n $dev{$f},";
}
chop $toprint;
$toprint .= "\n};\n\nconst device *uniq_devices[] = \n{";
for my $f (sort keys %fh) {
$toprint .= "\n $fh{$f},";
}
chop $toprint;
$toprint .= "\n};\n";
return $toprint;
}

View File

@ -1,201 +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)));
%}
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/piper", FH_PIPER, "\\dev\\piper", 0, 0, 0, 0
"/dev/pipew", FH_PIPEW, "\\dev\\pipew", 0, 0, 0, 0
"/dev/fifo", FH_FIFO, "\\dev\\fifo", 0, 0, 0, 0
"/dev/streamsocket", FH_SOCKET, "\\dev\\socket", 0, 0, 0, 0
"/dev/tcp", FH_SOCKET, "\\dev\\socket", 0, 0, 0, 0
"/dev/udp", FH_SOCKET, "\\dev\\socket", 0, 0, 0, 0
"/dev/dgsocket", FH_SOCKET, "\\dev\\socket", 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/sd", FH_SD, "\\Device\\Harddisk%d\\Partition%d", 'a', 'z', -'a', 16
"/dev/tape", FH_TAPE, "\\Device\\Tape%d", 0, 127, 0, 0
"/dev/ntape", FH_NTAPE, "\\Device\\Tape%d", 0, 127, 128, 0
"\\\\.\\tape", FH_TAPE, "\\Device\\Tape%d", 0, 127, 0, 0
"\\\\.\\ntape", FH_NTAPE, "\\Device\\Tape%d", 0, 127, 128, 0
"\\\\.\\physicaldrive", FH_SD, "\\Device\\Harddisk%d\\Partition%d", 0, 224, 0, 16
"/dev/rawdrive", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\a:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\b:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\c:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\d:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\e:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\f:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\g:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\h:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\i:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\j:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\k:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\l:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\m:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\n:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\o:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\p:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\q:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\r:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\s:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\t:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\u:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\v:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\w:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\x:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\y:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"\\\\.\\z:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"////.//tape", FH_TAPE, "//Device//Tape%d", 0, 127, 0, 0
"////.//ntape", FH_NTAPE, "//Device//Tape%d", 0, 127, 128, 0
"//./physicaldrive", FH_SD, "\\Device\\Harddisk%d\\Partition%d", 0, 224, 0, 16
"//./a:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./b:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./c:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./d:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./e:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./f:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./g:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./h:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./i:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./j:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./k:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./l:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./m:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./n:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./o:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./p:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./q:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./r:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./s:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./t:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./u:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./v:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./w:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./x:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./y:", FH_RAWDRIVE, "\\DosDevices\\%c:", 0, 0, 0, 0
"//./z:", FH_RAWDRIVE, "\\DosDevices\\%c:", 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->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;
}
}
}
if (!dev || !*dev)
devn = 0;
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:
return;
}
void
device::parse (_dev_t dev)
{
parse (_major (dev), _minor (dev));
}
void
device::tty_to_real_device ()
{
if (!real_tty_attached (myself))
*this = *console_dev;
else
{
*this = *ttys_dev;
setunit (myself->ctty);
}
}

View File

@ -1,129 +0,0 @@
/* devices.h
Copyright 2002 Red Hat, Inc.
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. */
typedef unsigned short _major_t;
typedef unsigned short _minor_t;
typedef mode_t _mode_t;
typedef __dev32_t _dev_t;
#define FHDEV(maj, min) ((((unsigned) (maj)) << (sizeof (_major_t) * 8)) | (unsigned) (min))
#define _minor(dev) ((dev) & ((1 << (sizeof (_minor_t) * 8)) - 1))
#define _major(dev) ((dev) >> (sizeof (_major_t) * 8))
enum fh_devices
{
FH_TTY = FHDEV (5, 0),
FH_CONSOLE = FHDEV (5, 1),
FH_PTYM = FHDEV (5, 2), /* /dev/ptmx */
FH_CONIN = FHDEV (5, 255),
FH_CONOUT = FHDEV (5, 254),
DEV_TTYM_MAJOR = 128,
FH_TTYM = FHDEV (DEV_TTYM_MAJOR, 0),
FH_TTYM_MAX= FHDEV (DEV_TTYM_MAJOR, 255),
DEV_TTYS_MAJOR = 136,
FH_TTYS = FHDEV (DEV_TTYS_MAJOR, 0), /* FIXME: Should separate ttys and ptys */
FH_TTYS_MAX= FHDEV (DEV_TTYS_MAJOR, 255), /* FIXME: Should separate ttys and ptys */
DEV_SERIAL_MAJOR = 117,
FH_SERIAL = FHDEV (117, 0), /* /dev/ttyS? */
FH_WINDOWS = FHDEV (13, 255),
FH_CLIPBOARD=FHDEV (13, 254),
FH_PIPE = FHDEV (0, 255),
FH_PIPER = FHDEV (0, 254),
FH_PIPEW = FHDEV (0, 253),
FH_FIFO = FHDEV (0, 252),
FH_SOCKET = FHDEV (0, 251),
FH_PROC = FHDEV (0, 250),
FH_REGISTRY= FHDEV (0, 249),
FH_PROCESS = FHDEV (0, 248),
FH_FS = FHDEV (0, 247), /* filesystem based device */
DEV_FLOPPY_MAJOR = 2,
FH_FLOPPY = FHDEV (DEV_FLOPPY_MAJOR, 0),
DEV_CDROM_MAJOR = 11,
FH_CDROM = FHDEV (DEV_CDROM_MAJOR, 0),
DEV_TAPE_MAJOR = 9,
FH_TAPE = FHDEV (DEV_TAPE_MAJOR, 0),
FH_NTAPE = FHDEV (DEV_TAPE_MAJOR, 128),
FH_MAXNTAPE= FHDEV (DEV_TAPE_MAJOR, 255),
DEV_SD_MAJOR = 8,
FH_SD = FHDEV (8, 0),
FH_MEM = FHDEV (1, 1),
FH_KMEM = FHDEV (1, 2), /* not implemented yet */
FH_NULL = FHDEV (1, 3),
FH_ZERO = FHDEV (1, 4),
FH_PORT = FHDEV (1, 5),
FH_RANDOM = FHDEV (1, 8),
FH_URANDOM = FHDEV (1, 9),
FH_OSS_DSP = FHDEV (14, 3),
DEV_CYGDRIVE_MAJOR = 30,
FH_CYGDRIVE= FHDEV (DEV_CYGDRIVE_MAJOR, 0),
FH_CYGDRIVE_A= FHDEV (DEV_CYGDRIVE_MAJOR, 'a'),
FH_CYGDRIVE_Z= FHDEV (DEV_CYGDRIVE_MAJOR, 'z'),
DEV_RAWDRIVE_MAJOR = 65,
FH_RAWDRIVE= FHDEV (DEV_RAWDRIVE_MAJOR, 0),
FH_BAD = 0
};
struct device
{
const char *name;
union
{
_dev_t devn;
struct
{
_minor_t minor;
_major_t major;
};
};
const char *fmt;
unsigned lower, upper;
int adjust;
unsigned mul;
_mode_t mode;
bool dev_on_fs;
static const device *lookup (const char *, unsigned int = 0xffffffff);
void parse (const char *);
void parse (_major_t major, _minor_t minor);
void parse (_dev_t dev);
inline bool setunit (unsigned n)
{
if (mul && n > mul)
return false;
minor += (n + adjust) * (mul ?: 1);
return true;
}
static void init ();
void tty_to_real_device ();
inline operator int () const {return devn;}
inline void setfs (bool x) {dev_on_fs = x;}
inline bool isfs () const {return dev_on_fs;}
};
extern const device *console_dev;
extern const device *piper_dev;
extern const device *pipew_dev;
extern const device *socket_dev;
extern const device *ttym_dev;
extern const device *ttys_dev;
extern const device *urandom_dev;