summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nscd
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-06-13 01:22:56 +0000
committerdes <des@FreeBSD.org>2009-06-13 01:22:56 +0000
commit3301650689d23f8715f942eb1472cdfecaf4972f (patch)
treef86e6d11570ea99885e6d55c1a676a0240a08255 /usr.sbin/nscd
parent4523b4f7c6a153655b464fdf5ee2f78452e9365b (diff)
downloadFreeBSD-src-3301650689d23f8715f942eb1472cdfecaf4972f.zip
FreeBSD-src-3301650689d23f8715f942eb1472cdfecaf4972f.tar.gz
Explain to the compiler why the aliasing we're doing is OK.
MFC after: 1 week
Diffstat (limited to 'usr.sbin/nscd')
-rw-r--r--usr.sbin/nscd/cachelib.c16
-rw-r--r--usr.sbin/nscd/cachelib.h9
-rw-r--r--usr.sbin/nscd/config.c22
-rw-r--r--usr.sbin/nscd/mp_rs_query.c4
-rw-r--r--usr.sbin/nscd/mp_ws_query.c8
-rw-r--r--usr.sbin/nscd/nscd.c4
-rw-r--r--usr.sbin/nscd/query.c8
7 files changed, 33 insertions, 38 deletions
diff --git a/usr.sbin/nscd/cachelib.c b/usr.sbin/nscd/cachelib.c
index d348a97..5817255 100644
--- a/usr.sbin/nscd/cachelib.c
+++ b/usr.sbin/nscd/cachelib.c
@@ -565,13 +565,13 @@ register_cache_entry(struct cache_ *the_cache,
new_common_entry->params =
(struct cache_entry_params *)&new_common_entry->common_params;
- new_common_entry->common_params.entry_name = (char *)calloc(1,
+ new_common_entry->common_params.cep.entry_name = (char *)calloc(1,
entry_name_size);
- assert(new_common_entry->common_params.entry_name != NULL);
- strlcpy(new_common_entry->common_params.entry_name,
+ assert(new_common_entry->common_params.cep.entry_name != NULL);
+ strlcpy(new_common_entry->common_params.cep.entry_name,
params->entry_name, entry_name_size);
new_common_entry->name =
- new_common_entry->common_params.entry_name;
+ new_common_entry->common_params.cep.entry_name;
HASHTABLE_INIT(&(new_common_entry->items),
struct cache_ht_item_data_, data,
@@ -619,12 +619,12 @@ register_cache_entry(struct cache_ *the_cache,
new_mp_entry->params =
(struct cache_entry_params *)&new_mp_entry->mp_params;
- new_mp_entry->mp_params.entry_name = (char *)calloc(1,
+ new_mp_entry->mp_params.cep.entry_name = (char *)calloc(1,
entry_name_size);
- assert(new_mp_entry->mp_params.entry_name != NULL);
- strlcpy(new_mp_entry->mp_params.entry_name, params->entry_name,
+ assert(new_mp_entry->mp_params.cep.entry_name != NULL);
+ strlcpy(new_mp_entry->mp_params.cep.entry_name, params->entry_name,
entry_name_size);
- new_mp_entry->name = new_mp_entry->mp_params.entry_name;
+ new_mp_entry->name = new_mp_entry->mp_params.cep.entry_name;
TAILQ_INIT(&new_mp_entry->ws_head);
TAILQ_INIT(&new_mp_entry->rs_head);
diff --git a/usr.sbin/nscd/cachelib.h b/usr.sbin/nscd/cachelib.h
index a80bd48..e466f1f 100644
--- a/usr.sbin/nscd/cachelib.h
+++ b/usr.sbin/nscd/cachelib.h
@@ -87,11 +87,8 @@ struct cache_entry_params
/* params, used for most entries */
struct common_cache_entry_params
{
- /* inherited fields */
- enum cache_entry_t entry_type;
+ struct cache_entry_params cep;
- /* unique fields */
- char *entry_name;
size_t cache_entries_size;
size_t max_elemsize; /* if 0 then no check is made */
@@ -105,9 +102,7 @@ struct common_cache_entry_params
/* params, used for multipart entries */
struct mp_cache_entry_params
{
- /* inherited fields */
- enum cache_entry_t entry_type;
- char *entry_name;
+ struct cache_entry_params cep;
/* unique fields */
size_t max_elemsize; /* if 0 then no check is made */
diff --git a/usr.sbin/nscd/config.c b/usr.sbin/nscd/config.c
index 6c72fbe..367ea23 100644
--- a/usr.sbin/nscd/config.c
+++ b/usr.sbin/nscd/config.c
@@ -176,14 +176,14 @@ create_configuration_entry(const char *name,
memcpy(&retval->mp_query_timeout, mp_timeout,
sizeof(struct timeval));
- asprintf(&retval->positive_cache_params.entry_name, "%s+", name);
- assert(retval->positive_cache_params.entry_name != NULL);
+ asprintf(&retval->positive_cache_params.cep.entry_name, "%s+", name);
+ assert(retval->positive_cache_params.cep.entry_name != NULL);
- asprintf(&retval->negative_cache_params.entry_name, "%s-", name);
- assert(retval->negative_cache_params.entry_name != NULL);
+ asprintf(&retval->negative_cache_params.cep.entry_name, "%s-", name);
+ assert(retval->negative_cache_params.cep.entry_name != NULL);
- asprintf(&retval->mp_cache_params.entry_name, "%s*", name);
- assert(retval->mp_cache_params.entry_name != NULL);
+ asprintf(&retval->mp_cache_params.cep.entry_name, "%s*", name);
+ assert(retval->mp_cache_params.cep.entry_name != NULL);
TRACE_OUT(create_configuration_entry);
return (retval);
@@ -204,7 +204,7 @@ create_def_configuration_entry(const char *name)
TRACE_IN(create_def_configuration_entry);
memset(&positive_params, 0,
sizeof(struct common_cache_entry_params));
- positive_params.entry_type = CET_COMMON;
+ positive_params.cep.entry_type = CET_COMMON;
positive_params.cache_entries_size = DEFAULT_CACHE_HT_SIZE;
positive_params.max_elemsize = DEFAULT_POSITIVE_ELEMENTS_SIZE;
positive_params.satisf_elemsize = DEFAULT_POSITIVE_ELEMENTS_SIZE / 2;
@@ -226,7 +226,7 @@ create_def_configuration_entry(const char *name)
memset(&mp_params, 0,
sizeof(struct mp_cache_entry_params));
- mp_params.entry_type = CET_MULTIPART;
+ mp_params.cep.entry_type = CET_MULTIPART;
mp_params.max_elemsize = DEFAULT_MULTIPART_ELEMENTS_SIZE;
mp_params.max_sessions = DEFAULT_MULITPART_SESSIONS_SIZE;
mp_params.max_lifetime.tv_sec = DEFAULT_MULITPART_LIFETIME;
@@ -248,9 +248,9 @@ destroy_configuration_entry(struct configuration_entry *entry)
pthread_mutex_destroy(&entry->negative_cache_lock);
pthread_mutex_destroy(&entry->mp_cache_lock);
free(entry->name);
- free(entry->positive_cache_params.entry_name);
- free(entry->negative_cache_params.entry_name);
- free(entry->mp_cache_params.entry_name);
+ free(entry->positive_cache_params.cep.entry_name);
+ free(entry->negative_cache_params.cep.entry_name);
+ free(entry->mp_cache_params.cep.entry_name);
free(entry->mp_cache_entries);
free(entry);
TRACE_OUT(destroy_configuration_entry);
diff --git a/usr.sbin/nscd/mp_rs_query.c b/usr.sbin/nscd/mp_rs_query.c
index 98e9090..81f128e 100644
--- a/usr.sbin/nscd/mp_rs_query.c
+++ b/usr.sbin/nscd/mp_rs_query.c
@@ -198,7 +198,7 @@ on_mp_read_session_request_process(struct query_state *qstate)
if (qstate->config_entry->perform_actual_lookups != 0)
dec_cache_entry_name = strdup(
- qstate->config_entry->mp_cache_params.entry_name);
+ qstate->config_entry->mp_cache_params.cep.entry_name);
else {
#ifdef NS_NSCD_EID_CHECKING
if (check_query_eids(qstate) != 0) {
@@ -208,7 +208,7 @@ on_mp_read_session_request_process(struct query_state *qstate)
#endif
asprintf(&dec_cache_entry_name, "%s%s", qstate->eid_str,
- qstate->config_entry->mp_cache_params.entry_name);
+ qstate->config_entry->mp_cache_params.cep.entry_name);
}
assert(dec_cache_entry_name != NULL);
diff --git a/usr.sbin/nscd/mp_ws_query.c b/usr.sbin/nscd/mp_ws_query.c
index a2df070..5ac4c0c 100644
--- a/usr.sbin/nscd/mp_ws_query.c
+++ b/usr.sbin/nscd/mp_ws_query.c
@@ -216,7 +216,7 @@ on_mp_write_session_request_process(struct query_state *qstate)
* cache entries - each with its own decorated name.
*/
asprintf(&dec_cache_entry_name, "%s%s", qstate->eid_str,
- qstate->config_entry->mp_cache_params.entry_name);
+ qstate->config_entry->mp_cache_params.cep.entry_name);
assert(dec_cache_entry_name != NULL);
configuration_lock_rdlock(s_configuration);
@@ -522,12 +522,12 @@ cache_entry register_new_mp_cache_entry(struct query_state *qstate,
configuration_lock_entry(qstate->config_entry, CELT_MULTIPART);
configuration_lock_wrlock(s_configuration);
- en_bkp = qstate->config_entry->mp_cache_params.entry_name;
- qstate->config_entry->mp_cache_params.entry_name =
+ en_bkp = qstate->config_entry->mp_cache_params.cep.entry_name;
+ qstate->config_entry->mp_cache_params.cep.entry_name =
(char *)dec_cache_entry_name;
register_cache_entry(s_cache, (struct cache_entry_params *)
&qstate->config_entry->mp_cache_params);
- qstate->config_entry->mp_cache_params.entry_name = en_bkp;
+ qstate->config_entry->mp_cache_params.cep.entry_name = en_bkp;
configuration_unlock(s_configuration);
configuration_lock_rdlock(s_configuration);
diff --git a/usr.sbin/nscd/nscd.c b/usr.sbin/nscd/nscd.c
index 5291275..59b3c12 100644
--- a/usr.sbin/nscd/nscd.c
+++ b/usr.sbin/nscd/nscd.c
@@ -123,14 +123,14 @@ init_cache_(struct configuration *config)
res = register_cache_entry(retval, (struct cache_entry_params *)
&config_entry->positive_cache_params);
config_entry->positive_cache_entry = find_cache_entry(retval,
- config_entry->positive_cache_params.entry_name);
+ config_entry->positive_cache_params.cep.entry_name);
assert(config_entry->positive_cache_entry !=
INVALID_CACHE_ENTRY);
res = register_cache_entry(retval, (struct cache_entry_params *)
&config_entry->negative_cache_params);
config_entry->negative_cache_entry = find_cache_entry(retval,
- config_entry->negative_cache_params.entry_name);
+ config_entry->negative_cache_params.cep.entry_name);
assert(config_entry->negative_cache_entry !=
INVALID_CACHE_ENTRY);
}
diff --git a/usr.sbin/nscd/query.c b/usr.sbin/nscd/query.c
index f927ac5..fff6aff 100644
--- a/usr.sbin/nscd/query.c
+++ b/usr.sbin/nscd/query.c
@@ -437,7 +437,7 @@ on_write_request_process(struct query_state *qstate)
configuration_lock_rdlock(s_configuration);
c_entry = find_cache_entry(s_cache,
- qstate->config_entry->positive_cache_params.entry_name);
+ qstate->config_entry->positive_cache_params.cep.entry_name);
configuration_unlock(s_configuration);
if (c_entry != NULL) {
configuration_lock_entry(qstate->config_entry, CELT_POSITIVE);
@@ -518,7 +518,7 @@ on_negative_write_request_process(struct query_state *qstate)
configuration_lock_rdlock(s_configuration);
c_entry = find_cache_entry(s_cache,
- qstate->config_entry->negative_cache_params.entry_name);
+ qstate->config_entry->negative_cache_params.cep.entry_name);
configuration_unlock(s_configuration);
if (c_entry != NULL) {
configuration_lock_entry(qstate->config_entry, CELT_NEGATIVE);
@@ -710,9 +710,9 @@ on_read_request_process(struct query_state *qstate)
configuration_lock_rdlock(s_configuration);
c_entry = find_cache_entry(s_cache,
- qstate->config_entry->positive_cache_params.entry_name);
+ qstate->config_entry->positive_cache_params.cep.entry_name);
neg_c_entry = find_cache_entry(s_cache,
- qstate->config_entry->negative_cache_params.entry_name);
+ qstate->config_entry->negative_cache_params.cep.entry_name);
configuration_unlock(s_configuration);
if ((c_entry != NULL) && (neg_c_entry != NULL)) {
configuration_lock_entry(qstate->config_entry, CELT_POSITIVE);
OpenPOWER on IntegriCloud