In addition to PICL_READ and PICL_WRITE property access modes, the plug-in modules specify whether a property is volatile or not by setting the bit PICL_VOLATILE.
|
#define PICL_VOLATILE 0x4
|
For a volatile property, the plug-in module provides the access functions to read and/or write the property in the ptree_propinfo_t argument passed when creating the property.
The daemon invokes the access functions of volatile properties when clients access their values. Two arguments are passed to the read access functions. The first argument is a pointer to ptree_rarg_t, which contains the handle of the node, the handle of the accessed property and
the credentials of the caller. The second argument is a pointer to the buffer where the value is to be copied.
|
typedef struct {
picl_nodehdl_t nodeh;
picl_prophdl_t proph;
door_cred_t cred;
} ptree_rarg_t;
|
The prototype of the read access function for volatile property is:
|
int read(ptree_rarg_t *rarg, void *buf);
|
The read function returns PICL_SUCCESS to indicate successful completion.
Similarly, when a write access is performed on a volatile property, the daemon invokes the write access function provided by the plug-in for that property and passes it two arguments. The first argument is a pointer to ptree_warg_t, which contains the handle to the node, the handle
of the accessed property and the credentials of the caller. The second argument is a pointer to the buffer containing the value to be written.
|
typedef struct {
picl_nodehdl_t nodeh;
picl_prophdl_t proph;
door_cred_t cred;
} ptree_warg_t;
|
The prototype of the write access function for volatile property is:
|
int write(ptree_warg_t *warg, const void *buf);
|
The write function returns PICL_SUCCESS to indicate successful completion.
For all volatile properties, the 'size' of the property must be specified to be the maximum possible size of the value. The maximum size of the value cannot exceed PICL_PROPSIZE_MAX. This allows a client to allocate a sufficiently large buffer before retrieving a volatile property's
value
|