prof_int.h revision 159d09a20817016f09b3ea28d1bdada4a336bb91
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*/
/* Solaris Kerberos */
#ifndef __PROF_INT_H
#include <time.h>
#include <stdio.h>
#include <TargetConditionals.h>
#endif
#include "k5-thread.h"
#include "k5-platform.h"
#include "com_err.h"
#include "profile.h"
typedef long prf_magic_t;
/*
* This is the structure which stores the profile information for a
* particular configuration file.
*
* Locking strategy:
* - filespec, fslen are fixed after creation
* - refcount and next should only be tweaked with the global lock held
* - other fields can be tweaked after grabbing the in-struct lock
*/
struct _prf_data_t {
struct profile_node *root;
unsigned long frac_ts; /* fractional part of timestamp, if any */
int flags; /* r/w, dirty */
int upd_serial; /* incremented when data changes */
char *comment;
/* Some separation between fields controlled by different
mutexes. Theoretically, both could be accessed at the same
time from different threads on different CPUs with separate
caches. Don't let the threads clobber each other's
changes. One mutex controlling the whole thing would be
better, but sufficient separation might suffice.
This is icky. I just hope it's adequate.
For next major release, fix this. */
int refcount; /* prf_file_t references */
struct _prf_data_t *next;
/* Was: "profile_filespec_t filespec". Now: flexible char
array ... except, we need to work in C89, so an array
length must be specified. */
};
typedef struct _prf_data_t *prf_data_t;
prf_data_t profile_make_prf_data(const char *);
struct _prf_file_t {
struct _prf_data_t *data;
struct _prf_file_t *next;
};
typedef struct _prf_file_t *prf_file_t;
/*
* The profile flags
*/
#define PROFILE_FILE_RW 0x0001
#define PROFILE_FILE_DIRTY 0x0002
#define PROFILE_FILE_SHARED 0x0004
/*
* This structure defines the high-level, user visible profile_t
* object, which is used as a handle by users who need to query some
* configuration file(s)
*/
struct _profile_t {
};
typedef struct _profile_options {
char *name;
int *value;
int found;
typedef struct _profile_times {
char *name;
char **value;
int found;
/*
* Used by the profile iterator in prof_get.c
*/
#define PROFILE_ITER_LIST_SECTION 0x0001
#define PROFILE_ITER_SECTIONS_ONLY 0x0002
#define PROFILE_ITER_RELATIONS_ONLY 0x0004
#define PROFILE_ITER_FINAL_SEEN 0x0100
/*
* Check if a filespec is last in a list (NULL on UNIX, invalid FSSpec on MacOS
*/
/* profile_parse.c */
/* prof_tree.c */
void profile_free_node
(struct profile_node *relation);
struct profile_node **ret_node);
(struct profile_node *node);
(struct profile_node *section,
struct profile_node **ret_node);
(struct profile_node *node);
(struct profile_node *node);
const char *profile_get_node_name
(struct profile_node *node);
const char *profile_get_node_value
(struct profile_node *node);
(struct profile_node *section,
int section_flag, void **state,
struct profile_node **node);
(struct profile_node *section,
(struct profile_node *section,
(struct profile_node *section,
struct profile_node **parent);
char **ret_name);
(void **iter_p);
(struct profile_node *node);
/* prof_file.c */
#define profile_flush_file(P) (((P) && (P)->magic == PROF_MAGIC_FILE) ? profile_flush_file_data((P)->data) : PROF_MAGIC_FILE)
(prf_data_t data);
#define profile_flush_file_to_file(P,F) (((P) && (P)->magic == PROF_MAGIC_FILE) ? profile_flush_file_data_to_file((P)->data, (F)) : PROF_MAGIC_FILE)
void profile_free_file
void profile_dereference_data (prf_data_t);
int profile_lock_global (void);
int profile_unlock_global (void);
/* prof_init.c -- included from profile.h */
/* prof_get.c */
const char **ret_value);
/* Others included from profile.h */
/* prof_set.c -- included from profile.h */
/* Solaris Kerberos */
#define __PROF_INT_H
#endif