Remove "extern" from function prototypes, and fix some (but not all)

style(9) violations.

MFC after:	1 week
This commit is contained in:
Dag-Erling Smørgrav 2009-06-13 14:12:55 +00:00
parent 4ec1748cfe
commit d2432adb9a
15 changed files with 157 additions and 199 deletions

View File

@ -63,10 +63,9 @@ struct agent_table {
size_t agents_num;
};
extern struct agent_table *init_agent_table(void);
extern void register_agent(struct agent_table *, struct agent *);
extern struct agent *find_agent(struct agent_table *, const char *,
enum agent_type);
extern void destroy_agent_table(struct agent_table *);
struct agent_table *init_agent_table(void);
void register_agent(struct agent_table *, struct agent *);
struct agent *find_agent(struct agent_table *, const char *, enum agent_type);
void destroy_agent_table(struct agent_table *);
#endif

View File

@ -28,5 +28,5 @@
#include "../agent.h"
extern struct agent *init_group_agent(void);
extern struct agent *init_group_mp_agent(void);
struct agent *init_group_agent(void);
struct agent *init_group_mp_agent(void);

View File

@ -28,5 +28,5 @@
#include "../agent.h"
extern struct agent *init_passwd_agent(void);
extern struct agent *init_passwd_mp_agent(void);
struct agent *init_passwd_agent(void);
struct agent *init_passwd_mp_agent(void);

View File

@ -28,5 +28,5 @@
#include "../agent.h"
extern struct agent *init_services_agent(void);
extern struct agent *init_services_mp_agent(void);
struct agent *init_services_agent(void);
struct agent *init_services_mp_agent(void);

View File

