* fhandler.cc (fhandler_base::open): Use major numbers rather than device
numbers to control special behavior for devices which take units. * fhandler_raw.cc (fhandler_dev_raw::writebuf): Ditto. (fhandler_dev_raw::fstat): Ditto. (fhandler_dev_raw::open): Ditto. (fhandler_dev_raw::ioctl): Ditto.
This commit is contained in:
parent
0a0c89ef54
commit
918f634fed
|
@ -1,3 +1,13 @@
|
||||||
|
2004-01-21 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* fhandler.cc (fhandler_base::open): Use major numbers rather than
|
||||||
|
device numbers to control special behavior for devices which take
|
||||||
|
units.
|
||||||
|
* fhandler_raw.cc (fhandler_dev_raw::writebuf): Ditto.
|
||||||
|
(fhandler_dev_raw::fstat): Ditto.
|
||||||
|
(fhandler_dev_raw::open): Ditto.
|
||||||
|
(fhandler_dev_raw::ioctl): Ditto.
|
||||||
|
|
||||||
2004-01-21 Nicholas Wourms <nwourms@netscape.net>
|
2004-01-21 Nicholas Wourms <nwourms@netscape.net>
|
||||||
|
|
||||||
* signal.cc (sigaction): Fix if-statement typo.
|
* signal.cc (sigaction): Fix if-statement typo.
|
||||||
|
|
|
@ -353,7 +353,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
|
|
||||||
if (get_query_open ())
|
if (get_query_open ())
|
||||||
access = 0;
|
access = 0;
|
||||||
else if (get_device () == FH_TAPE)
|
else if (get_major () == DEV_TAPE_MAJOR)
|
||||||
access = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
|
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
|
||||||
access = GENERIC_READ;
|
access = GENERIC_READ;
|
||||||
|
@ -363,7 +363,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
access = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
|
|
||||||
/* Allow reliable lseek on disk devices. */
|
/* Allow reliable lseek on disk devices. */
|
||||||
if (get_device () == FH_FLOPPY)
|
if (get_major () == DEV_FLOPPY_MAJOR)
|
||||||
access |= GENERIC_READ;
|
access |= GENERIC_READ;
|
||||||
|
|
||||||
/* FIXME: O_EXCL handling? */
|
/* FIXME: O_EXCL handling? */
|
||||||
|
@ -392,11 +392,11 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
file_attributes = FILE_ATTRIBUTE_NORMAL;
|
file_attributes = FILE_ATTRIBUTE_NORMAL;
|
||||||
if (flags & O_DIROPEN)
|
if (flags & O_DIROPEN)
|
||||||
file_attributes |= FILE_FLAG_BACKUP_SEMANTICS;
|
file_attributes |= FILE_FLAG_BACKUP_SEMANTICS;
|
||||||
if (get_device () == FH_SERIAL)
|
if (get_major () == DEV_SERIAL_MAJOR)
|
||||||
file_attributes |= FILE_FLAG_OVERLAPPED;
|
file_attributes |= FILE_FLAG_OVERLAPPED;
|
||||||
|
|
||||||
#ifdef HIDDEN_DOT_FILES
|
#ifdef HIDDEN_DOT_FILES
|
||||||
if (flags & O_CREAT && get_device () == FH_FS)
|
if (flags & O_CREAT && dev ().isfs ())
|
||||||
{
|
{
|
||||||
char *c = strrchr (get_win32_name (), '\\');
|
char *c = strrchr (get_win32_name (), '\\');
|
||||||
if ((c && c[1] == '.') || *get_win32_name () == '.')
|
if ((c && c[1] == '.') || *get_win32_name () == '.')
|
||||||
|
@ -420,7 +420,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
|
|
||||||
/* If the file should actually be created and ntsec is on,
|
/* If the file should actually be created and ntsec is on,
|
||||||
set files attributes. */
|
set files attributes. */
|
||||||
if (flags & O_CREAT && get_device () == FH_FS && allow_ntsec && has_acls ())
|
if (flags & O_CREAT && dev ().isfs () && allow_ntsec && has_acls ())
|
||||||
set_security_attribute (mode, &sa, sd);
|
set_security_attribute (mode, &sa, sd);
|
||||||
|
|
||||||
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
|
x = CreateFile (get_win32_name (), access, shared, &sa, creation_distribution,
|
||||||
|
|
|
@ -98,7 +98,7 @@ fhandler_dev_raw::writebuf (void)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
memset (devbuf + devbufend, 0, devbufsiz - devbufend);
|
memset (devbuf + devbufend, 0, devbufsiz - devbufend);
|
||||||
if (get_device () != FH_TAPE)
|
if (get_major () != DEV_TAPE_MAJOR)
|
||||||
to_write = ((devbufend - 1) / 512 + 1) * 512;
|
to_write = ((devbufend - 1) / 512 + 1) * 512;
|
||||||
else if (varblkop)
|
else if (varblkop)
|
||||||
to_write = devbufend;
|
to_write = devbufend;
|
||||||
|
@ -134,16 +134,10 @@ fhandler_dev_raw::fstat (struct __stat64 *buf)
|
||||||
{
|
{
|
||||||
debug_printf ("here");
|
debug_printf ("here");
|
||||||
|
|
||||||
switch (get_device ())
|
if (get_major () == DEV_TAPE_MAJOR)
|
||||||
{
|
buf->st_mode = S_IFCHR | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
|
||||||
case FH_TAPE:
|
else
|
||||||
case FH_NTAPE:
|
buf->st_mode = S_IFBLK | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
|
||||||
buf->st_mode = S_IFCHR | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
buf->st_mode = S_IFBLK | STD_RBITS | STD_WBITS | S_IWGRP | S_IWOTH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf->st_uid = geteuid32 ();
|
buf->st_uid = geteuid32 ();
|
||||||
buf->st_gid = getegid32 ();
|
buf->st_gid = getegid32 ();
|
||||||
|
@ -176,7 +170,7 @@ fhandler_dev_raw::open (int flags, mode_t)
|
||||||
flags |= O_BINARY;
|
flags |= O_BINARY;
|
||||||
|
|
||||||
DWORD access = GENERIC_READ | SYNCHRONIZE;
|
DWORD access = GENERIC_READ | SYNCHRONIZE;
|
||||||
if (get_device () == FH_TAPE
|
if (get_major () == DEV_TAPE_MAJOR
|
||||||
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY
|
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY
|
||||||
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR)
|
|| (flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDWR)
|
||||||
access |= GENERIC_WRITE;
|
access |= GENERIC_WRITE;
|
||||||
|
@ -274,7 +268,7 @@ fhandler_dev_raw::raw_read (void *ptr, size_t& ulen)
|
||||||
{
|
{
|
||||||
if (!varblkop && len >= devbufsiz)
|
if (!varblkop && len >= devbufsiz)
|
||||||
{
|
{
|
||||||
if (get_device () == FH_TAPE)
|
if (get_major () == DEV_TAPE_MAJOR)
|
||||||
bytes_to_read = (len / devbufsiz) * devbufsiz;
|
bytes_to_read = (len / devbufsiz) * devbufsiz;
|
||||||
else
|
else
|
||||||
bytes_to_read = (len / 512) * 512;
|
bytes_to_read = (len / 512) * 512;
|
||||||
|
@ -538,7 +532,7 @@ fhandler_dev_raw::ioctl (unsigned int cmd, void *buf)
|
||||||
switch (op->rd_op)
|
switch (op->rd_op)
|
||||||
{
|
{
|
||||||
case RDSETBLK:
|
case RDSETBLK:
|
||||||
if (get_device () == FH_TAPE)
|
if (get_major () == DEV_TAPE_MAJOR)
|
||||||
{
|
{
|
||||||
struct mtop mop;
|
struct mtop mop;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue