DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
UDI driver coding basics

Primary region initialization

Every driver must have exactly one primary region whose interaction with the UDI environment's Management Agent (MA) must be described in a udi_primary_init_t array. When the Management Agent creates a driver instance, it automatically creates a primary region according to the parameters provided in the udi_primary_init_t structure. ``Primary region initialization''). A management channel will also be created and anchored to this region. The channel context for this channel will be set to point to the region's region data area (see ``Region data definitions'').

cmos_udi.c sample code (cont.)
   /*
    * --------------------------------------------------------------------
    * Management operations init section:
    * --------------------------------------------------------------------
    */
   static udi_primary_init_t udi_cmos_primary_init_info = {
   	&cmos_mgmt_ops,
   	cmos_default_op_flags,	/* op_flags */
   	0,			/* mgmt_scratch_size */
   	0,                      /* enumerate attr list length */
   	sizeof(cmos_region_data_t), /* rdata size */
   	0,			/* no children, so no enumeration */
   	0,		/* buf path*/
   };
pseudod.c sample code (cont.)
   static udi_primary_init_t pseudo_primary_init = {
   	&pseudo_mgmt_ops,
   	pseudo_default_op_flags,
   	0,				/* mgmt scratch */
   	0,				/* enumerate no children */
   	sizeof (pseudo_region_data_t),
   	0,				/*child_data_size */
   	0,		/*buf path */
   };

The cmos_mgmt_ops and pseudo_mgmt_ops arrays were defined in the section ``Management metalanguage operations vector'' and hold the Management metalanguage operations vectors. This tells the UDI environment about all the channel operations defined for the driver region. The cmos_default_op_flags and pseudo_default_op_flags elements are defined as follows in the driver code:

   static udi_ubit8_t cmos_default_op_flags[] = {
   	0, 0, 0, 0, 0
   };
   

static udi_ubit8_t pseudo_default_op_flags[] = { 0, 0, 0, 0, 0 };

These are arrays of flag values with a one-for-one correspondence between entries in the array and entries in the cmos_mgmt_ops and pseudo_mgmt_ops arrays. This array may be used to indicate characteristics of the implementation of the corresponding operation to the environment. Neither of the sample drivers requires any special operation flags, so the arrays are all zeros. See udi_primary_init_t(3udi) for flag values and usage.

The fifth element of each array holds the size, in bytes, of the region data area to be allocated for the primary region of each driver instance. These were defined in ``Region data definitions''.

See udi_primary_init_t(3udi) for an explanation of the other elements in this structure.


Next topic: Channel operations initialization
Previous topic: GIO metalanguage entry points

© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - 19 June 2005