|
|
1.1 root 1: #ifndef ASSIGN_H
2: #define ASSIGN_H
3:
4: /*
5: *-IMPORTS:
6: * <sys/compat.h>
7: * EXTERN_C_BEGIN
8: * EXTERN_C_END
9: * PROTO ()
10: * <kernel/v_types.h>
11: * major_t
12: * minor_t
13: */
14:
15: #include <sys/compat.h>
16: #include <kernel/v_types.h>
17:
18:
19: #ifndef MDEV_T
20: #define MDEV_T
21: typedef struct mdevice mdev_t;
22: #endif
23:
24: #ifndef EXTINFO_T
25: #define EXTINFO_T
26: typedef struct extinfo extinfo_t;
27: #endif
28:
29:
30: /*
31: * Mapping between internal and external numbers is not simple; what makes it
32: * worse is that because there is a single mapping that has to be the same
33: * for both block and character tables, the construction of the bdevsw [] and
34: * cdevsw [] internal tables is constrained. This is only a problem if
35: * multiple external major numbers are allowed, and each device is only
36: * permitted to have a single internal major number. The interpretation of the
37: * 'M' flag in this circumstance is unclear.
38: *
39: * The assign_imajors () code should be able to deal with the most complex
40: * case, which is where multiple external majors may actually be mapped to
41: * multiple internal numbers, thus
42: *
43: * Block external : |-----scsi-------|
44: * Character external: |--tcp--| |-udp-| |ttys|
45: *
46: * Might map 'tcp' to internal 0, 'udp' to internal 1, 'ttys' to internal 2,
47: * while 'scsi' would have 0, 1, and 2 as internal major numbers.
48: *
49: * This is all hypothetical at the moment, since multiple majors are new to
50: * Coherent anyway. For simplicity, we may constrain the above to be an error
51: * by requiring unique internal number for each device. However, the machinery
52: * in assign_imajors () will have to be flexible enough to deal with the
53: * above.
54: *
55: * NOTE: The complex model is only applicable if a device does not care what
56: * minor numbers are given to it, since there is a single shared table used
57: * to map a range of external major numbers into a range of internal minor
58: * numbers. Since this table is shared, it constrains even more heavily the
59: * circumstances in which numbers can overlap. Without a flag to detect when
60: * a driver doesn't care about minor numbers, we simply forget about the
61: * complex model.
62: */
63:
64: struct extinfo {
65: major_t ei_nemajors;
66: major_t * ei_etoimajor;
67: major_t * ei_minoroffset;
68: int ei_ncdevs;
69: mdev_t ** ei_cdevsw;
70: int ei_nbdevs;
71: mdev_t ** ei_bdevsw;
72: int ei_nmodules;
73: mdev_t ** ei_modules;
74: };
75:
76:
77: EXTERN_C_BEGIN
78:
79: extinfo_t * assign_imajors PROTO ((void));
80:
81: EXTERN_C_END
82:
83: #endif /* ! defined (ASSIGN_H) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.