Linux Kernel Architecture

(Jacob Rumans) #1

Chapter 10: Filesystems without Persistent Storage


struct proc_dir_entry *de; /* /proc control block */
void *extra1;
void *extra2;
};

The name of the structure is misleading. Asysctltableis an array ofsysctlstruc-
tures, whereas a single instance of the structure is called asysctlentry— despite the
wordtablein its name.

The meanings of the structure elements are as follows:

❑ ctl_nameis an ID, that must be unique only on the given hierarchy level of the entry but not in
the entire table.
<sysctl.h>contains countlessenumsthat define sysctl identifiers for various purposes. The
identifiers for the base categories are defined by the following enumeration:
<sysctl.h>
enum
{
CTL_KERN=1, /* General kernel info and control */
CTL_VM=2, /* VM management */
CTL_NET=3, /* Networking */
CTL_PROC=4, /* Process info */
CTL_FS=5, /* File Systems */
CTL_DEBUG=6, /* Debugging */
CTL_DEV=7, /* Devices */
CTL_BUS=8, /* Busses */
CTL_ABI=9, /* Binary emulation */
CTL_CPU=10 /* CPU stuff (speed scaling, etc) */
...
};
BelowCTL_DEV, there are entries for various device types:
<sysctl.h>
/* CTL_DEV names: */
enum {
DEV_CDROM=1,
DEV_HWMON=2,
DEV_PARPORT=3,
DEV_RAID=4,
DEV_MAC_HID=5,
DEV_SCSI=6,
DEV_IPMI=7,
};
The constant 1 (and others) occurs more than once in the enumerations shown — in both
CTL_KERNandDEV_CDROM. This is not a problem because the two entries are on different
hierarchy levels, as shown in Figure 10-6.
❑ procnameis a string containing a human-readable description of the entry in/proc/sys.The
names of all root entries appear as directory names in/proc/sys.
Free download pdf