Skip to content

Instantly share code, notes, and snippets.

@mhansen
Created October 22, 2009 22:52
Show Gist options
  • Save mhansen/216422 to your computer and use it in GitHub Desktop.
Save mhansen/216422 to your computer and use it in GitHub Desktop.
--- oldsrc/servers/vfs/dmap.c 2009-10-22 18:23:09.689108800 +1300
+++ src/servers/vfs/dmap.c 2009-10-22 18:12:17.095782600 +1300
@@ -17,61 +17,61 @@
#define DT(enable, opcl, io, driver, flags, label) \
{ (enable?(opcl):no_dev), (enable?(io):0), \
(enable?(driver):0), (flags), label, FALSE },
#define NC(x) (NR_CTRLRS >= (x))
/* The order of the entries here determines the mapping between major device
* numbers and tasks. The first entry (major device 0) is not used. The
* next entry is major device 1, etc. Character and block devices can be
* intermixed at random. The ordering determines the device numbers in /dev/.
* Note that FS knows the device number of /dev/ram/ to load the RAM disk.
* Also note that the major device numbers used in /dev/ are NOT the same as
* the process numbers of the device drivers.
*/
/*
Driver enabled Open/Cls I/O Driver # Flags Device File
-------------- -------- ------ ----------- ----- ------ ----
*/
struct dmap dmap[NR_DEVICES]; /* actual map */
PRIVATE struct dmap init_dmap[] = {
DT(1, no_dev, 0, 0, 0, "") /* 0 = not used */
DT(1, gen_opcl, gen_io, MEM_PROC_NR, 0, "memory") /* 1 = /dev/mem */
DT(0, no_dev, 0, 0, DMAP_MUTABLE, "") /* 2 = /dev/fd0 */
DT(0, no_dev, 0, 0, DMAP_MUTABLE, "") /* 3 = /dev/c0 */
DT(1, tty_opcl, gen_io, TTY_PROC_NR, 0, "") /* 4 = /dev/tty00 */
DT(1, ctty_opcl,ctty_io, TTY_PROC_NR, 0, "") /* 5 = /dev/tty */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE, "") /* 6 = /dev/lp */
#if (MACHINE == IBM_PC)
DT(1, no_dev, 0, 0, DMAP_MUTABLE, "") /* 7 = /dev/ip */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE, "") /* 8 = /dev/c1 */
- DT(0, 0, 0, 0, DMAP_MUTABLE, "") /* 9 = not used */
+ DT(1, gen_opcl, gen_io, PROC_PROC_NR,0,"proc") /* 9 = /proc */
DT(0, no_dev, 0, 0, DMAP_MUTABLE, "") /*10 = /dev/c2 */
DT(0, 0, 0, 0, DMAP_MUTABLE, "") /*11 = not used */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE, "") /*12 = /dev/c3 */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE, "") /*13 = /dev/audio */
DT(0, 0, 0, 0, DMAP_MUTABLE, "") /*14 = not used */
DT(1, gen_opcl, gen_io, LOG_PROC_NR, 0, "") /*15 = /dev/klog */
DT(0, no_dev, 0, NONE, DMAP_MUTABLE, "") /*16 = /dev/random*/
DT(0, 0, 0, 0, DMAP_MUTABLE, "") /*17 = not used */
#endif /* IBM_PC */
};
FORWARD _PROTOTYPE( int map_driverX, (char *label, int major,
endpoint_t proc_nr_e, int style, int force) );
/*===========================================================================*
* do_devctl *
*===========================================================================*/
PUBLIC int do_devctl()
{
if (!super_user)
{
printf("FS: unauthorized call of do_devctl by proc %d\n",
who_e);
return(EPERM); /* only su (should be only RS or some drivers)
* may call do_devctl.
*/
}
return fs_devctl(m_in.ctl_req, m_in.dev_nr, m_in.driver_nr,
m_in.dev_style, m_in.m_force);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment