int kdms_define_segment(
char *segment,
kfunc_int *create,
kfunc_int *destroy,
kfunc_int *query,
kfunc_kaddr *get_data,
kfunc_int *put_data,
kfunc_int *get_atr,
kfunc_int *set_atr,
kfunc_int *match_atr_atrnn,
kfunc_int *copy,_atr
kfunc_int *query,
kfunc_int *print)
The create handler declaration is of the form :
int create_handler( kobject object, char *segment)
The object and segment are passed from the calling create function. The return value of the handler will be propogated back up to the return value of the calling create function.
The destroy handler declaration is of the form :
int destroy_handler( kobject object, char *segment)
The object and segment are passed from the calling destroy function. The return value of the handler will be propogated back up to the return value of the calling destroy function.
The query handler declaration is of the form :
int query_handler( kobject object, char *segment)
The object and segment are passed from the calling query function. The return value of the handler will be propogated back up to the return value of the calling query function.
The get_data declaration is of the form :
kaddr get_data_handler( kobject object, char *segment, int *begin, int *end int kaddr)
The object, segment, begin corner, end corner, and data pointer are passed from the calling get_data function. The return data pointer from the handler will be propogated back up to the return value of the calling get_data function.
The put_data declaration is of the form :
int put_data_handler( kobject object, char *segment, int *begin, int *end int kaddr)
The object, segment, begin corner, end corner, and data pointer are passed from the calling put_data function. The return value from the handler will be propogated back up to the return value of the calling put_data function.
The get attribute handler declaration is of the form :
int get_attribute_handler( kobject object, char *segment, char *attribute, kva_list *list)
The object, segment, and attribute are passed from the calling get function. The variable argument list is an already opened varargs list which contains the pointers with which to return the attribute data. The variable arguments can be pulled off with the kva_arg() function. The list will be closed after this handler returns. The return value of this handler will also be propogated up to be the return value of the calling get function.
The set attribute handler declaration is of the form :
int set_attribute_handler( kobject object, char *segment, char *attribute, kva_list *list)
The object, segment, and attribute are passed from the calling set function. The variable argument list is an already opened varargs list which contains the data with which to set the attribute data. The variable arguments can be pulled off with the kva_arg() function. The list will be closed after this handler returns. The return value of this handler will also be propogated up to be the return value of the calling set function.
match_atr - match attribute handler function for this segment. This function will be invoked whenever a kdms_match_attribute, kdms_match_attributes, or kdms_vmatch_attributes function is called with the defined segment.
The match attribute handler declaration is of the form :
int match_attribute_handler( kobject object1, kobject object2, char *segment, char *attribute)
The object1, object2, segment, and attribute arguments are passed from the calling match function. The return value of this handler will be propogated up to be the return value of the calling match function.
copy_atr - copy attribute handler function for this segment. This function will be invoked whenever a kdms_copy_attribute, kdms_copy_attributes, or kdms_vcopy_attributes function is called with the defined segment.
The copy attribute handler declaration is of the form :
int copy_attribute_handler( kobject object1, kobject object2, char *segment, char *attribute)
The object1, object2, segment, and attribute arguments are passed from the calling copy function. copy function. The return value of this handler will be propogated up to be the return value of the calling copy function.
query_atr - query attribute handler function for this segment. This function will be invoked whenever a kdms_query_attribute function is called with the defined segment.
The query attribute handler declaration is of the form :
int query_attribute_handler( kobject object, char *segment, char *attribute, int *num_args, int *arg_size, int *data_type, int *permanent)
The object, segment, and attribute are passed in from the calling query function. The association is the tokenized representation of the segment argument from the query function. The num_args argument can be used to return the expected number of arguments for this attribute. The arg_size argument can be used to return the expected argument size for this attribute. The data_type argument can be used to return the expected data type for this attribute. The permanent argument can be used to indicate if this attribute is stored or not. Note that it is up to the programmer to ensure that the values which the handler returns for any of those arguments matches what is going to be processed in the get and set handlers. The return value of this handler will be propogated up to be the return value of the calling query function. In general, a value of TRUE is interpreted to mean that the attribute 'exists'.
print_atr - print attribute handler function for this segment. This function will be invoked whenever a kdms_print_attribute function is called with the defined segment.
The print attribute handler declaration is of the form :
int print_attribute_handler( kobject object, char *segment, char *attribute, kfile *outfile)
The object, segment, attribute, and outfile is passed in from the calling print function. The return value of this handler will be propogated up to be the return value of the calling print function.
The query handler declaration is of the form :
int query_handler( kobject object, char *segment)
The object and segment are passed from the calling query function. The return value of the handler will be propogated back up to the return value of the calling query function.
none
While in one of these alternate functions, the definition is "locked" so that further kdms calls which access the defined segment will _not_ go through the defined segment handler functions. Once out of the handler function, the definition will be "unlocked".
This provides the ability to imbed any needed initialization steps into the creation of a given segment. For example, the create handler for the "value" segment will be called on a kdms_create_segment(obj, "value") call. Within this handler, another kdms_create_segment(obj, "value") call will not call the create handler becuse the definition is locked, but instead will create the "value" segment, just as it would have done had the "value" segment not been defined. Additional initialization steps, for example, setting the dimensionality of the "value" segment, can be easily added to the handler after the internal create call.
If a handler function for a particular action is not provided, then data services will behave as if the segment has never been defined.
This segment definition can be undefined with the kdms_undefine_segment call.
none
none
$DATASERV/objects/library/kdataman/src/segue.c