From 9225c02aee19478fc4825c4b798a6757d140b5c0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 18 Mar 2006 09:07:47 +0000 Subject: r14539: get rid of a pointless union layer in struct smb_notify (This used to be commit 1e1c5593817e84c59c1a10b5a3c1957e363e5198) --- source4/libcli/raw/interfaces.h | 28 +++++++++++++--------------- source4/libcli/raw/rawnotify.c | 28 ++++++++++++++-------------- 2 files changed, 27 insertions(+), 29 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index d662b9f5ae..88daf304cf 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -1746,23 +1746,21 @@ struct smb_nttrans { /* struct for nttrans change notify call */ -union smb_notify { +struct smb_notify { struct { - struct { - union smb_handle file; - uint32_t buffer_size; - uint32_t completion_filter; - BOOL recursive; - } in; + union smb_handle file; + uint32_t buffer_size; + uint32_t completion_filter; + BOOL recursive; + } in; - struct { - uint32_t num_changes; - struct notify_changes { - uint32_t action; - struct smb_wire_string name; - } *changes; - } out; - } notify; + struct { + uint32_t num_changes; + struct notify_changes { + uint32_t action; + struct smb_wire_string name; + } *changes; + } out; }; enum smb_search_level {RAW_SEARCH_GENERIC = 0xF000, diff --git a/source4/libcli/raw/rawnotify.c b/source4/libcli/raw/rawnotify.c index c06f0a59f7..8ae5098c01 100644 --- a/source4/libcli/raw/rawnotify.c +++ b/source4/libcli/raw/rawnotify.c @@ -25,19 +25,19 @@ /**************************************************************************** change notify (async send) ****************************************************************************/ -struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union smb_notify *parms) +struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, struct smb_notify *parms) { struct smb_nttrans nt; uint16_t setup[4]; nt.in.max_setup = 0; - nt.in.max_param = parms->notify.in.buffer_size; + nt.in.max_param = parms->in.buffer_size; nt.in.max_data = 0; nt.in.setup_count = 4; nt.in.setup = setup; - SIVAL(setup, 0, parms->notify.in.completion_filter); - SSVAL(setup, 4, parms->notify.in.file.fnum); - SSVAL(setup, 6, parms->notify.in.recursive); + SIVAL(setup, 0, parms->in.completion_filter); + SSVAL(setup, 4, parms->in.file.fnum); + SSVAL(setup, 6, parms->in.recursive); nt.in.function = NT_TRANSACT_NOTIFY_CHANGE; nt.in.params = data_blob(NULL, 0); nt.in.data = data_blob(NULL, 0); @@ -49,7 +49,7 @@ struct smbcli_request *smb_raw_changenotify_send(struct smbcli_tree *tree, union change notify (async recv) ****************************************************************************/ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, - TALLOC_CTX *mem_ctx, union smb_notify *parms) + TALLOC_CTX *mem_ctx, struct smb_notify *parms) { struct smb_nttrans nt; NTSTATUS status; @@ -61,28 +61,28 @@ NTSTATUS smb_raw_changenotify_recv(struct smbcli_request *req, return status; } - parms->notify.out.changes = NULL; - parms->notify.out.num_changes = 0; + parms->out.changes = NULL; + parms->out.num_changes = 0; /* count them */ for (ofs=0; nt.out.params.length - ofs > 12; ) { uint32_t next = IVAL(nt.out.params.data, ofs); - parms->notify.out.num_changes++; + parms->out.num_changes++; if (next == 0 || ofs + next >= nt.out.params.length) break; ofs += next; } /* allocate array */ - parms->notify.out.changes = talloc_array(mem_ctx, struct notify_changes, parms->notify.out.num_changes); - if (!parms->notify.out.changes) { + parms->out.changes = talloc_array(mem_ctx, struct notify_changes, parms->out.num_changes); + if (!parms->out.changes) { return NT_STATUS_NO_MEMORY; } - for (i=ofs=0; inotify.out.num_changes; i++) { - parms->notify.out.changes[i].action = IVAL(nt.out.params.data, ofs+4); + for (i=ofs=0; iout.num_changes; i++) { + parms->out.changes[i].action = IVAL(nt.out.params.data, ofs+4); smbcli_blob_pull_string(session, mem_ctx, &nt.out.params, - &parms->notify.out.changes[i].name, + &parms->out.changes[i].name, ofs+8, ofs+12, STR_UNICODE); ofs += IVAL(nt.out.params.data, ofs); } -- cgit