⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 supp static n dynamic config.htm

📁 What is this ``device driver stuff anyway? Here s a very short introduction to the concept.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
interface.
This is the driver's configuration entry point for handling static or
dynamic configuration requests.
</li></ul><p>
</p><p>
Although the device driver's
<tt>configure</tt>
interface can initialize attributes that appear
in the array with an operation code of
<tt>CFG_OP_CONFIGURE</tt>,
the
<tt>cfgmgr</tt>
framework overrides this initialization with the value specified in the
<tt>/etc/sysconfigtab</tt>
database.
</p><p>
The
<tt>min_val</tt>
member specifies
the minimum length of a string data value.
If the data type for the attribute is numeric, specifies the minimum
range.
</p><p>
The
<tt>max_val</tt>
member specifies
the maximum length of a string data value.
If the data type for the attribute is numeric, specifies the maximum
range.
</p><p>
The
<tt>val_size</tt>
member specifies
the binary data size.
<a name="cfg_attrStruct"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="supp%20static%20n%20dynamic%20config_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="supp%20static%20n%20dynamic%20config_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#ImplConfigureRtn"><img src="supp%20static%20n%20dynamic%20config_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#cfg_subsys_attr_tStruct"><img src="supp%20static%20n%20dynamic%20config_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#SetUpConfigureRelDecl"><img src="supp%20static%20n%20dynamic%20config_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut11.html"><img src="supp%20static%20n%20dynamic%20config_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="supp%20static%20n%20dynamic%20config_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="supp%20static%20n%20dynamic%20config_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h2>
6.2&nbsp;&nbsp;&nbsp;&nbsp;Using the cfg_attr_t Structure
</h2>
<p>
<a name="nx_id_300"></a>
The
<tt>cfg_attr_t</tt>
data structure contains information for managing the configuring and
unconfiguring of device drivers.
The
<tt>cfgmgr</tt>
framework passes a pointer to this data structure
to the device driver's
<tt>configure</tt>
interface. 
The device driver can parse this structure pointer to check the validity
of the values associated with the driver's associated
<tt>sysconfigtab</tt>
file fragment and the
<tt>/etc/sysconfigtab</tt>
database.
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut18.html#ThesysconfigtabFileFragment">Section 13.4</a>
discusses the
<tt>sysconfigtab</tt>
file fragment.
Driver writers need to be intimately familiar with the members
of the
<tt>cfg_attr_t</tt>
structure.
The following code shows the C definition:
</p><p>
</p><p>
</p><pre>typedef struct cfg_attr {
  char              name[CFG_ATTR_NAME_SZ];
  uchar             type;
  uchar             operation;
  uint              status;
  long              index;
  union {
      struct {
          caddr_t   val;
          ulong     min_size;
          ulong     max_size;
          void      (*disposal)();
          ulong     val_size;
      } bin;

      struct {
          caddr_t   val;
          ulong     min_len;
          ulong     max_len;
          void      (*disposal)();
      } str;

      struct {
          ulong     val;
          ulong     min_val;
          ulong     max_val;
      } num;
  } attr;
} cfg_attr_t;
</pre>
<p>
<a name="nx_id_301"></a>
The
<tt>name</tt>
member specifies
the ASCII name of the attribute.
The name must be between two and
<tt>CFG_ATTR_NAME_SZ</tt>
characters in length, including the terminating null character.
Do not begin the ASCII name of the attribute with the
<tt>Method_</tt>
or
<tt>Device_</tt>
characters.
The
<tt>cfgmgr</tt>
framework reserves certain names that begin with the
<tt>Method_</tt>
and
<tt>Device_</tt>
characters.
</p><p>
The
<tt>type</tt>
member specifies
the data type associated with the
<tt>name</tt>
attribute.
You must set the
<tt>type</tt>
member to one of the following constants:
<table border="4" cellpadding="4">
<tbody><tr>
<td align="left" valign="top">
<strong>
Value
</strong>
</td>
<td align="left" valign="top">
<strong>
Meaning
</strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_STRTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a null-terminated array of characters.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_INTTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a 32-bit signed integer.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_UINTTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a 32-bit unsigned integer.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_LONGTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a 64-bit signed integer.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_ULONGTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a 64-bit unsigned integer.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_BINTYPE</tt>
</td>
<td align="left" valign="top">
Data type is an array of bytes.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_UCHARTYPE</tt>
</td>
<td align="left" valign="top">
Data type is an 8-bit unsigned character.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_ATTR_USHORTTYPE</tt>
</td>
<td align="left" valign="top">
Data type is a 16-bit unsigned short integer.
</td>
</tr>
</tbody></table></p><p>
</p><p>
<br>
The
<tt>operation</tt>
member specifies
the operations that the
<tt>cfgmgr</tt>
framework can perform on the attribute.
You can set this member to one of the following constants:
<tt>CFG_OP_CONFIGURE</tt>,
<tt>CFG_OP_QUERY</tt>,
and
<tt>CFG_OP_RECONFIGURE</tt>.
</p><p>
The following table describes the meaning of these constants.
<br>
<table border="4" cellpadding="4">
<tbody><tr>
<td align="left" valign="top">
<strong>
Value
</strong>
</td>
<td align="left" valign="top">
<strong>
Meaning
</strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_OP_CONFIGURE</tt>
</td>
<td align="left" valign="top">
The
<tt>cfgmgr</tt>
framework configures the attribute.
This means the
<tt>cfgmgr</tt>
framework obtains a data value for the attribute from the
<tt>/etc/sysconfigtab</tt>
database.
<p>
The configure operation occurs when the
<tt>cfgmgr</tt>
framework calls the driver's
<tt>configure</tt>
interface at its
<tt>CFG_OP_CONFIGURE</tt>
entry point. 
(That is, the
<tt><var>optype</var></tt>
argument of the driver's
<tt>configure</tt>
interface evaluates to the
<tt>CFG_OP_CONFIGURE</tt>
constant.)
</p></td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_OP_QUERY</tt>
</td>
<td align="left" valign="top">
The
<tt>cfgmgr</tt>
framework queries (reads) the attribute.
This means the driver cooperates with the
<tt>cfgmgr</tt>
framework to provide the value associated with the attribute as a result
of user-initiated query requests.
These requests are typically the result of the
<tt>sysconfig -q</tt>
command.
<p>
The query operation occurs when the
<tt>cfgmgr</tt>
framework calls the driver's
<tt>configure</tt>
interface at its
<tt>CFG_OP_QUERY</tt>
entry point.
(That is, the 
<tt><var>optype</var></tt>
argument of the driver's
<tt>configure</tt>
interface evaluates to the
<tt>CFG_OP_QUERY</tt>
constant.)
</p></td>
</tr>
<tr>
<td align="left" valign="top">
<tt>CFG_OP_RECONFIGURE</tt>
</td>
<td align="left" valign="top">
The
<tt>cfgmgr</tt>
framework reconfigures the attribute.
This means the
<tt>cfgmgr</tt>
framework reconfigures the data value for the attribute. 
This functionality allows a user to modify the attribute.
A reconfigure request is typically the result of the
<tt>sysconfig -r</tt>
command.
<br>
<p>
The reconfigure operation occurs when the
<tt>cfgmgr</tt>
framework calls the driver's
<tt>configure</tt>
interface at its
<tt>CFG_OP_RECONFIGURE</tt>
entry point.
(That is, the 
<tt><var>optype</var></tt>
argument of the driver's
<tt>configure</tt>
interface evaluates to the
<tt>CFG_OP_RECONFIGURE</tt>
constant.)
</p></td>
</tr>
</tbody></table></p><p>
</p><p>
The
<tt>status</tt>
member stores
the return code from operations (configure, unconfigure, query) that the
<tt>cfgmgr</tt>
framework performs.
The
<tt>cfgmgr</tt>
framework can return one of the following operation codes:
<table border="4" cellpadding="4">
<tbody><tr>
<td align="left" valign="top">
<strong>
Value
</strong>
</td>
<td align="left" valign="top">
<strong>
Meaning
</strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>
<tt>CFG_ATTR_SUCCESS</tt>
</tt>
</td>
<td align="left" valign="top">
Successful operation.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>
<tt>CFG_ATTR_EEXISTS</tt>
</tt>
</td>
<td align="left" valign="top">
The attribute you specified in the
<tt>name</tt>
member does not exist.
</td>
</tr>
<tr>
<td align="left" valign="top">
<tt>
<tt>CFG_ATTR_EOP</tt>
</tt>
</td>
<td align="left" valign="top">
The attribute you specified in the
<tt>name</tt>
member does not support the operation.
</td>
</tr>
<tr>
<td align="left" valign="top">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -