diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-05-07 09:35:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:21:52 -0500 |
commit | e6383f47629368d9dd4e803f17566a24e9d7359e (patch) | |
tree | cebde89910087c3220786f209da2c4e32a71bc46 /source3/lib | |
parent | d1153fc79076741571b203b1d70f1536bde208f0 (diff) | |
download | samba-e6383f47629368d9dd4e803f17566a24e9d7359e.tar.gz samba-e6383f47629368d9dd4e803f17566a24e9d7359e.tar.bz2 samba-e6383f47629368d9dd4e803f17566a24e9d7359e.zip |
r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch.
This changes "struct process_id" to "struct server_id", keeping both is
just too much hassle. No functional change (I hope ;-))
Volker
(This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/debug.c | 4 | ||||
-rw-r--r-- | source3/lib/dmallocmsg.c | 4 | ||||
-rw-r--r-- | source3/lib/messages.c | 34 | ||||
-rw-r--r-- | source3/lib/tallocmsg.c | 2 | ||||
-rw-r--r-- | source3/lib/util.c | 30 |
5 files changed, 35 insertions, 39 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 62fda5741c..d231f55585 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -471,7 +471,7 @@ BOOL debug_parse_levels(const char *params_str) Receive a "set debug level" message. ****************************************************************************/ -static void debug_message(int msg_type, struct process_id src, +static void debug_message(int msg_type, struct server_id src, void *buf, size_t len, void *private_data) { const char *params_str = (const char *)buf; @@ -508,7 +508,7 @@ void debug_message_send(pid_t pid, const char *params_str) Return current debug level. ****************************************************************************/ -static void debuglevel_message(int msg_type, struct process_id src, +static void debuglevel_message(int msg_type, struct server_id src, void *buf, size_t len, void *private_data) { char *message = debug_list_class_names_and_levels(); diff --git a/source3/lib/dmallocmsg.c b/source3/lib/dmallocmsg.c index fed7bf59c5..bccede3515 100644 --- a/source3/lib/dmallocmsg.c +++ b/source3/lib/dmallocmsg.c @@ -36,7 +36,7 @@ static unsigned long our_dm_mark = 0; * usage stats. **/ static void msg_req_dmalloc_mark(int UNUSED(msg_type), - struct process_id UNUSED(src_pid), + struct server_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len), void *private_data) { @@ -51,7 +51,7 @@ static void msg_req_dmalloc_mark(int UNUSED(msg_type), static void msg_req_dmalloc_log_changed(int UNUSED(msg_type), - struct process_id UNUSED(src_pid), + struct server_id UNUSED(src_pid), void *UNUSED(buf), size_t UNUSED(len), void *private_data) { diff --git a/source3/lib/messages.c b/source3/lib/messages.c index 94caca69b7..6ecb89571b 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -57,8 +57,8 @@ static int received_signal; struct message_rec { int msg_version; int msg_type; - struct process_id dest; - struct process_id src; + struct server_id dest; + struct server_id src; size_t len; }; @@ -66,7 +66,7 @@ struct message_rec { static struct dispatch_fns { struct dispatch_fns *next, *prev; int msg_type; - void (*fn)(int msg_type, struct process_id pid, void *buf, size_t len, + void (*fn)(int msg_type, struct server_id pid, void *buf, size_t len, void *private_data); void *private_data; } *dispatch_fns; @@ -103,7 +103,7 @@ static void sig_usr1(void) A useful function for testing the message system. ****************************************************************************/ -static void ping_message(int msg_type, struct process_id src, +static void ping_message(int msg_type, struct server_id src, void *buf, size_t len, void *private_data) { const char *msg = buf ? (const char *)buf : "none"; @@ -152,7 +152,7 @@ BOOL message_init(void) Form a static tdb key from a pid. ******************************************************************/ -static TDB_DATA message_key_pid(struct process_id pid) +static TDB_DATA message_key_pid(struct server_id pid) { static char key[20]; TDB_DATA kbuf; @@ -169,7 +169,7 @@ static TDB_DATA message_key_pid(struct process_id pid) then delete its record in the database. ****************************************************************************/ -static NTSTATUS message_notify(struct process_id procid) +static NTSTATUS message_notify(struct server_id procid) { pid_t pid = procid.pid; int ret; @@ -229,7 +229,7 @@ static NTSTATUS message_notify(struct process_id procid) Send a message to a particular pid. ****************************************************************************/ -static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type, +static NTSTATUS message_send_pid_internal(struct server_id pid, int msg_type, const void *buf, size_t len, BOOL duplicates_allowed, unsigned int timeout) @@ -365,7 +365,7 @@ static NTSTATUS message_send_pid_internal(struct process_id pid, int msg_type, Send a message to a particular pid - no timeout. ****************************************************************************/ -NTSTATUS message_send_pid(struct process_id pid, int msg_type, const void *buf, +NTSTATUS message_send_pid(struct server_id pid, int msg_type, const void *buf, size_t len, BOOL duplicates_allowed) { return message_send_pid_internal(pid, msg_type, buf, len, @@ -376,7 +376,7 @@ NTSTATUS message_send_pid(struct process_id pid, int msg_type, const void *buf, Send a message to a particular pid, with timeout in seconds. ****************************************************************************/ -NTSTATUS message_send_pid_with_timeout(struct process_id pid, int msg_type, +NTSTATUS message_send_pid_with_timeout(struct server_id pid, int msg_type, const void *buf, size_t len, BOOL duplicates_allowed, unsigned int timeout) { @@ -388,7 +388,7 @@ NTSTATUS message_send_pid_with_timeout(struct process_id pid, int msg_type, Count the messages pending for a particular pid. Expensive.... ****************************************************************************/ -unsigned int messages_pending_for_pid(struct process_id pid) +unsigned int messages_pending_for_pid(struct server_id pid) { TDB_DATA kbuf; TDB_DATA dbuf; @@ -459,7 +459,7 @@ static BOOL retrieve_all_messages(char **msgs_buf, size_t *total_len) ****************************************************************************/ static BOOL message_recv(char *msgs_buf, size_t total_len, int *msg_type, - struct process_id *src, char **buf, size_t *len) + struct server_id *src, char **buf, size_t *len) { struct message_rec rec; char *ret_buf = *buf; @@ -501,7 +501,7 @@ static BOOL message_recv(char *msgs_buf, size_t total_len, int *msg_type, void message_dispatch(void) { int msg_type; - struct process_id src; + struct server_id src; char *buf; char *msgs_buf; size_t len, total_len; @@ -552,7 +552,7 @@ void message_dispatch(void) ****************************************************************************/ void message_register(int msg_type, - void (*fn)(int msg_type, struct process_id pid, + void (*fn)(int msg_type, struct server_id pid, void *buf, size_t len, void *private_data), void *private_data) @@ -760,7 +760,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx, return ctx; } -static void messaging_callback(int msg_type, struct process_id pid, +static void messaging_callback(int msg_type, struct server_id pid, void *buf, size_t len, void *private_data) { struct messaging_context *ctx = talloc_get_type_abort( @@ -775,13 +775,11 @@ static void messaging_callback(int msg_type, struct process_id pid, if (msg_type == cb->msg_type) { DATA_BLOB blob; - struct server_id id; blob.data = (uint8 *)buf; blob.length = len; - id.id = pid; - cb->fn(ctx, cb->private_data, msg_type, id, &blob); + cb->fn(ctx, cb->private_data, msg_type, pid, &blob); } } } @@ -838,7 +836,7 @@ NTSTATUS messaging_send(struct messaging_context *msg, struct server_id server, uint32_t msg_type, DATA_BLOB *data) { - return message_send_pid_internal(server.id, msg_type, data->data, + return message_send_pid_internal(server, msg_type, data->data, data->length, True, 0); } diff --git a/source3/lib/tallocmsg.c b/source3/lib/tallocmsg.c index 0f493538f3..098f8a03d9 100644 --- a/source3/lib/tallocmsg.c +++ b/source3/lib/tallocmsg.c @@ -65,7 +65,7 @@ static void msg_pool_usage_helper(const void *ptr, int depth, int max_depth, int * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/ -void msg_pool_usage(int msg_type, struct process_id src_pid, +void msg_pool_usage(int msg_type, struct server_id src_pid, void *UNUSED(buf), size_t UNUSED(len), void *private_data) { diff --git a/source3/lib/util.c b/source3/lib/util.c index 9a22e89fe2..4425c2e1cc 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1527,7 +1527,7 @@ BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask) Check if a process exists. Does this work on all unixes? ****************************************************************************/ -BOOL process_exists(const struct process_id pid) +BOOL process_exists(const struct server_id pid) { if (procid_is_me(&pid)) { return True; @@ -3061,31 +3061,29 @@ uint32 map_share_mode_to_deny_mode(uint32 share_access, uint32 private_options) return (uint32)-1; } -pid_t procid_to_pid(const struct process_id *proc) +pid_t procid_to_pid(const struct server_id *proc) { return proc->pid; } -struct process_id pid_to_procid(pid_t pid) +struct server_id pid_to_procid(pid_t pid) { - struct process_id result; + struct server_id result; result.pid = pid; return result; } -struct process_id procid_self(void) +struct server_id procid_self(void) { return pid_to_procid(sys_getpid()); } struct server_id server_id_self(void) { - struct server_id id; - id.id = procid_self(); - return id; + return procid_self(); } -BOOL procid_equal(const struct process_id *p1, const struct process_id *p2) +BOOL procid_equal(const struct server_id *p1, const struct server_id *p2) { return (p1->pid == p2->pid); } @@ -3093,37 +3091,37 @@ BOOL procid_equal(const struct process_id *p1, const struct process_id *p2) BOOL cluster_id_equal(const struct server_id *id1, const struct server_id *id2) { - return procid_equal(&id1->id, &id2->id); + return procid_equal(id1, id2); } -BOOL procid_is_me(const struct process_id *pid) +BOOL procid_is_me(const struct server_id *pid) { return (pid->pid == sys_getpid()); } -struct process_id interpret_pid(const char *pid_string) +struct server_id interpret_pid(const char *pid_string) { return pid_to_procid(atoi(pid_string)); } -char *procid_str_static(const struct process_id *pid) +char *procid_str_static(const struct server_id *pid) { static fstring str; fstr_sprintf(str, "%d", pid->pid); return str; } -char *procid_str(TALLOC_CTX *mem_ctx, const struct process_id *pid) +char *procid_str(TALLOC_CTX *mem_ctx, const struct server_id *pid) { return talloc_strdup(mem_ctx, procid_str_static(pid)); } -BOOL procid_valid(const struct process_id *pid) +BOOL procid_valid(const struct server_id *pid) { return (pid->pid != -1); } -BOOL procid_is_local(const struct process_id *pid) +BOOL procid_is_local(const struct server_id *pid) { return True; } |