📄 sources.htm
字号:
* process and whenever it receives a sysconfig *
* command request from either the kernel or the *
* user command line. *
* *
* NOTE *
* *
* There are a number of fields (attributes) that *
* appear in the sysconfigtab file fragment that *
* are not needed by the /dev/none driver. *
* The cfgmgr framework consumes these fields *
* (attributes) to perform kernel configuration *
* work and to make device special files. To *
* avoid warning messages from the cfgmgr *
* framework, you should add these attributes to *
* the driver's attribute table. *
**************************************************/
</p><p>
</p><p>
</p><p>
/***********************************************
* Declares an array of cfg_subsys_attr_t *
* structures and calls it none_attributes. *
* The device driver method of cfgmgr fills in *
* the elements in none_attributes because *
* the operation types designated by these *
* are CFG_OP_CONFIGURE. The device driver *
* method of cfgmgr reads the entries for the *
* /dev/none driver from the sysconfigtab *
* database. (A sysconfigtab file fragment *
* was created for the /dev/none driver. *
* The sysconfigdb utility appends this *
* sysconfigtab file fragment to the *
* /etc/sysconfigtab database.) *
* *
* To determine if any of these element reads *
* failed, the /dev/none driver verifies each *
* from the cfg_attr_t structure passed into *
* the none_configure interface. *
* *
* Several of the following fields are used *
* in the /dev/none device driver while other *
* fields exist to illustrate what can be *
* loaded by cfgmgr into the driver attributes *
* table. *
* *
* These fields can represent tunable *
* parameters to indicate whether the driver *
* is statically or dynamically configured *
* into the kernel. *
***********************************************/
cfg_subsys_attr_t none_attributes[] = {
/* Fields used in this driver. */
{"Module_Config_Name", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)mcfgname,2,CFG_ATTR_NAME_SZ,0},
{"CMA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)cma_dd,0,300,0},
{"numunit", CFG_ATTR_INTTYPE, CFG_OP_QUERY | CFG_OP_CONFIGURE,
(caddr_t)&NNONE,0,MAX_NNONE,0},
{"TC_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)&tc_optiondata,0,300,0},
/***************************************************
* NOTE *
* *
* There are a number of fields (attributes) that *
* appear in the sysconfigtab file fragment that *
* are not needed by the /dev/none driver. *
* The cfgmgr framework consumes these fields *
* (attributes) to perform kernel configuration *
* work and to make device special files. To *
* avoid warning messages from the cfgmgr *
* framework, you should add these attributes to *
* the driver's attribute table. *
* *
* The following device driver-related attributes *
* are not used by the /dev/none driver and are *
* included in the attributes table to avoid *
* the warning messages. *
***************************************************/
{"Module_Path", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Subdir", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Block_Subdir", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Char_Subdir", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Major_Req", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Block_Major", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Block_Minor", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Block_Files", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Char_Major", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Char_Minor", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Char_Files", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_User", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Group", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"Device_Mode", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"EISA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"ISA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"VBA_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
{"PCI_Option", CFG_ATTR_STRTYPE, CFG_OP_CONFIGURE,
(caddr_t)unused,0,300,0},
/**********************************************
* The /dev/none device driver modifies the *
* following attributes during a configure *
* or unconfigure operation. The cfgmgr *
* framework uses these attributes to provide *
* the device special files that device *
* drivers need. *
**********************************************/
{"majnum", CFG_ATTR_INTTYPE, CFG_OP_QUERY,
(caddr_t)&majnum,0,512,0},
{"version", CFG_ATTR_INTTYPE, CFG_OP_QUERY,
(caddr_t)&noneversion,0,9999999,0},
/**********************************************
* Device driver-specific entries that *
* describe configuration and operation of *
* the driver should go here. *
**********************************************/
/**********************************************
* The None_Developer_Debug attribute is used *
* with the printf interface to display *
* runtime messages on the console terminal. *
* A device driver writer might want to *
* define such an attribute to collect *
* detailed information relating to a driver *
* problem. When the attribute is set to 1 *
* by the cfgmgr framework (through the *
* CFG_OP_RECONFIGURE operation) or *
* initialized by sysconfigtab in the *
* bootpath, these messages appear on the *
* console terminal. These messages can *
* provide the driver writer with *
* configuration information that relates to *
* detailed bus configuration information. *
* *
* The None_Developer_Debug attribute *
* (or another attribute similar to it) is *
* used for detailed internal debugging of *
* code by Digital personnel or someone who *
* has a source license. *
* *
* Note that the None_Developer_Debug *
* attribute's operations are query, *
* reconfigure, and configure. *
* *
* none_developer_debug = 1 turns on these *
* messages *
* none_developer_debug = 0 turns off these *
* messages *
* *
* You also need to use the #ifdef and *
* #endif statements as follows: *
* *
* #ifdef NONE_DEBUG *
* driver code *
* #endif *
**********************************************/
{"None_Developer_Debug", CFG_ATTR_INTTYPE, CFG_OP_QUERY |
CFG_OP_RECONFIGURE |
CFG_OP_CONFIGURE,
(caddr_t)&none_developer_debug,0,1,0},
{,0,0,0,0,0,0}
};
</p></pre>
<p>
</p><p>
</p><pre><p>
</p><p>
</p><p>
</p><p>
/***************************************************
* none_configure() *
***************************************************
* Name: none_configure *
* *
* Arguments: *
* *
* op Configure operation *
* indata Input data structure, cfg_attr_t *
* indatalen Size of input data structure *
* outdata Formal parameter not used *
* outdatalen Formal parameter not used *
* *
* Kernel support interface calls: *
* *
* o atoi *
* o bcopy *
* o devsw_add *
* o devsw_del *
* o cfgmgr_get_state *
* o configure_driver *
* o printf *
* o register_callback *
* o register_configuration *
* o register_major_number *
* o strcmp *
* o strcpy *
* o unconfigure_driver *
* *
* Called by: *
* *
* o cfgmgr framework *
* *
* Return Codes: *
* *
* Success: ESUCCESS *
* *
* Failure: EBUSY *
* EINVAL *
* ESRCH *
* ENOTSUP *
* *
* Description: *
* *
* The none_configure interface is called *
* indirectly by the cfgmgr framework. The cfgmgr *
* framework is responsible for calling all single *
* binary modules for registration and integration *
* into the kernel. The cfgmgr framework requires *
* that a single binary module has both an *
* attributes table and a configure interface *
* before it (the single binary module) can be *
* registered as part of the cfgmgr framework and *
* the Digital UNIX kernel. *
* *
* The none_configure interface cooperates with *
* the cfgmgr framework to complete configure, *
* unconfigure, query, and other requests. *
* These requests are differentiated by the "op" *
* argument. *
* *
* Specifically, the none_configure interface *
* shows the code a device driver must supply to *
* produce a single binary module. This code *
* allows the /dev/none driver to be statically or *
* dynamically configured into the kernel. *
***************************************************/
</p><p>
</p><p>
</p><p>
</p><p>
none_configure(op, indata, indatalen, outdata, outdatalen)
cfg_op_t op;
cfg_attr_t *indata;
size_t indatalen;
cfg_attr_t *outdata;
size_t outdatalen;
{
/***************************************************
* The none_configure interface declares the *
* following variables: *
* *
* retval Stores the return value *
* from the *
* register_configuration *
* interface. *
* *
* i Used in the for loop. *
* *
* driver_cfg_state Stores the configuration *
* state (either static or *
* dynamic) of the driver. *
***************************************************/
int retval;
int i;
int driver_cfg_state;
</p><p>
/***************************************************
* *
* MAX_DEVICE_CFG_ENTRIES represents the maximum *
* number of attributes that the cfgmgr framework *
* configures on behalf of the device driver. *
***************************************************/
</p><p>
#define MAX_DEVICE_CFG_ENTRIES 18
</p><p>
/***************************************************
* The cfg_attr_t list passed into the *
* none_configure interface's indata argument *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -