[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 2

getattr Device Configuration Subroutine

Purpose

Returns current values of an attribute object.

Library

Object Data Manager Library (libodm.a)

Syntax

#include <cf.h>
#include <sys/cfgodm.h>
#include <sys/cfgdb.h>
struct CuAt *getattr (devname, attrname, getall, how_many)
char * devname;
char * attrname;
int getall;
int * how_many;

Parameters

devname Specifies the device logical name.
attrname Specifies the attribute name.
getall Specifies a Boolean flag that, when set to True, indicates that a list of attributes is to be returned to the calling routine.
how_many Points to how many attributes the getattr subroutine has found.

Description

The getattr device configuration subroutine returns the current value of an attribute object or a list of current values of attribute objects from either the Customized Attribute (CuAt) object class or the Predefined Attribute (PdAt) object class. The getattr device configuration subroutine queries the CuAt object class for the attribute object matching the device logical name and the attribute name. It is the application's responsibility to lock the Device Configuration object classes.

The getattr subroutine allocates memory for CuAt object class structures that are returned. This memory is automatically freed when the application exits. However, the application must free this memory if it invokes getattr several times and runs for a long time.

To get a single attribute, the getall parameter should be set to False. If the object exists in the CuAt object class, a pointer to this structure is returned to the calling routine.

However, if the object is not found, the getattr subroutine assumes that the attribute takes the default value found in the PdAt object class. In this case, the PdAt object class is queried for the attribute information. If this information is found, the relevant attribute values (that is, default value, flag information, and the NLS index) are copied into a CuAt structure. This structure is then returned to the calling routine. Otherwise, a null pointer is returned indicating an error.

To get all the customized attributes for the device name, the getall parameter should be set to True. In this case, the attrname parameter is ignored. The PdAt and CuAt object classes are queried and a list of CuAt structures is returned. The PdAt objects are copied to CuAt structures so that one list may be returned.

Note: The getattr device configuration subroutine will fail unless you first call the odm_initialize subroutine.

Return Values

Upon successful completion, the getattr subroutine returns a pointer to a list of CuAt structures. If the operation is unsuccessful, a null pointer is returned.

Files

/usr/lib/libcfg.a Archive of device configuration subroutines.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The odm_initialize subroutine, the putattr device configuration subroutine.

Predefined Attribute (PdAt) object class, Customized Attribute (CuAt) object class.

List of Device Configuration Subroutines.

Device Configuration Subsystem Programming Introduction in AIX Kernel Extensions and Device Support Programming Concepts.

Understanding ODM Object Classes and Objects in AIX General Programming Concepts: Writing and Debugging Programs.

ODM Device Configuration Object Classes in AIX Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Home | Search ]