diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-05-14 20:31:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:22:04 -0500 |
commit | fad7dd8a60e6637598b17fa89ec92d98db51fffe (patch) | |
tree | 23e6622f52c1b25502b6a622d81782dbdd89c0e4 /source3/smbd | |
parent | 1f073a0319b040b25a16046b9e1b37520109ecb8 (diff) | |
download | samba-fad7dd8a60e6637598b17fa89ec92d98db51fffe.tar.gz samba-fad7dd8a60e6637598b17fa89ec92d98db51fffe.tar.bz2 samba-fad7dd8a60e6637598b17fa89ec92d98db51fffe.zip |
r22868: Replace some message_send_pid calls with messaging_send_pid calls. More
tomorrow.
(This used to be commit 74fa57ca5d7fa8eace72bbe948a08a0bca3cc4ca)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/blocking.c | 6 | ||||
-rw-r--r-- | source3/smbd/close.c | 6 | ||||
-rw-r--r-- | source3/smbd/open.c | 6 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 142 | ||||
-rw-r--r-- | source3/smbd/process.c | 6 | ||||
-rw-r--r-- | source3/smbd/server.c | 8 | ||||
-rw-r--r-- | source3/smbd/sesssetup.c | 4 |
7 files changed, 98 insertions, 80 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index ab2b0949bd..ae7b861f2b 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -893,9 +893,9 @@ BOOL blocking_lock_cancel(files_struct *fsp, memcpy(msg, &blr, sizeof(blr)); memcpy(&msg[sizeof(blr)], &err, sizeof(NTSTATUS)); - message_send_pid(pid_to_procid(sys_getpid()), - MSG_SMB_BLOCKING_LOCK_CANCEL, - &msg, sizeof(msg), True); + messaging_send_buf(smbd_messaging_context(), procid_self(), + MSG_SMB_BLOCKING_LOCK_CANCEL, + (uint8 *)&msg, sizeof(msg)); return True; } diff --git a/source3/smbd/close.c b/source3/smbd/close.c index ca4e501a14..38b4988415 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -135,8 +135,10 @@ static void notify_deferred_opens(struct share_mode_lock *lck) share_mode_entry_to_message(msg, e); - message_send_pid(e->pid, MSG_SMB_OPEN_RETRY, - msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + messaging_send_buf(smbd_messaging_context(), + e->pid, MSG_SMB_OPEN_RETRY, + (uint8 *)msg, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); } } } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e891209d2b..35dc13d86c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -737,8 +737,10 @@ static BOOL delay_for_oplocks(struct share_mode_lock *lck, SSVAL(msg,6,exclusive->op_type | FORCE_OPLOCK_BREAK_TO_NONE); } - status = message_send_pid(exclusive->pid, MSG_SMB_BREAK_REQUEST, - msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + status = messaging_send_buf(smbd_messaging_context(), exclusive->pid, + MSG_SMB_BREAK_REQUEST, + (uint8 *)msg, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Could not send oplock break message: %s\n", nt_errstr(status))); diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 8a84331810..63f88b7824 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -62,7 +62,7 @@ BOOL oplock_message_waiting(fd_set *fds) we're calling this in a shutting down state. ****************************************************************************/ -void process_kernel_oplocks(fd_set *pfds) +void process_kernel_oplocks(struct messaging_context *msg_ctx, fd_set *pfds) { /* * We need to check for kernel oplocks before going into the select @@ -94,9 +94,9 @@ void process_kernel_oplocks(fd_set *pfds) /* Don't need to be root here as we're only ever sending to ourselves. */ - message_send_pid(pid_to_procid(sys_getpid()), - MSG_SMB_KERNEL_BREAK, - &msg, MSG_SMB_KERNEL_BREAK_SIZE, True); + messaging_send_buf(msg_ctx, procid_self(), + MSG_SMB_KERNEL_BREAK, + (uint8 *)&msg, MSG_SMB_KERNEL_BREAK_SIZE); } } @@ -391,27 +391,29 @@ static void add_oplock_timeout_handler(files_struct *fsp) the client for LEVEL2. *******************************************************************/ -static void process_oplock_async_level2_break_message(int msg_type, struct server_id src, - void *buf, size_t len, - void *private_data) +static void process_oplock_async_level2_break_message(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) { struct share_mode_entry msg; files_struct *fsp; char *break_msg; BOOL sign_state; - if (buf == NULL) { + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; } - if (len != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { - DEBUG(0, ("Got invalid msg len %d\n", (int)len)); + if (data->length != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { + DEBUG(0, ("Got invalid msg len %d\n", (int)data->length)); return; } /* De-linearize incoming message. */ - message_to_share_mode_entry(&msg, (char *)buf); + message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock async level 2 break message from pid %d: 0x%x/%.0f/%lu\n", (int)procid_to_pid(&src), (unsigned int)msg.dev, @@ -478,9 +480,11 @@ static void process_oplock_async_level2_break_message(int msg_type, struct serve This handles the generic oplock break message from another smbd. *******************************************************************/ -static void process_oplock_break_message(int msg_type, struct server_id src, - void *buf, size_t len, - void *private_data) +static void process_oplock_break_message(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) { struct share_mode_entry msg; files_struct *fsp; @@ -488,18 +492,18 @@ static void process_oplock_break_message(int msg_type, struct server_id src, BOOL break_to_level2 = False; BOOL sign_state; - if (buf == NULL) { + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; } - if (len != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { - DEBUG(0, ("Got invalid msg len %d\n", (int)len)); + if (data->length != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { + DEBUG(0, ("Got invalid msg len %d\n", (int)data->length)); return; } /* De-linearize incoming message. */ - message_to_share_mode_entry(&msg, (char *)buf); + message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock break message from pid %d: 0x%x/%.0f/%lu\n", (int)procid_to_pid(&src), (unsigned int)msg.dev, @@ -515,8 +519,9 @@ static void process_oplock_break_message(int msg_type, struct server_id src, DEBUG(3, ("Did not find fsp\n")); /* We just send the same message back. */ - message_send_pid(src, MSG_SMB_BREAK_RESPONSE, - buf, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + messaging_send_buf(msg_ctx, src, MSG_SMB_BREAK_RESPONSE, + (uint8 *)data->data, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); return; } @@ -536,8 +541,9 @@ static void process_oplock_break_message(int msg_type, struct server_id src, (unsigned int)fsp->dev, (double)fsp->inode, fsp->fsp_name)); /* We just send the same message back. */ - message_send_pid(src, MSG_SMB_BREAK_RESPONSE, - buf, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + messaging_send_buf(msg_ctx, src, MSG_SMB_BREAK_RESPONSE, + (uint8 *)data->data, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); return; } @@ -587,9 +593,11 @@ static void process_oplock_break_message(int msg_type, struct server_id src, This handles the kernel oplock break message. *******************************************************************/ -static void process_kernel_oplock_break(int msg_type, struct server_id src, - void *buf, size_t len, - void *private_data) +static void process_kernel_oplock_break(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) { SMB_DEV_T dev; SMB_INO_T inode; @@ -598,20 +606,20 @@ static void process_kernel_oplock_break(int msg_type, struct server_id src, char *break_msg; BOOL sign_state; - if (buf == NULL) { + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; } - if (len != MSG_SMB_KERNEL_BREAK_SIZE) { - DEBUG(0, ("Got invalid msg len %d\n", (int)len)); + if (data->length != MSG_SMB_KERNEL_BREAK_SIZE) { + DEBUG(0, ("Got invalid msg len %d\n", (int)data->length)); return; } /* Pull the data from the message. */ - dev = DEV_T_VAL(buf, 0); - inode = INO_T_VAL(buf, 8); - file_id = (unsigned long)IVAL(buf, 16); + dev = DEV_T_VAL(data->data, 0); + inode = INO_T_VAL(data->data, 8); + file_id = (unsigned long)IVAL(data->data, 16); DEBUG(10, ("Got kernel oplock break message from pid %d: 0x%x/%.0f/%u\n", (int)procid_to_pid(&src), (unsigned int)dev, (double)inode, @@ -665,8 +673,10 @@ void reply_to_oplock_break_requests(files_struct *fsp) share_mode_entry_to_message(msg, e); - message_send_pid(e->pid, MSG_SMB_BREAK_RESPONSE, - msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + messaging_send_buf(smbd_messaging_context(), e->pid, + MSG_SMB_BREAK_RESPONSE, + (uint8 *)msg, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); } SAFE_FREE(fsp->pending_break_messages); @@ -679,24 +689,27 @@ void reply_to_oplock_break_requests(files_struct *fsp) return; } -static void process_oplock_break_response(int msg_type, struct server_id src, - void *buf, size_t len, - void *private_data) +static void process_oplock_break_response(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) { struct share_mode_entry msg; - if (buf == NULL) { + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; } - if (len != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { - DEBUG(0, ("Got invalid msg len %u\n", (unsigned int)len)); + if (data->length != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { + DEBUG(0, ("Got invalid msg len %u\n", + (unsigned int)data->length)); return; } /* De-linearize incoming message. */ - message_to_share_mode_entry(&msg, (char *)buf); + message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got oplock break response from pid %d: 0x%x/%.0f/%lu mid %u\n", (int)procid_to_pid(&src), (unsigned int)msg.dev, @@ -707,24 +720,26 @@ static void process_oplock_break_response(int msg_type, struct server_id src, schedule_deferred_open_smb_message(msg.op_mid); } -static void process_open_retry_message(int msg_type, struct server_id src, - void *buf, size_t len, - void *private_data) +static void process_open_retry_message(struct messaging_context *msg_ctx, + void *private_data, + uint32_t msg_type, + struct server_id src, + DATA_BLOB *data) { struct share_mode_entry msg; - if (buf == NULL) { + if (data->data == NULL) { DEBUG(0, ("Got NULL buffer\n")); return; } - if (len != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { - DEBUG(0, ("Got invalid msg len %d\n", (int)len)); + if (data->length != MSG_SMB_SHARE_MODE_ENTRY_SIZE) { + DEBUG(0, ("Got invalid msg len %d\n", (int)data->length)); return; } /* De-linearize incoming message. */ - message_to_share_mode_entry(&msg, (char *)buf); + message_to_share_mode_entry(&msg, (char *)data->data); DEBUG(10, ("Got open retry msg from pid %d: 0x%x/%.0f/%lu mid %u\n", (int)procid_to_pid(&src), (unsigned int)msg.dev, @@ -804,8 +819,10 @@ void release_level_2_oplocks_on_change(files_struct *fsp) share_mode_entry_to_message(msg, share_entry); - message_send_pid(share_entry->pid, MSG_SMB_ASYNC_LEVEL2_BREAK, - msg, MSG_SMB_SHARE_MODE_ENTRY_SIZE, True); + messaging_send_buf(smbd_messaging_context(), share_entry->pid, + MSG_SMB_ASYNC_LEVEL2_BREAK, + (uint8 *)msg, + MSG_SMB_SHARE_MODE_ENTRY_SIZE); } /* We let the message receivers handle removing the oplock state @@ -860,25 +877,20 @@ void message_to_share_mode_entry(struct share_mode_entry *e, char *msg) Setup oplocks for this process. ****************************************************************************/ -BOOL init_oplocks(void) +BOOL init_oplocks(struct messaging_context *msg_ctx) { DEBUG(3,("init_oplocks: initializing messages.\n")); - message_register(MSG_SMB_BREAK_REQUEST, - process_oplock_break_message, - NULL); - message_register(MSG_SMB_ASYNC_LEVEL2_BREAK, - process_oplock_async_level2_break_message, - NULL); - message_register(MSG_SMB_BREAK_RESPONSE, - process_oplock_break_response, - NULL); - message_register(MSG_SMB_KERNEL_BREAK, - process_kernel_oplock_break, - NULL); - message_register(MSG_SMB_OPEN_RETRY, - process_open_retry_message, - NULL); + messaging_register(msg_ctx, NULL, MSG_SMB_BREAK_REQUEST, + process_oplock_break_message); + messaging_register(msg_ctx, NULL, MSG_SMB_ASYNC_LEVEL2_BREAK, + process_oplock_async_level2_break_message); + messaging_register(msg_ctx, NULL, MSG_SMB_BREAK_RESPONSE, + process_oplock_break_response); + messaging_register(msg_ctx, NULL, MSG_SMB_KERNEL_BREAK, + process_kernel_oplock_break); + messaging_register(msg_ctx, NULL, MSG_SMB_OPEN_RETRY, + process_open_retry_message); if (lp_kernel_oplocks()) { #if HAVE_KERNEL_OPLOCKS_IRIX diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 4ae6dcd5ba..02dc507e11 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -301,7 +301,7 @@ static void async_processing(fd_set *pfds) process_aio_queue(); - process_kernel_oplocks(pfds); + process_kernel_oplocks(smbd_messaging_context(), pfds); /* Do the aio check again after receive_local_message as it does a select and may have eaten our signal. */ @@ -574,7 +574,7 @@ void respond_to_all_remaining_local_messages(void) return; } - process_kernel_oplocks(NULL); + process_kernel_oplocks(smbd_messaging_context(), NULL); return; } @@ -1415,7 +1415,7 @@ machine %s in domain %s.\n", global_myname(), lp_workgroup())); /* Send any queued printer notify message to interested smbd's. */ - print_notify_send_messages(0); + print_notify_send_messages(smbd_messaging_context(), 0); /* * Modify the select timeout depending upon diff --git a/source3/smbd/server.c b/source3/smbd/server.c index b869a1a48e..9cdc083bf6 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -646,7 +646,8 @@ static void exit_server_common(enum server_exit_reason how, invalidate_all_vuids(); - print_notify_send_messages(3); /* 3 second timeout. */ + /* 3 second timeout. */ + print_notify_send_messages(smbd_messaging_context(), 3); /* delete our entry in the connections database. */ yield_connection(NULL,""); @@ -755,7 +756,8 @@ static BOOL deadtime_fn(const struct timeval *now, void *private_data) if ((conn_num_open() == 0) || (conn_idle_all(now->tv_sec))) { DEBUG( 2, ( "Closing idle connection\n" ) ); - message_send_pid(procid_self(), MSG_SHUTDOWN, NULL, 0, False); + messaging_send(smbd_messaging_context(), procid_self(), + MSG_SHUTDOWN, &data_blob_null); return False; } @@ -1062,7 +1064,7 @@ extern void build_options(BOOL screen); } /* Setup oplocks */ - if (!init_oplocks()) + if (!init_oplocks(smbd_messaging_context())) exit(1); /* Setup aio signal handler. */ diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index dcff27f70c..ccfc22598d 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -1192,8 +1192,8 @@ static int shutdown_other_smbds(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, return 0; } - message_send_pid(sessionid->pid, MSG_SHUTDOWN, - NULL, 0, True); + messaging_send(smbd_messaging_context(), sessionid->pid, MSG_SHUTDOWN, + &data_blob_null); return 0; } |