summaryrefslogtreecommitdiff
path: root/source4/include
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-20 08:28:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:01:57 -0500
commit20d17b80571f0d0265c99c1ccdc21910c2eed043 (patch)
treef166a82fca637eaa303b21954e6bcb8b06efe70a /source4/include
parent8050be6ea343221da9e8866d71b66103ba7fb122 (diff)
downloadsamba-20d17b80571f0d0265c99c1ccdc21910c2eed043.tar.gz
samba-20d17b80571f0d0265c99c1ccdc21910c2eed043.tar.bz2
samba-20d17b80571f0d0265c99c1ccdc21910c2eed043.zip
r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am working on. highlights include: - changed the way a backend determines if it is allowed to process a request asynchronously. The previous method of looking at the send_fn caused problems when an intermediate ntvfs module disabled it, and the caller then wanted to finished processing using this function. The new method is a REQ_CONTROL_MAY_ASYNC flag in req->control_flags, which is also a bit easier to read - fixed 2 bugs in the readbraw server code. One related to trying to answer a readbraw with smb signing (which can't work, and crashed our signing code), the second related to error handling, which attempted to send a normal SMB error packet, when readbraw must send a 0 read reply (as it has no header) - added several more ntvfs_generic.c generic mapping functions. This means that backends no longer need to implement such esoteric functions as SMBwriteunlock() if they don't want to. The backend can just request the mapping layer turn it into a write followed by an unlock. This makes the backends considerably simpler as they only need to implement one style of each function for lock, read, write, open etc, rather than the full host of functions that SMB provides. A backend can still choose to implement them individually, of course, and the CIFS backend does that. - simplified the generic structures to make them identical to the principal call for several common SMB calls (such as RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX). - started rewriting the pvfs_open() code in preparation for the full ntcreatex semantics. - in pvfs_open and ipc_open, initially allocate the open file structure as a child of the request, so on error we don't need to clean up. Then when we are going to succeed the open steal the pointer into the long term backend context. This makes for much simpler error handling (and fixes some bugs) - use a destructor in the ipc backend to make sure that everthing is cleaned up on receive error conditions. - switched the ipc backend to using idtree for fnum allocation - in the ntvfs_generic mapping routines, use a allocated secondary structure not a stack structure to ensure the request pointer remains valid even if the backend replies async. (This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
Diffstat (limited to 'source4/include')
-rw-r--r--source4/include/smb.h1
-rw-r--r--source4/include/smb_interfaces.h138
2 files changed, 44 insertions, 95 deletions
diff --git a/source4/include/smb.h b/source4/include/smb.h
index a616f94ea1..fe277ebb99 100644
--- a/source4/include/smb.h
+++ b/source4/include/smb.h
@@ -609,6 +609,7 @@ typedef struct nt_user_token {
/* a set of flags to control handling of request structures */
#define REQ_CONTROL_LARGE (1<<1) /* allow replies larger than max_xmit */
#define REQ_CONTROL_ASYNC (1<<2) /* the backend will answer this one later */
+#define REQ_CONTROL_MAY_ASYNC (1<<3) /* the backend is allowed to answer async */
/* passed to br lock code */
enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK};
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h
index e9f51ba4d1..7a369a04cb 100644
--- a/source4/include/smb_interfaces.h
+++ b/source4/include/smb_interfaces.h
@@ -1245,7 +1245,9 @@ union smb_open {
-enum smb_read_level {RAW_READ_GENERIC, RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
+enum smb_read_level {RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW_READ_READ, RAW_READ_READX};
+
+#define RAW_READ_GENERIC RAW_READ_READX
/* union for read() backend call
@@ -1253,21 +1255,24 @@ enum smb_read_level {RAW_READ_GENERIC, RAW_READ_READBRAW, RAW_READ_LOCKREAD, RAW
called. It will be big enough to hold the maximum size asked for
*/
union smb_read {
- /* generic interface */
+ /* SMBreadX (and generic) interface */
struct {
enum smb_read_level level;
struct {
uint16_t fnum;
uint64_t offset;
- uint32_t size;
+ uint16_t mincnt;
+ uint16_t maxcnt;
+ uint16_t remaining;
} in;
struct {
char *data;
- uint32_t nread;
+ uint16_t remaining;
+ uint16_t compaction_mode;
+ uint16_t nread;
} out;
- } generic;
-
+ } readx, generic;
/* SMBreadbraw interface */
struct {
@@ -1318,50 +1323,34 @@ union smb_read {
uint16_t nread;
} out;
} read;
-
- /* SMBreadX interface */
- struct {
- enum smb_read_level level;
-
- struct {
- uint16_t fnum;
- uint64_t offset;
- uint16_t mincnt;
- uint16_t maxcnt;
- uint16_t remaining;
- } in;
- struct {
- char *data;
- uint16_t remaining;
- uint16_t compaction_mode;
- uint16_t nread;
- } out;
- } readx;
};
-enum smb_write_level {
- RAW_WRITE_GENERIC, RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
- RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, RAW_WRITE_SPLWRITE};
+enum smb_write_level {RAW_WRITE_WRITEUNLOCK, RAW_WRITE_WRITE,
+ RAW_WRITE_WRITEX, RAW_WRITE_WRITECLOSE, RAW_WRITE_SPLWRITE};
+
+#define RAW_WRITE_GENERIC RAW_WRITE_WRITEX
/* union for write() backend call
*/
union smb_write {
- /* generic interface */
+ /* SMBwriteX interface */
struct {
enum smb_write_level level;
struct {
uint16_t fnum;
uint64_t offset;
- uint32_t count;
+ uint16_t wmode;
+ uint16_t remaining;
+ uint32_t count;
const char *data;
} in;
struct {
uint32_t nwritten;
+ uint16_t remaining;
} out;
- } generic;
-
+ } writex, generic;
/* SMBwriteunlock interface */
struct {
@@ -1395,24 +1384,6 @@ union smb_write {
} out;
} write;
- /* SMBwriteX interface */
- struct {
- enum smb_write_level level;
-
- struct {
- uint16_t fnum;
- uint64_t offset;
- uint16_t wmode;
- uint16_t remaining;
- uint32_t count;
- const char *data;
- } in;
- struct {
- uint32_t nwritten;
- uint16_t remaining;
- } out;
- } writex;
-
/* SMBwriteclose interface */
struct {
enum smb_write_level level;
@@ -1442,42 +1413,15 @@ union smb_write {
};
-enum smb_lock_level {RAW_LOCK_GENERIC, RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
+enum smb_lock_level {RAW_LOCK_LOCK, RAW_LOCK_UNLOCK, RAW_LOCK_LOCKX};
+
+/* the generic interface is defined to be equal to the lockingX interface */
+#define RAW_LOCK_GENERIC RAW_LOCK_LOCKX
/* union for lock() backend call
*/
union smb_lock {
- /* generic interface */
- struct {
- enum smb_lock_level level;
- struct {
- uint16_t fnum;
- } in;
- } generic;
-
- /* SMBlock interface */
- struct {
- enum smb_lock_level level;
-
- struct {
- uint16_t fnum;
- uint32_t count;
- uint32_t offset;
- } in;
- } lock;
-
- /* SMBunlock interface */
- struct {
- enum smb_lock_level level;
-
- struct {
- uint16_t fnum;
- uint32_t count;
- uint32_t offset;
- } in;
- } unlock;
-
- /* SMBlockingX interface */
+ /* SMBlockingX (and generic) interface */
struct {
enum smb_lock_level level;
@@ -1493,26 +1437,30 @@ union smb_lock {
uint64_t count;
} *locks; /* unlocks are first in the arrray */
} in;
- } lockx;
+ } lockx, generic;
+
+ /* SMBlock and SMBunlock interface */
+ struct {
+ enum smb_lock_level level;
+
+ struct {
+ uint16_t fnum;
+ uint32_t count;
+ uint32_t offset;
+ } in;
+ } lock, unlock;
};
-enum smb_close_level {RAW_CLOSE_GENERIC, RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
+enum smb_close_level {RAW_CLOSE_CLOSE, RAW_CLOSE_SPLCLOSE};
+
+#define RAW_CLOSE_GENERIC RAW_CLOSE_CLOSE
/*
union for close() backend call
*/
union smb_close {
- /* generic interface */
- struct {
- enum smb_close_level level;
-
- struct {
- uint16_t fnum;
- } in;
- } generic;
-
- /* SMBclose interface */
+ /* SMBclose (and generic) interface */
struct {
enum smb_close_level level;
@@ -1520,7 +1468,7 @@ union smb_close {
uint16_t fnum;
time_t write_time;
} in;
- } close;
+ } close, generic;
/* SMBsplclose interface - empty! */
struct {