|
|
@@ -172,17 +172,17 @@ static int _object_notify_deleted_children(struct object_instance *parent_pt)
|
|
|
struct object_tracker * tracker_pt;
|
|
|
|
|
|
for (list = parent_pt->child_head.next;
|
|
|
- list != &parent_pt->child_head; list = list->next) {
|
|
|
+ list != &parent_pt->child_head; list = list->next) {
|
|
|
|
|
|
obj_pt = list_entry(list, struct object_instance,
|
|
|
- child_list);
|
|
|
+ child_list);
|
|
|
res = _object_notify_deleted_children(obj_pt);
|
|
|
if (res)
|
|
|
return res;
|
|
|
|
|
|
for (notify_list = obj_pt->track_head.next;
|
|
|
- notify_list != &obj_pt->track_head;
|
|
|
- notify_list = notify_list->next) {
|
|
|
+ notify_list != &obj_pt->track_head;
|
|
|
+ notify_list = notify_list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (notify_list, struct object_tracker, object_list);
|
|
|
|
|
|
@@ -219,7 +219,7 @@ static void object_created_notification(
|
|
|
tracker_pt = list_entry (list, struct object_tracker, object_list);
|
|
|
|
|
|
if (((obj_handle == parent_object_handle) ||
|
|
|
- (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
+ (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
(tracker_pt->object_create_notify_fn != NULL)) {
|
|
|
tracker_pt->object_create_notify_fn(parent_object_handle,
|
|
|
object_handle,
|
|
|
@@ -236,7 +236,7 @@ static void object_created_notification(
|
|
|
static void object_pre_deletion_notification(hdb_handle_t object_handle,
|
|
|
hdb_handle_t parent_object_handle,
|
|
|
const void *name_pt, size_t name_len)
|
|
|
- {
|
|
|
+{
|
|
|
struct list_head * list;
|
|
|
struct object_instance * obj_pt;
|
|
|
struct object_tracker * tracker_pt;
|
|
|
@@ -248,12 +248,12 @@ static void object_pre_deletion_notification(hdb_handle_t object_handle,
|
|
|
obj_handle, (void *)&obj_pt);
|
|
|
|
|
|
for (list = obj_pt->track_head.next;
|
|
|
- list != &obj_pt->track_head; list = list->next) {
|
|
|
+ list != &obj_pt->track_head; list = list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (list, struct object_tracker, object_list);
|
|
|
|
|
|
if (((obj_handle == parent_object_handle) ||
|
|
|
- (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
+ (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
(tracker_pt->object_destroy_notify_fn != NULL)) {
|
|
|
tracker_pt->object_destroy_notify_fn(
|
|
|
parent_object_handle,
|
|
|
@@ -290,18 +290,18 @@ static void object_key_changed_notification(hdb_handle_t object_handle,
|
|
|
owner_pt = obj_pt;
|
|
|
|
|
|
for (list = obj_pt->track_head.next;
|
|
|
- list != &obj_pt->track_head; list = list->next) {
|
|
|
+ list != &obj_pt->track_head; list = list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (list, struct object_tracker, object_list);
|
|
|
|
|
|
if (((obj_handle == object_handle) ||
|
|
|
- (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
+ (tracker_pt->depth == OBJECT_TRACK_DEPTH_RECURSIVE)) &&
|
|
|
(tracker_pt->key_change_notify_fn != NULL))
|
|
|
tracker_pt->key_change_notify_fn(type, obj_pt->parent_handle, object_handle,
|
|
|
- owner_pt->object_name, owner_pt->object_name_len,
|
|
|
- name_pt, name_len,
|
|
|
- value_pt, value_len,
|
|
|
- tracker_pt->data_pt);
|
|
|
+ owner_pt->object_name, owner_pt->object_name_len,
|
|
|
+ name_pt, name_len,
|
|
|
+ value_pt, value_len,
|
|
|
+ tracker_pt->data_pt);
|
|
|
}
|
|
|
|
|
|
obj_handle = obj_pt->parent_handle;
|
|
|
@@ -320,7 +320,7 @@ static void object_reload_notification(int startstop, int flush)
|
|
|
unsigned int res;
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- OBJECT_PARENT_HANDLE, (void *)&obj_pt);
|
|
|
+ OBJECT_PARENT_HANDLE, (void *)&obj_pt);
|
|
|
|
|
|
/*
|
|
|
* Make a copy of the list
|
|
|
@@ -328,7 +328,7 @@ static void object_reload_notification(int startstop, int flush)
|
|
|
*/
|
|
|
list_init(&tmplist);
|
|
|
for (list = obj_pt->track_head.next;
|
|
|
- list != &obj_pt->track_head; list = list->next) {
|
|
|
+ list != &obj_pt->track_head; list = list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (list, struct object_tracker, object_list);
|
|
|
if (tracker_pt->object_reload_notify_fn != NULL) {
|
|
|
@@ -342,12 +342,12 @@ static void object_reload_notification(int startstop, int flush)
|
|
|
}
|
|
|
|
|
|
for (list = tmplist.next, tmp = list->next;
|
|
|
- list != tmplist.prev; list = tmp, tmp = list->next) {
|
|
|
+ list != tmplist.prev; list = tmp, tmp = list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (list, struct object_tracker, object_list);
|
|
|
|
|
|
tracker_pt->object_reload_notify_fn(startstop, flush,
|
|
|
- tracker_pt->data_pt);
|
|
|
+ tracker_pt->data_pt);
|
|
|
free(tracker_pt);
|
|
|
}
|
|
|
hdb_handle_put (&object_instance_database, OBJECT_PARENT_HANDLE);
|
|
|
@@ -384,8 +384,8 @@ static int object_create (
|
|
|
if ((object_name_len ==
|
|
|
parent_instance->object_valid_list[i].object_len) &&
|
|
|
(memcmp (object_name,
|
|
|
- parent_instance->object_valid_list[i].object_name,
|
|
|
- object_name_len) == 0)) {
|
|
|
+ parent_instance->object_valid_list[i].object_name,
|
|
|
+ object_name_len) == 0)) {
|
|
|
|
|
|
found = 1;
|
|
|
break;
|
|
|
@@ -506,7 +506,7 @@ static int object_key_create_typed(
|
|
|
objdb_lock();
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
goto error_exit;
|
|
|
}
|
|
|
@@ -556,8 +556,8 @@ static int object_key_create_typed(
|
|
|
if ((key_len ==
|
|
|
instance->object_key_valid_list[i].key_len) &&
|
|
|
(memcmp (key_name,
|
|
|
- instance->object_key_valid_list[i].key_name,
|
|
|
- key_len) == 0)) {
|
|
|
+ instance->object_key_valid_list[i].key_name,
|
|
|
+ key_len) == 0)) {
|
|
|
|
|
|
found = 1;
|
|
|
break;
|
|
|
@@ -588,7 +588,7 @@ static int object_key_create_typed(
|
|
|
object_key = list_entry (list, struct object_key, list);
|
|
|
|
|
|
if ((object_key->key_len == key_len) &&
|
|
|
- (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
+ (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
found = 1;
|
|
|
break;
|
|
|
}
|
|
|
@@ -675,10 +675,10 @@ static int _clear_object(struct object_instance *instance)
|
|
|
struct object_tracker *tracker_pt = NULL;
|
|
|
|
|
|
for (list = instance->key_head.next;
|
|
|
- list != &instance->key_head; ) {
|
|
|
+ list != &instance->key_head; ) {
|
|
|
|
|
|
- object_key = list_entry (list, struct object_key,
|
|
|
- list);
|
|
|
+ object_key = list_entry (list, struct object_key,
|
|
|
+ list);
|
|
|
|
|
|
list = list->next;
|
|
|
|
|
|
@@ -702,10 +702,10 @@ static int _clear_object(struct object_instance *instance)
|
|
|
}
|
|
|
|
|
|
for (list = instance->child_head.next;
|
|
|
- list != &instance->child_head; ) {
|
|
|
+ list != &instance->child_head; ) {
|
|
|
|
|
|
- find_instance = list_entry (list, struct object_instance,
|
|
|
- child_list);
|
|
|
+ find_instance = list_entry (list, struct object_instance,
|
|
|
+ child_list);
|
|
|
res = _clear_object(find_instance);
|
|
|
if (res)
|
|
|
return res;
|
|
|
@@ -781,9 +781,9 @@ error_exit:
|
|
|
}
|
|
|
|
|
|
static int object_key_valid_set (
|
|
|
- hdb_handle_t object_handle,
|
|
|
- struct object_key_valid *object_key_valid_list,
|
|
|
- size_t object_key_valid_list_entries)
|
|
|
+ hdb_handle_t object_handle,
|
|
|
+ struct object_key_valid *object_key_valid_list,
|
|
|
+ size_t object_key_valid_list_entries)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
unsigned int res;
|
|
|
@@ -881,16 +881,16 @@ static int object_find_next (
|
|
|
for (list = object_find_instance->find_child_list->next;
|
|
|
list != object_find_instance->child_head; list = list->next) {
|
|
|
|
|
|
- object_instance = list_entry (list, struct object_instance,
|
|
|
+ object_instance = list_entry (list, struct object_instance,
|
|
|
child_list);
|
|
|
|
|
|
if (object_find_instance->object_len == 0 ||
|
|
|
- ((object_instance->object_name_len ==
|
|
|
- object_find_instance->object_len) &&
|
|
|
+ ((object_instance->object_name_len ==
|
|
|
+ object_find_instance->object_len) &&
|
|
|
|
|
|
- (memcmp (object_instance->object_name,
|
|
|
- object_find_instance->object_name,
|
|
|
- object_find_instance->object_len) == 0))) {
|
|
|
+ (memcmp (object_instance->object_name,
|
|
|
+ object_find_instance->object_name,
|
|
|
+ object_find_instance->object_len) == 0))) {
|
|
|
|
|
|
found = 1;
|
|
|
break;
|
|
|
@@ -1209,7 +1209,7 @@ static int object_key_delete (
|
|
|
object_key = list_entry (list, struct object_key, list);
|
|
|
|
|
|
if ((object_key->key_len == key_len) &&
|
|
|
- (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
+ (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
found = 1;
|
|
|
break;
|
|
|
}
|
|
|
@@ -1266,7 +1266,7 @@ static int object_key_replace (
|
|
|
object_key = list_entry (list, struct object_key, list);
|
|
|
|
|
|
if ((object_key->key_len == key_len) &&
|
|
|
- (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
+ (memcmp (object_key->key_name, key_name, key_len) == 0)) {
|
|
|
found = 1;
|
|
|
break;
|
|
|
}
|
|
|
@@ -1282,10 +1282,10 @@ static int object_key_replace (
|
|
|
if (instance->object_key_valid_list_entries) {
|
|
|
for (i = 0; i < instance->object_key_valid_list_entries; i++) {
|
|
|
if ((key_len ==
|
|
|
- instance->object_key_valid_list[i].key_len) &&
|
|
|
- (memcmp (key_name,
|
|
|
- instance->object_key_valid_list[i].key_name,
|
|
|
- key_len) == 0)) {
|
|
|
+ instance->object_key_valid_list[i].key_len) &&
|
|
|
+ (memcmp (key_name,
|
|
|
+ instance->object_key_valid_list[i].key_name,
|
|
|
+ key_len) == 0)) {
|
|
|
|
|
|
found_validator = 1;
|
|
|
break;
|
|
|
@@ -1392,10 +1392,10 @@ static int _dump_object(struct object_instance *instance, FILE *file, int depth)
|
|
|
fprintf(file, "%s {\n", stringbuf1);
|
|
|
|
|
|
for (list = instance->key_head.next;
|
|
|
- list != &instance->key_head; list = list->next) {
|
|
|
+ list != &instance->key_head; list = list->next) {
|
|
|
|
|
|
- object_key = list_entry (list, struct object_key,
|
|
|
- list);
|
|
|
+ object_key = list_entry (list, struct object_key,
|
|
|
+ list);
|
|
|
|
|
|
memcpy(stringbuf1, object_key->key_name, object_key->key_len);
|
|
|
stringbuf1[object_key->key_len] = '\0';
|
|
|
@@ -1440,10 +1440,10 @@ static int _dump_object(struct object_instance *instance, FILE *file, int depth)
|
|
|
}
|
|
|
|
|
|
for (list = instance->child_head.next;
|
|
|
- list != &instance->child_head; list = list->next) {
|
|
|
+ list != &instance->child_head; list = list->next) {
|
|
|
|
|
|
- find_instance = list_entry (list, struct object_instance,
|
|
|
- child_list);
|
|
|
+ find_instance = list_entry (list, struct object_instance,
|
|
|
+ child_list);
|
|
|
res = _dump_object(find_instance, file, depth+1);
|
|
|
if (res)
|
|
|
return res;
|
|
|
@@ -1465,7 +1465,7 @@ static int object_key_iter_reset(hdb_handle_t object_handle)
|
|
|
objdb_lock();
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
goto error_exit;
|
|
|
}
|
|
|
@@ -1502,7 +1502,7 @@ static int object_key_iter_typed (hdb_handle_t parent_object_handle,
|
|
|
res = -ENOENT;
|
|
|
list = instance->iter_key_list->next;
|
|
|
if (list != &instance->key_head) {
|
|
|
- find_key = list_entry (list, struct object_key, list);
|
|
|
+ find_key = list_entry (list, struct object_key, list);
|
|
|
found = 1;
|
|
|
}
|
|
|
instance->iter_key_list = list;
|
|
|
@@ -1528,10 +1528,10 @@ error_exit:
|
|
|
}
|
|
|
|
|
|
static int object_key_iter(hdb_handle_t parent_object_handle,
|
|
|
- void **key_name,
|
|
|
- size_t *key_len,
|
|
|
- void **value,
|
|
|
- size_t *value_len)
|
|
|
+ void **key_name,
|
|
|
+ size_t *key_len,
|
|
|
+ void **value,
|
|
|
+ size_t *value_len)
|
|
|
{
|
|
|
objdb_value_types_t t;
|
|
|
int ret;
|
|
|
@@ -1546,11 +1546,11 @@ static int object_key_iter(hdb_handle_t parent_object_handle,
|
|
|
}
|
|
|
|
|
|
static int object_key_iter_from(hdb_handle_t parent_object_handle,
|
|
|
- hdb_handle_t start_pos,
|
|
|
- void **key_name,
|
|
|
- size_t *key_len,
|
|
|
- void **value,
|
|
|
- size_t *value_len)
|
|
|
+ hdb_handle_t start_pos,
|
|
|
+ void **key_name,
|
|
|
+ size_t *key_len,
|
|
|
+ void **value,
|
|
|
+ size_t *value_len)
|
|
|
{
|
|
|
unsigned int pos = 0;
|
|
|
unsigned int res;
|
|
|
@@ -1603,7 +1603,7 @@ error_exit:
|
|
|
|
|
|
|
|
|
static int object_parent_get(hdb_handle_t object_handle,
|
|
|
- hdb_handle_t *parent_handle)
|
|
|
+ hdb_handle_t *parent_handle)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
unsigned int res;
|
|
|
@@ -1611,7 +1611,7 @@ static int object_parent_get(hdb_handle_t object_handle,
|
|
|
objdb_lock();
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
objdb_unlock();
|
|
|
return (res);
|
|
|
@@ -1629,15 +1629,15 @@ static int object_parent_get(hdb_handle_t object_handle,
|
|
|
}
|
|
|
|
|
|
static int object_name_get(hdb_handle_t object_handle,
|
|
|
- char *object_name,
|
|
|
- size_t *object_name_len)
|
|
|
+ char *object_name,
|
|
|
+ size_t *object_name_len)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
unsigned int res;
|
|
|
|
|
|
objdb_lock();
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
objdb_unlock();
|
|
|
return (res);
|
|
|
@@ -1654,19 +1654,19 @@ static int object_name_get(hdb_handle_t object_handle,
|
|
|
|
|
|
|
|
|
static int object_track_start(hdb_handle_t object_handle,
|
|
|
- object_track_depth_t depth,
|
|
|
- object_key_change_notify_fn_t key_change_notify_fn,
|
|
|
- object_create_notify_fn_t object_create_notify_fn,
|
|
|
- object_destroy_notify_fn_t object_destroy_notify_fn,
|
|
|
- object_reload_notify_fn_t object_reload_notify_fn,
|
|
|
- void * priv_data_pt)
|
|
|
+ object_track_depth_t depth,
|
|
|
+ object_key_change_notify_fn_t key_change_notify_fn,
|
|
|
+ object_create_notify_fn_t object_create_notify_fn,
|
|
|
+ object_destroy_notify_fn_t object_destroy_notify_fn,
|
|
|
+ object_reload_notify_fn_t object_reload_notify_fn,
|
|
|
+ void * priv_data_pt)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
unsigned int res;
|
|
|
struct object_tracker * tracker_pt;
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
return (res);
|
|
|
}
|
|
|
@@ -1692,10 +1692,10 @@ static int object_track_start(hdb_handle_t object_handle,
|
|
|
}
|
|
|
|
|
|
static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn,
|
|
|
- object_create_notify_fn_t object_create_notify_fn,
|
|
|
- object_destroy_notify_fn_t object_destroy_notify_fn,
|
|
|
- object_reload_notify_fn_t object_reload_notify_fn,
|
|
|
- void * priv_data_pt)
|
|
|
+ object_create_notify_fn_t object_create_notify_fn,
|
|
|
+ object_destroy_notify_fn_t object_destroy_notify_fn,
|
|
|
+ object_reload_notify_fn_t object_reload_notify_fn,
|
|
|
+ void * priv_data_pt)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
struct object_tracker * tracker_pt = NULL;
|
|
|
@@ -1706,24 +1706,24 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn
|
|
|
|
|
|
/* go through the global list and find all the trackers to stop */
|
|
|
for (list = objdb_trackers_head.next, tmp_list = list->next;
|
|
|
- list != &objdb_trackers_head; list = tmp_list, tmp_list = tmp_list->next) {
|
|
|
+ list != &objdb_trackers_head; list = tmp_list, tmp_list = tmp_list->next) {
|
|
|
|
|
|
tracker_pt = list_entry (list, struct object_tracker, tracker_list);
|
|
|
|
|
|
if (tracker_pt && (tracker_pt->data_pt == priv_data_pt) &&
|
|
|
(tracker_pt->object_create_notify_fn == object_create_notify_fn) &&
|
|
|
(tracker_pt->object_destroy_notify_fn == object_destroy_notify_fn) &&
|
|
|
- (tracker_pt->object_reload_notify_fn == object_reload_notify_fn) &&
|
|
|
+ (tracker_pt->object_reload_notify_fn == object_reload_notify_fn) &&
|
|
|
(tracker_pt->key_change_notify_fn == key_change_notify_fn)) {
|
|
|
|
|
|
/* get the object & take this tracker off of it's list. */
|
|
|
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- tracker_pt->object_handle, (void *)&instance);
|
|
|
+ tracker_pt->object_handle, (void *)&instance);
|
|
|
if (res != 0) continue;
|
|
|
|
|
|
for (obj_list = instance->track_head.next, tmp_obj_list = obj_list->next;
|
|
|
- obj_list != &instance->track_head; obj_list = tmp_obj_list, tmp_obj_list = tmp_obj_list->next) {
|
|
|
+ obj_list != &instance->track_head; obj_list = tmp_obj_list, tmp_obj_list = tmp_obj_list->next) {
|
|
|
|
|
|
obj_tracker_pt = list_entry (obj_list, struct object_tracker, object_list);
|
|
|
if (obj_tracker_pt == tracker_pt) {
|
|
|
@@ -1741,14 +1741,14 @@ static void object_track_stop(object_key_change_notify_fn_t key_change_notify_fn
|
|
|
}
|
|
|
|
|
|
static int object_dump(hdb_handle_t object_handle,
|
|
|
- FILE *file)
|
|
|
+ FILE *file)
|
|
|
{
|
|
|
struct object_instance *instance;
|
|
|
unsigned int res;
|
|
|
|
|
|
objdb_lock();
|
|
|
res = hdb_handle_get (&object_instance_database,
|
|
|
- object_handle, (void *)&instance);
|
|
|
+ object_handle, (void *)&instance);
|
|
|
if (res != 0) {
|
|
|
objdb_unlock();
|
|
|
return (res);
|