Merge in data tree sharing, minus locking support, plus a bugfix or two
authorKen Raeburn <raeburn@mit.edu>
Fri, 20 Dec 2002 22:38:04 +0000 (22:38 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 20 Dec 2002 22:38:04 +0000 (22:38 +0000)
commit7c28091d5daeb6431e6e76aeeca9ba1d33665d66
treebe6b961a9753ec8941509c03fa7c16fbbeabf4d9
parent100ac673adeb87a48fa1deb2cff348af36a1c103
Merge in data tree sharing, minus locking support, plus a bugfix or two

* prof_int.h (SHARE_TREE_DATA): Define.
(struct _prf_file_t) [SHARE_TREE_DATA]: Make data field a pointer rather than
an array.
(struct global_shared_profile_data): New type, for profile library global
data.
(krb5int_profile_shared_data): Declare new variable.
(g_shared_trees): New macro, refers to a field in the global data.
(PROFILE_FILE_SHARED): New flag macro.
* prof_file.c (krb5int_profile_shared_data): Initialize here.
(profile_open_file) [SHARE_TREE_DATA]: Scan g_shared_trees for an entry with
the same filename.  If found, increment its reference count, update it, and
return it; otherwise, allocate a new one, and add it to the list after filling
it in.
(profile_dereference_data): New function.  Decrement reference count if
SHARE_TREE_DATA, and free the data if appropriate.
(profile_free_file): Call profile_dereference_data.
(profile_free_file_data) [SHARE_TREE_DATA]: If the SHARED flag is set, remove
it from the g_shared_trees list before freeing.  Free up the allocated space.
* prof_set.c (rw_setup) [SHARE_TREE_DATA]: If the object's data is shared, copy
it into a new data structure not in the global shared list, and dereference the
old one.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15060 dc483132-0cff-0310-8789-dd5450dbe970
src/util/profile/ChangeLog
src/util/profile/prof_file.c
src/util/profile/prof_int.h
src/util/profile/prof_set.c