• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/MITKerberosShim-62.1/profile/

Lines Matching refs:data

118 static int r_access(prf_data_t data)
121 if (data->uid != geteuid())
125 const_profile_filespec_t filespec = data->filespec;
151 if (profile && profile->data) {
152 return rw_access(profile->data->filespec);
196 prf_data_t data;
248 for (data = g_shared_trees; data; data = data->next)
249 data->flags |= PROFILE_FILE_INVALID;
254 for (data = g_shared_trees; data; data = data->next) {
255 if (!strcmp(data->filespec, expanded_filename)
257 && r_access(data))
260 if (data) {
261 data->refcount++;
263 retval = profile_update_file_data(data);
266 prf->data = data;
269 data->refcount--;
278 for (data = g_shared_trees; data; data = data->next) {
279 if (!strcmp(data->filespec, expanded_filename) &&
280 (data->flags & PROFILE_FILE_SHARED))
282 profile_dereference_data_locked(data);
290 if (data == NULL) {
293 for (data = g_shared_trees; data; data = data->next) {
294 if ((data->flags & PROFILE_FILE_SHARED) && data->refcount == 1)
295 last = data;
302 data = profile_make_prf_data(expanded_filename);
303 if (data == NULL) {
309 prf->data = data;
311 retval = pthread_mutex_init(&data->lock, NULL);
313 free(data);
318 retval = profile_update_file_data(prf->data);
331 data->flags |= PROFILE_FILE_SHARED;
333 data->refcount++;
335 data->next = g_shared_trees;
336 g_shared_trees = data;
357 errcode_t profile_update_file_data(prf_data_t data)
369 retval = pthread_mutex_lock(&data->lock);
374 retval = (data->flags & (PROFILE_FILE_INVALID|PROFILE_FILE_HAVE_DATA));
377 if (data->root == NULL)
379 pthread_mutex_unlock(&data->lock);
382 data->flags &= ~PROFILE_FILE_INVALID; /* invalid would be striped of below, but humor us */
386 if (now == data->last_stat && data->root != NULL) {
387 pthread_mutex_unlock(&data->lock);
390 if (stat(data->filespec, &st)) {
392 pthread_mutex_unlock(&data->lock);
395 data->last_stat = now;
405 if (st.st_mtime == data->timestamp
406 && frac == data->frac_ts
407 && data->root != NULL) {
408 pthread_mutex_unlock(&data->lock);
417 if (data->root) {
418 pthread_mutex_unlock(&data->lock);
423 if (data->root) {
424 profile_free_node(data->root);
425 data->root = 0;
427 if (data->comment) {
428 free(data->comment);
429 data->comment = 0;
432 data->upd_serial++;
433 data->flags &= PROFILE_FILE_SHARED; /* FIXME same as '=' operator */
436 f = fopen(data->filespec, "r");
442 data->flags |= PROFILE_FILE_HAVE_DATA;
443 pthread_mutex_unlock(&data->lock);
449 retval = profile_parse_file(f, &data->root);
452 pthread_mutex_unlock(&data->lock);
455 assert(data->root != NULL);
458 data->timestamp = st.st_mtime;
459 data->frac_ts = frac;
462 data->flags |= PROFILE_FILE_HAVE_DATA;
463 pthread_mutex_unlock(&data->lock);
477 static errcode_t write_data_to_file(prf_data_t data, const char *outfile,
509 if (data->root)
510 profile_write_tree_file(data->root, f);
535 small window where data->filespec does not refer to
551 data->flags = 0;
564 errcode_t profile_flush_file_data_to_buffer (prf_data_t data, char **bufp)
567 retval = pthread_mutex_lock(&data->lock);
570 retval = profile_write_tree_to_buffer(data->root, bufp);
571 pthread_mutex_unlock(&data->lock);
575 errcode_t profile_flush_file_data(prf_data_t data)
579 if (!data || data->magic != PROF_MAGIC_FILE_DATA)
582 retval = pthread_mutex_lock(&data->lock);
586 if ((data->flags & PROFILE_FILE_DIRTY) == 0) {
587 pthread_mutex_unlock(&data->lock);
591 retval = write_data_to_file(data, data->filespec, 0);
592 pthread_mutex_unlock(&data->lock);
596 errcode_t profile_flush_file_data_to_file(prf_data_t data, const char *outfile)
600 if (!data || data->magic != PROF_MAGIC_FILE_DATA)
603 retval = pthread_mutex_lock(&data->lock);
606 retval = write_data_to_file(data, outfile, 1);
607 pthread_mutex_unlock(&data->lock);
613 void profile_dereference_data(prf_data_t data)
619 profile_dereference_data_locked(data);
622 void profile_dereference_data_locked(prf_data_t data)
625 data->refcount--;
626 if (data->refcount == 0)
627 profile_free_file_data(data);
642 profile_dereference_data(prf->data);
647 static void profile_free_file_data(prf_data_t data)
650 if (data->flags & PROFILE_FILE_SHARED) {
652 if (g_shared_trees == data)
653 g_shared_trees = data->next;
659 if (next == data) {
668 if (data->root)
669 profile_free_node(data->root);
670 if (data->comment)
671 free(data->comment);
672 data->magic = 0;
673 pthread_mutex_destroy(&data->lock);
674 free(data);