• Aucun résultat trouvé

derme method of your node

Dans le document WRITING A DEVICE DRIVER FOR AIX VERSION 3 (Page 155-159)

writes child device out to stdout which confi&...mgr intercepts ..•

If your device does not have a parent Config _mgr using rules from the Confi&...Rules object class calls a

/etc/methods/yournodeconfiguration program

define method of your node

and calls ...

derme method of your node

Figure 6-4. How cfgmgr Executes Config_Rules

6.2 Configuring an Unsupported Device to the System

To configure a currently unsupported device to your system, you need to:

• Modify the ODM database

• Write appropriate device methods.

6.2.1 Modifying the Predefined Database

To add a device to your system, you must modify the Predefined database. To do this, you must add information about your device to three Predefined object classes:

• Predefined Devices (PdDv) object class

• Predefined Attribute (PdAt) object class

• Predefined Connection (PdCn) object class.

To describe the device, you must add one object to the PdDv object class to indicate the class, subclass, and device type (see "Device Classes, Subclasses, and Types Overview" on page A-1). You must also add one object to the PdAt object class for each device attribute, such as interrupt level or block size.

Finally, you must add objects to the PdCn object class if the device is an intermediate device. (An intermediate device is a device like a SCSI adapter that is used to run other "children" devices like disks and tapes.) If the device is an intermediate device, you must add an object for each different connection location on the intermediate device.

You can use the odmadd ODM (Object Data Manager) command from the command line or in a shell script to populate the necessary Predefined object classes from stanza files.

See "ODM Stanzas (ric.add)" on page 8-22 for the stanzas necessary to populate the ODM database to support the character device driver used an example in "Overview of a Character Device Driver" on page 4-1.

6.2.1.1 Accessing Device Attributes

The predefined device attributes for each type of predefined device are stored in the PdAt object class. The objects in the PdAt object class identify the default values as well as other possible values for each attribute. The CuAt object class contains only attributes for customized device instances that have been changed from their default values.

When a customized device instance is created by a define method, its attributes assume the default values. As a result, no objects are added to the CuAt object class for the device. If an attribute for the device is changed from the default value by the change method, an object to describe the attribute's current value will be added to the CuAt object class for the attribute. If the attribute is

subsequently changed back to the default value, the change method deletes the CuAt object for the attribute.

Any device methods that need the current attribute values for a device must access both the PdAt and CuAt object classes. If an attribute appears in the CuAt object class, then the associated object identifies the current value.

Otherwise, the default value from the PdAt attribute object identifies the current value.

6.2.1.2 Modifying an Attribute Value

When modifying an attribute value, your methods must also obtain the objects for that attribute from both the PdAt and CuAt object classes.

Here are four scenarios that your methods must be able to handle:

1. If the new value differs from the default value and no object currently exists in the CuAt object class, your method must add an object into the CuAt object class to identify the new value.

2. If the new value differs from the default value and an object already exists in the CuAt object class, your method must update the CuAt object with the new value.

3. If the new value is the same as the default value and an object exists in the CuAt object class, your method must delete the CuAt object for the

attribute.

4. If the new value is the same as the default value and no object exists in the CuAt object class, your method does not need to do anything.

NOTE ---~

Your methods can use the getattr and putattr subroutines to g-et and modify attributes.

The getattr subroutine checks both .the PdAt and CuAt object classes before returning an attribute to you. It always returns the information in the form of a CuAt object even if returning the default value from the PdAt object class.

The putattr routine is used to modify attribute.s and it correctly handles the four cases that are described above. See the softcopy publications for more details.

6.2.2 Writing Device Methods

You will obviously have to write some device methods for your device.

Because AIX is dynamically configurable, these methods are necessary in order to use your devices. By convention, these methods are put in /etc/methods.

Your device can have all of the following device methods:

Method define method undefine method configure method unconfigure method change method stop method

Purpose

Make device ready for configuration.

Remove device.

Put device in ready to use state.

Remove device from ready to use state.

Alter device parameters.

Stop device from being used by users so that diagnostics may be run on it.

start method Allow users to use the device again.

It is helpful to see how these device methods actually get called. Please see Figure 6-5 on page 6-16 for information on how the high and low level commands may be used to invoke the various device methods.

Dans le document WRITING A DEVICE DRIVER FOR AIX VERSION 3 (Page 155-159)