@ -69,8 +69,7 @@ enum part_position_t {
* by using one entry.
* get_time_func is needed to have the clocks-independent counter
*/
struct cache_params
{
struct cache_params {
void (*get_time_func)(struct timeval *);
};
@ -78,15 +77,13 @@ struct cache_params
* base structure - normal_cache_entry_params and multipart_cache_entry_params
* are "inherited" from it
*/
struct cache_entry_params
{
struct cache_entry_params {
enum cache_entry_t entry_type;
char *entry_name;
};
/* params, used for most entries */
struct common_cache_entry_params
{
struct common_cache_entry_params {
struct cache_entry_params cep;
size_t cache_entries_size;
@ -100,8 +97,7 @@ struct common_cache_entry_params
};
/* params, used for multipart entries */
struct mp_cache_entry_params
{
struct mp_cache_entry_params {
struct cache_entry_params cep;
/* unique fields */
@ -111,8 +107,7 @@ struct mp_cache_entry_params
struct timeval max_lifetime; /* maximum elements lifetime */
};
struct cache_ht_item_data_
{
struct cache_ht_item_data_ {
/* key is the bytes sequence only - not the null-terminated string */
char *key;
size_t key_size;
@ -123,19 +118,16 @@ struct cache_ht_item_data_
struct cache_policy_item_ *fifo_policy_item;
};
struct cache_ht_item_
{
struct cache_ht_item_ {
HASHTABLE_ENTRY_HEAD(ht_item_, struct cache_ht_item_data_) data;
};
struct cache_entry_
{
struct cache_entry_ {
char *name;
struct cache_entry_params *params;
};
struct cache_common_entry_
{
struct cache_common_entry_ {
char *name;
struct cache_entry_params *params;
@ -163,8 +155,7 @@ struct cache_mp_data_item_ {
TAILQ_ENTRY(cache_mp_data_item_) entries;
};
struct cache_mp_write_session_
{
struct cache_mp_write_session_ {
struct cache_mp_entry_ *parent_entry;
/*
@ -177,16 +168,14 @@ struct cache_mp_write_session_
TAILQ_ENTRY(cache_mp_write_session_) entries;
};
struct cache_mp_read_session_
{
struct cache_mp_read_session_ {
struct cache_mp_entry_ *parent_entry;
struct cache_mp_data_item_ *current_item;
TAILQ_ENTRY(cache_mp_read_session_) entries;
};
struct cache_mp_entry_
{
struct cache_mp_entry_ {
char *name;
struct cache_entry_params *params;
@ -217,8 +206,7 @@ struct cache_mp_entry_
void (*get_time_func)(struct timeval *);
};
struct cache_
{
struct cache_ {
struct cache_params params;
struct cache_entry_ **entries;
@ -243,31 +231,31 @@ typedef struct cache_mp_read_session_ *cache_mp_read_session;
*/
/* cache initialization/destruction routines */
extern cache init_cache(struct cache_params const *);
extern void destroy_cache(cache);
cache init_cache(struct cache_params const *);
void destroy_cache(cache);
/* cache entries manipulation routines */
extern int register_cache_entry(cache, struct cache_entry_params const *);
extern int unregister_cache_entry(cache, const char *);
extern cache_entry find_cache_entry(cache, const char *);
int register_cache_entry(cache, struct cache_entry_params const *);
int unregister_cache_entry(cache, const char *);
cache_entry find_cache_entry(cache, const char *);
/* read/write operations used on common entries */
extern int cache_read(cache_entry, const char *, size_t, char *, size_t *);
extern int cache_write(cache_entry, const char *, size_t, char const *, size_t);
int cache_read(cache_entry, const char *, size_t, char *, size_t *);
int cache_write(cache_entry, const char *, size_t, char const *, size_t);
/* read/write operations used on multipart entries */
extern cache_mp_write_session open_cache_mp_write_session(cache_entry);
extern int cache_mp_write(cache_mp_write_session, char *, size_t);
extern void abandon_cache_mp_write_session(cache_mp_write_session);
extern void close_cache_mp_write_session(cache_mp_write_session);
cache_mp_write_session open_cache_mp_write_session(cache_entry);
int cache_mp_write(cache_mp_write_session, char *, size_t);
void abandon_cache_mp_write_session(cache_mp_write_session);
void close_cache_mp_write_session(cache_mp_write_session);
extern cache_mp_read_session open_cache_mp_read_session(cache_entry);
extern int cache_mp_read(cache_mp_read_session, char *, size_t *);
extern void close_cache_mp_read_session(cache_mp_read_session);
cache_mp_read_session open_cache_mp_read_session(cache_entry);
int cache_mp_read(cache_mp_read_session, char *, size_t *);
void close_cache_mp_read_session(cache_mp_read_session);
/* transformation routines */
extern int transform_cache_entry(cache_entry, enum cache_transformation_t);
extern int transform_cache_entry_part(cache_entry, enum cache_transformation_t,
int transform_cache_entry(cache_entry, enum cache_transformation_t);
int transform_cache_entry_part(cache_entry, enum cache_transformation_t,
const char *, size_t, enum part_position_t);
#endif

View File

@ -39,8 +39,7 @@
* queue. connected_item pointers to the corresponding cache_policy_item_ in
* another policy queue.
*/
struct cache_policy_item_
{
struct cache_policy_item_ {
char *key;
size_t key_size;
@ -55,8 +54,7 @@ struct cache_policy_item_
* cache_policy_ represents an abstract policy queue. It can be customized by
* setting appropriate function pointers
*/
struct cache_policy_
{
struct cache_policy_ {
struct cache_policy_item_* (*create_item_func)(void);
void (*destroy_item_func)(struct cache_policy_item_ *);
@ -80,8 +78,7 @@ struct cache_policy_
/*
* LFU cache policy item "inherited" from cache_policy_item_ structure
*/
struct cache_lfu_policy_item_
{
struct cache_lfu_policy_item_ {
struct cache_policy_item_ parent_data;
int frequency;
@ -93,8 +90,7 @@ TAILQ_HEAD(cache_lfu_policy_group_, cache_lfu_policy_item_);
/*
* LFU policy queue "inherited" from cache_policy_.
*/
struct cache_lfu_policy_
{
struct cache_lfu_policy_ {
struct cache_policy_ parent_data;
struct cache_lfu_policy_group_ groups[CACHELIB_MAX_FREQUENCY];
};
@ -102,8 +98,7 @@ struct cache_lfu_policy_
/*
* LRU and FIFO policies item "inherited" from cache_policy_item_
*/
struct cache_queue_policy_item_
{
struct cache_queue_policy_item_ {
struct cache_policy_item_ parent_data;
TAILQ_ENTRY(cache_queue_policy_item_) entries;
};
@ -111,8 +106,7 @@ struct cache_queue_policy_item_
/*
* LRU and FIFO policies "inherited" from cache_policy_
*/
struct cache_queue_policy_
{
struct cache_queue_policy_ {
struct cache_policy_ parent_data;
TAILQ_HEAD(cache_queue_policy_head_, cache_queue_policy_item_) head;
};
@ -121,15 +115,15 @@ typedef struct cache_queue_policy_ cache_fifo_policy_;
typedef struct cache_queue_policy_ cache_lru_policy_;
/* fifo policy routines */
extern struct cache_policy_ *init_cache_fifo_policy(void);
extern void destroy_cache_fifo_policy(struct cache_policy_ *);
struct cache_policy_ *init_cache_fifo_policy(void);
void destroy_cache_fifo_policy(struct cache_policy_ *);
/* lru policy routines */
extern struct cache_policy_ *init_cache_lru_policy(void);
extern void destroy_cache_lru_policy(struct cache_policy_ *);
struct cache_policy_ *init_cache_lru_policy(void);
void destroy_cache_lru_policy(struct cache_policy_ *);
/* lfu policy routines */
extern struct cache_policy_ *init_cache_lfu_policy(void);
extern void destroy_cache_lfu_policy(struct cache_policy_ *);
struct cache_policy_ *init_cache_lfu_policy(void);
void destroy_cache_lfu_policy(struct cache_policy_ *);
#endif

View File

@ -115,37 +115,34 @@ enum config_entry_lock_type {
CELT_MULTIPART
};
extern struct configuration *init_configuration(void);
extern void destroy_configuration(struct configuration *);
extern void fill_configuration_defaults(struct configuration *);
struct configuration *init_configuration(void);
void destroy_configuration(struct configuration *);
void fill_configuration_defaults(struct configuration *);
extern int add_configuration_entry(struct configuration *,
int add_configuration_entry(struct configuration *,
struct configuration_entry *);
extern struct configuration_entry *create_def_configuration_entry(
struct configuration_entry *create_def_configuration_entry(const char *);
void destroy_configuration_entry(struct configuration_entry *);
size_t configuration_get_entries_size(struct configuration *);
struct configuration_entry *configuration_get_entry(struct configuration *,
size_t);
struct configuration_entry *configuration_find_entry(struct configuration *,
const char *);
extern void destroy_configuration_entry(struct configuration_entry *);
extern size_t configuration_get_entries_size(struct configuration *);
extern struct configuration_entry *configuration_get_entry(
struct configuration *, size_t);
extern struct configuration_entry *configuration_find_entry(
struct configuration *, const char *);
extern int configuration_entry_add_mp_cache_entry(struct configuration_entry *,
int configuration_entry_add_mp_cache_entry(struct configuration_entry *,
cache_entry);
extern cache_entry configuration_entry_find_mp_cache_entry(
struct configuration_entry *,
const char *);
extern int configuration_entry_find_mp_cache_entries(
struct configuration_entry *, const char *, cache_entry **,
cache_entry **);
cache_entry configuration_entry_find_mp_cache_entry(
struct configuration_entry *, const char *);
int configuration_entry_find_mp_cache_entries(struct configuration_entry *,
const char *, cache_entry **, cache_entry **);
extern void configuration_lock_rdlock(struct configuration *config);
extern void configuration_lock_wrlock(struct configuration *config);
extern void configuration_unlock(struct configuration *config);
void configuration_lock_rdlock(struct configuration *config);
void configuration_lock_wrlock(struct configuration *config);
void configuration_unlock(struct configuration *config);
extern void configuration_lock_entry(struct configuration_entry *,
void configuration_lock_entry(struct configuration_entry *,
enum config_entry_lock_type);
extern void configuration_unlock_entry(struct configuration_entry *,
void configuration_unlock_entry(struct configuration_entry *,
enum config_entry_lock_type);
#endif

View File

@ -54,14 +54,14 @@
#define TRACE_OFF() (void)0
#endif
extern void nscd_trace_in(const char *, const char *, int);
extern void nscd_trace_point(const char *, int);
extern void nscd_trace_msg(const char *, const char *, int);
extern void nscd_trace_ptr(const char *, const void *, const char *, int);
extern void nscd_trace_int(const char *, int, const char *, int);
extern void nscd_trace_str(const char *, const char *, const char *, int);
extern void nscd_trace_out(const char *, const char *, int);
extern void nscd_trace_on(void);
extern void nscd_trace_off(void);
void nscd_trace_in(const char *, const char *, int);
void nscd_trace_point(const char *, int);
void nscd_trace_msg(const char *, const char *, int);
void nscd_trace_ptr(const char *, const void *, const char *, int);
void nscd_trace_int(const char *, int, const char *, int);
void nscd_trace_str(const char *, const char *, const char *, int);
void nscd_trace_out(const char *, const char *, int);
void nscd_trace_on(void);
void nscd_trace_off(void);
#endif

View File

@ -37,7 +37,7 @@
#define LOG_ERR_2(sender, err, ...) __log_err(2, sender, err, ##__VA_ARGS__)
#define LOG_ERR_3(sender, err, ...) __log_err(3, sender, err, ##__VA_ARGS__)
extern void __log_msg(int, const char *, const char *, ...);
extern void __log_err(int, const char *, const char *, ...);
void __log_msg(int, const char *, const char *, ...);
void __log_err(int, const char *, const char *, ...);
#endif

View File

@ -29,6 +29,6 @@
#ifndef __NSCD_MP_RS_QUERY_H__
#define __NSCD_MP_RS_QUERY_H__
extern int on_mp_read_session_request_read1(struct query_state *);
int on_mp_read_session_request_read1(struct query_state *);
#endif

View File

@ -29,8 +29,7 @@
#ifndef __NSCD_MP_WS_QUERY_H__
#define __NSCD_MP_WS_QUERY_H__
extern int on_mp_write_session_request_read1(struct query_state *);
extern cache_entry register_new_mp_cache_entry(struct query_state *,
const char *);
int on_mp_write_session_request_read1(struct query_state *);
cache_entry register_new_mp_cache_entry(struct query_state *, const char *);
#endif

View File

@ -30,28 +30,26 @@
#define __NSCD_NSCDCLI_H__
struct nscd_connection_params {
char *socket_path;
struct timeval timeout;
char *socket_path;
struct timeval timeout;
};
struct nscd_connection_ {
int sockfd;
int sockfd;
int read_queue;
int write_queue;
};
/* simple abstractions for not to write "struct" every time */
typedef struct nscd_connection_ *nscd_connection;
typedef struct nscd_connection_ *nscd_mp_write_session;
typedef struct nscd_connection_ *nscd_mp_read_session;
typedef struct nscd_connection_ *nscd_connection;
typedef struct nscd_connection_ *nscd_mp_write_session;
typedef struct nscd_connection_ *nscd_mp_read_session;
#define INVALID_NSCD_CONNECTION (NULL)
/* initialization/destruction routines */
extern nscd_connection open_nscd_connection__(
struct nscd_connection_params const *);
extern void close_nscd_connection__(nscd_connection);
extern int nscd_transform__(nscd_connection, const char *, int);
nscd_connection open_nscd_connection__(struct nscd_connection_params const *);
void close_nscd_connection__(nscd_connection);
int nscd_transform__(nscd_connection, const char *, int);
#endif

View File

@ -29,7 +29,7 @@
#ifndef __NSCD_PARSER_H__
#define __NSCD_PARSER_H__
extern int parse_config_file(struct configuration *,
int parse_config_file(struct configuration *,
const char *, char const **, int *);
#endif

View File

@ -37,8 +37,7 @@
#define BUFSIZE_INVALID(x) (!BUFSIZE_CORRECT(x))
/* structures below represent the data that are sent/received by the daemon */
struct cache_write_request
{
struct cache_write_request {
char *entry;
char *cache_key;
char *data;
@ -48,13 +47,11 @@ struct cache_write_request
size_t data_size;
};
struct cache_write_response
{
struct cache_write_response {
int error_code;
};
struct cache_read_request
{
struct cache_read_request {
char *entry;
char *cache_key;
@ -62,8 +59,7 @@ struct cache_read_request
size_t cache_key_size;
};
struct cache_read_response
{
struct cache_read_response {
char *data; // ignored if error_code is not 0
size_t data_size; // ignored if error_code is not 0
@ -75,16 +71,14 @@ enum transformation_type {
TT_ALL = 1 // transform all entries
};
struct cache_transform_request
{
struct cache_transform_request {
char *entry; // ignored if entry_length is 0
size_t entry_length;
int transformation_type;
};
struct cache_transform_response
{
struct cache_transform_response {
int error_code;
};
@ -149,8 +143,7 @@ enum comm_element_t {
* The comm_element is used as the holder of any known (defined above) data
* type that is to be sent/received.
*/
struct comm_element
{
struct comm_element {
union {
struct cache_write_request c_write_request;
struct cache_write_response c_write_response;
@ -167,97 +160,90 @@ struct comm_element
struct cache_mp_read_session_request c_mp_rs_request;
struct cache_mp_read_session_response c_mp_rs_response;
struct cache_mp_read_session_read_response c_mp_rs_read_response;
};
} /* anonymous */;
enum comm_element_t type;
};
extern void init_comm_element(struct comm_element *, enum comm_element_t type);
extern void finalize_comm_element(struct comm_element *);
void init_comm_element(struct comm_element *, enum comm_element_t type);
void finalize_comm_element(struct comm_element *);
/*
* For each type of data, there is three functions (init/finalize/get), that
* used with comm_element structure
*/
extern void init_cache_write_request(struct cache_write_request *);
extern void finalize_cache_write_request(struct cache_write_request *);
extern struct cache_write_request *get_cache_write_request(
void init_cache_write_request(struct cache_write_request *);
void finalize_cache_write_request(struct cache_write_request *);
struct cache_write_request *get_cache_write_request(struct comm_element *);
void init_cache_write_response(struct cache_write_response *);
void finalize_cache_write_response(struct cache_write_response *);
struct cache_write_response *get_cache_write_response(struct comm_element *);
void init_cache_read_request(struct cache_read_request *);
void finalize_cache_read_request(struct cache_read_request *);
struct cache_read_request *get_cache_read_request(struct comm_element *);
void init_cache_read_response(struct cache_read_response *);
void finalize_cache_read_response(struct cache_read_response *);
struct cache_read_response *get_cache_read_response(struct comm_element *);
void init_cache_transform_request(struct cache_transform_request *);
void finalize_cache_transform_request(struct cache_transform_request *);
struct cache_transform_request *get_cache_transform_request(
struct comm_element *);
extern void init_cache_write_response(struct cache_write_response *);
extern void finalize_cache_write_response(struct cache_write_response *);
extern struct cache_write_response *get_cache_write_response(
void init_cache_transform_response(struct cache_transform_response *);
void finalize_cache_transform_response(struct cache_transform_response *);
struct cache_transform_response *get_cache_transform_response(
struct comm_element *);
extern void init_cache_read_request(struct cache_read_request *);
extern void finalize_cache_read_request(struct cache_read_request *);
extern struct cache_read_request *get_cache_read_request(
struct comm_element *);
extern void init_cache_read_response(struct cache_read_response *);
extern void finalize_cache_read_response(struct cache_read_response *);
extern struct cache_read_response *get_cache_read_response(
struct comm_element *);
extern void init_cache_transform_request(struct cache_transform_request *);
extern void finalize_cache_transform_request(struct cache_transform_request *);
extern struct cache_transform_request *get_cache_transform_request(
struct comm_element *);
extern void init_cache_transform_response(struct cache_transform_response *);
extern void finalize_cache_transform_response(
struct cache_transform_response *);
extern struct cache_transform_response *get_cache_transform_response(
struct comm_element *);
extern void init_cache_mp_write_session_request(
void init_cache_mp_write_session_request(
struct cache_mp_write_session_request *);
extern void finalize_cache_mp_write_session_request(
void finalize_cache_mp_write_session_request(
struct cache_mp_write_session_request *);
extern struct cache_mp_write_session_request *
get_cache_mp_write_session_request(
struct comm_element *);
struct cache_mp_write_session_request *
get_cache_mp_write_session_request(struct comm_element *);
extern void init_cache_mp_write_session_response(
void init_cache_mp_write_session_response(
struct cache_mp_write_session_response *);
extern void finalize_cache_mp_write_session_response(
void finalize_cache_mp_write_session_response(
struct cache_mp_write_session_response *);
extern struct cache_mp_write_session_response *
struct cache_mp_write_session_response *
get_cache_mp_write_session_response(struct comm_element *);
extern void init_cache_mp_write_session_write_request(
void init_cache_mp_write_session_write_request(
struct cache_mp_write_session_write_request *);
extern void finalize_cache_mp_write_session_write_request(
void finalize_cache_mp_write_session_write_request(
struct cache_mp_write_session_write_request *);
extern struct cache_mp_write_session_write_request *
struct cache_mp_write_session_write_request *
get_cache_mp_write_session_write_request(struct comm_element *);
extern void init_cache_mp_write_session_write_response(
void init_cache_mp_write_session_write_response(
struct cache_mp_write_session_write_response *);
extern void finalize_cache_mp_write_session_write_response(
void finalize_cache_mp_write_session_write_response(
struct cache_mp_write_session_write_response *);
extern struct cache_mp_write_session_write_response *
struct cache_mp_write_session_write_response *
get_cache_mp_write_session_write_response(struct comm_element *);
extern void init_cache_mp_read_session_request(
void init_cache_mp_read_session_request(
struct cache_mp_read_session_request *);
extern void finalize_cache_mp_read_session_request(
void finalize_cache_mp_read_session_request(
struct cache_mp_read_session_request *);
extern struct cache_mp_read_session_request *get_cache_mp_read_session_request(
struct cache_mp_read_session_request *get_cache_mp_read_session_request(
struct comm_element *);
extern void init_cache_mp_read_session_response(
void init_cache_mp_read_session_response(
struct cache_mp_read_session_response *);
extern void finalize_cache_mp_read_session_response(
void finalize_cache_mp_read_session_response(
struct cache_mp_read_session_response *);
extern struct cache_mp_read_session_response *
get_cache_mp_read_session_response(
struct comm_element *);
struct cache_mp_read_session_response *
get_cache_mp_read_session_response(struct comm_element *);
extern void init_cache_mp_read_session_read_response(
void init_cache_mp_read_session_read_response(
struct cache_mp_read_session_read_response *);
extern void finalize_cache_mp_read_session_read_response(
void finalize_cache_mp_read_session_read_response(
struct cache_mp_read_session_read_response *);
extern struct cache_mp_read_session_read_response *
struct cache_mp_read_session_read_response *
get_cache_mp_read_session_read_response(struct comm_element *);
#endif

View File

@ -40,8 +40,7 @@ struct configuration_entry;
typedef int (*query_process_func)(struct query_state *);
typedef void (*query_destroy_func)(struct query_state *);
typedef ssize_t (*query_read_func)(struct query_state *, void *, size_t);
typedef ssize_t (*query_write_func)(struct query_state *, const void *,
size_t);
typedef ssize_t (*query_write_func)(struct query_state *, const void *, size_t);
/*
* The query state structure contains the information to process all types of
@ -91,17 +90,15 @@ struct query_state {
int use_alternate_io;
};
extern int check_query_eids(struct query_state *);
int check_query_eids(struct query_state *);
extern ssize_t query_io_buffer_read(struct query_state *, void *, size_t);
extern ssize_t query_io_buffer_write(struct query_state *, const void *,
size_t);
ssize_t query_io_buffer_read(struct query_state *, void *, size_t);
ssize_t query_io_buffer_write(struct query_state *, const void *, size_t);
extern ssize_t query_socket_read(struct query_state *, void *, size_t);
extern ssize_t query_socket_write(struct query_state *, const void *,
size_t);
ssize_t query_socket_read(struct query_state *, void *, size_t);
ssize_t query_socket_write(struct query_state *, const void *, size_t);
extern struct query_state *init_query_state(int, size_t, uid_t, gid_t);
extern void destroy_query_state(struct query_state *);
struct query_state *init_query_state(int, size_t, uid_t, gid_t);
void destroy_query_state(struct query_state *);
#endif