summaryrefslogtreecommitdiff
path: root/source4/libcli/raw
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-16 16:28:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:07:25 -0500
commitbb58d8497abe7178677c58e9dae307c44babbcef (patch)
tree8bbf421a4229a24a6fef6e00edb599cf1938a058 /source4/libcli/raw
parent94bf599886a487851bb0f3e7c8f4f5e619f33ec0 (diff)
downloadsamba-bb58d8497abe7178677c58e9dae307c44babbcef.tar.gz
samba-bb58d8497abe7178677c58e9dae307c44babbcef.tar.bz2
samba-bb58d8497abe7178677c58e9dae307c44babbcef.zip
r15638: add a usefull macro to get a pointer the smb_handle union
of smb_open, as it's not nicely alligned for all levels, If someone has an idea for a better solution where we can access it via op->generic.out.file.* please let me know:-) metze (This used to be commit d0a7408280c35dc4a5a21cbbded895c6c83819e6)
Diffstat (limited to 'source4/libcli/raw')
-rw-r--r--source4/libcli/raw/interfaces.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h
index f715c10e11..d9387cc6e2 100644
--- a/source4/libcli/raw/interfaces.h
+++ b/source4/libcli/raw/interfaces.h
@@ -1173,6 +1173,48 @@ enum smb_open_level {
/* union for open() backend call */
union smb_open {
+/*
+ * because the *.out.file structs are not aligned to the same offset for each level
+ * we provide a hepler macro that should be used to find the current smb_handle structure
+ */
+#define SMB_OPEN_OUT_FILE(op, file) do { \
+ switch (op->generic.level) { \
+ case RAW_OPEN_OPEN: \
+ file = &op->openold.out.file; \
+ break; \
+ case RAW_OPEN_OPENX: \
+ file = &op->openx.out.file; \
+ break; \
+ case RAW_OPEN_MKNEW: \
+ file = &op->mknew.out.file; \
+ break; \
+ case RAW_OPEN_CREATE: \
+ file = &op->create.out.file; \
+ break; \
+ case RAW_OPEN_CTEMP: \
+ file = &op->ctemp.out.file; \
+ break; \
+ case RAW_OPEN_SPLOPEN: \
+ file = &op->splopen.out.file; \
+ break; \
+ case RAW_OPEN_NTCREATEX: \
+ file = &op->ntcreatex.out.file; \
+ break; \
+ case RAW_OPEN_T2OPEN: \
+ file = &op->t2open.out.file; \
+ break; \
+ case RAW_OPEN_NTTRANS_CREATE: \
+ file = &op->nttrans.out.file; \
+ break; \
+ case RAW_OPEN_OPENX_READX: \
+ file = &op->openxreadx.out.file; \
+ break; \
+ default: \
+ /* this must be a programmer error */ \
+ file = NULL; \
+ break; \
+ } \
+} while (0)
/* SMBNTCreateX interface */
struct {
enum smb_open_level level;
@@ -1212,7 +1254,7 @@ union smb_open {
uint16_t ipc_state;
uint8_t is_directory;
} out;
- } ntcreatex, generic;
+ } ntcreatex, nttrans, generic;
/* TRANS2_OPEN interface */
struct {