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

Item Description
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

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