Rename FH_BAD to FH_NADA throughout.

* devices.h (FH_ERROR): New value.
(iscons_dev): Extend to detect all the console device types.
* devices.in: Set aside storage for FH_ERROR.
* dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to detect when
device is a console.
(fh_alloc): Pass device to console constructor.
(build_fh_pc): Short circuit when we detect that the constructor saw an error.
* fhandler.h (fhandler_console::fhandler_console): Accept fh_devices parameter.
(get_tty_stuff): Change to void.
* fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR on
attempt to access anything other than the current console.
(fhandler_console::get_tty_stuff): Change to void return.
(fhandler_console::open): Return EPERM on FH_ERROR device type.
(fhandler_console::fhandler_console): Set the device type appropriately before
calling get_tty_stuff and rely on that function to reset it if necessary.
This commit is contained in:
Christopher Faylor
2011-06-12 20:15:26 +00:00
parent 38e356f0e4
commit c3a9063f83
13 changed files with 79 additions and 27 deletions

View File

@@ -68,7 +68,7 @@ static const virt_tab_t proc_tab[] = {
{ _VN ("sysvipc"), FH_PROCSYSVIPC, virt_directory, NULL },
{ _VN ("uptime"), FH_PROC, virt_file, format_proc_uptime },
{ _VN ("version"), FH_PROC, virt_file, format_proc_version },
{ NULL, 0, FH_BAD, virt_none, NULL }
{ NULL, 0, FH_NADA, virt_none, NULL }
};
#define PROC_DIR_COUNT 4
@@ -96,7 +96,7 @@ virt_tab_t *
virt_tab_search (const char *path, bool prefix, const virt_tab_t *table,
size_t nelem)
{
virt_tab_t key = { path, 0, FH_BAD, virt_none, NULL };
virt_tab_t key = { path, 0, FH_NADA, virt_none, NULL };
virt_tab_t *entry = (virt_tab_t *) bsearch (&key, table, nelem,
sizeof (virt_tab_t),
proc_tab_cmp);
@@ -141,7 +141,7 @@ fhandler_proc::get_proc_fhandler (const char *path)
if (has_subdir)
/* The user is trying to access a non-existent subdirectory of /proc. */
return FH_BAD;
return FH_NADA;
else
/* Return FH_PROC so that we can return EROFS if the user is trying to
create a file. */