From 2650207d4adbfd68974fc2b342dd2af079a2552c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Aug 2008 14:17:43 +0200 Subject: Remove cli->event_ctx, pass it explicitly Storing the event_context as permanent state in struct cli_state creates more complex code than necessary IMO. (This used to be commit debb37f703075008e5ea7d34d214cfa4d0f8f916) --- source3/include/async_smb.h | 18 +++--------------- source3/include/client.h | 10 +++++++++- source3/include/proto.h | 8 ++++++-- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'source3/include') diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h index 5ec6b12050..40a8d3476e 100644 --- a/source3/include/async_smb.h +++ b/source3/include/async_smb.h @@ -23,7 +23,9 @@ * Ship a new smb request to the server */ -struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_request_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, uint8_t smb_command, uint8_t additional_flags, uint8_t wct, const uint16_t *vwv, @@ -46,17 +48,3 @@ NTSTATUS cli_pull_error(char *buf); */ void cli_set_error(struct cli_state *cli, NTSTATUS status); - -/* - * Create a temporary event context for use in the sync helper functions - */ - -struct cli_tmp_event *cli_tmp_event_ctx(TALLOC_CTX *mem_ctx, - struct cli_state *cli); - -/* - * Attach an event context permanently to a cli_struct - */ - -NTSTATUS cli_add_event_ctx(struct cli_state *cli, - struct event_context *event_ctx); diff --git a/source3/include/client.h b/source3/include/client.h index 51ced9907f..be12288f28 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -204,7 +204,15 @@ struct cli_state { bool force_dos_errors; bool case_sensitive; /* False by default. */ - struct event_context *event_ctx; + /** + * fd_event is around while we have async requests outstanding or are + * building a chained request. + * + * (fd_event!=NULL) && (outstanding_request!=NULL) + * + * should always be true, as well as the reverse: If both cli_request + * pointers are NULL, no fd_event is around. + */ struct fd_event *fd_event; char *evt_inbuf; diff --git a/source3/include/proto.h b/source3/include/proto.h index ac91b144de..f21cc2b17f 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4378,7 +4378,8 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 CreateDisposition, uint32 CreateOptions, uint8 SecuityFlags); int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess); -struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev, + struct cli_state *cli, const char *fname, int flags, int share_mode); NTSTATUS cli_open_recv(struct async_req *req, int *fnum); int cli_open(struct cli_state *cli, const char *fname, int flags, int share_mode); @@ -4618,11 +4619,14 @@ int cli_NetConnectionEnum(struct cli_state *cli, const char *qualifier, /* The following definitions come from libsmb/clireadwrite.c */ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, struct cli_state *cli, int fnum, off_t offset, size_t size); NTSTATUS cli_read_andx_recv(struct async_req *req, ssize_t *received, uint8_t **rcvbuf); -struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, struct cli_state *cli, +struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, + struct event_context *ev, + struct cli_state *cli, uint16_t fnum, off_t start_offset, SMB_OFF_T size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, -- cgit