summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-01 23:11:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:27 -0500
commit0557c6cba2a21c9df547fbc8ff4db2899bc1c171 (patch)
tree991fd0420cd111e03416f66ecbab723d2772f66f /source3/include
parentab8ffa822a38765301cb6a34dd917eb1c2963249 (diff)
downloadsamba-0557c6cba2a21c9df547fbc8ff4db2899bc1c171.tar.gz
samba-0557c6cba2a21c9df547fbc8ff4db2899bc1c171.tar.bz2
samba-0557c6cba2a21c9df547fbc8ff4db2899bc1c171.zip
r6172: Tidy up error processing significantly. Remove unix_ERR_XXX global nastyness.
Jeremy. (This used to be commit d3379fe61bb934082b51a37adac232a96bafcf46)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/nt_status.h1
-rw-r--r--source3/include/nterr.h3
-rw-r--r--source3/include/smb.h23
-rw-r--r--source3/include/smb_macros.h23
4 files changed, 21 insertions, 29 deletions
diff --git a/source3/include/nt_status.h b/source3/include/nt_status.h
index 9747f73eb1..ab768258df 100644
--- a/source3/include/nt_status.h
+++ b/source3/include/nt_status.h
@@ -56,6 +56,7 @@ typedef uint32 WERROR;
#define NT_STATUS_IS_OK(x) (NT_STATUS_V(x) == 0)
#define NT_STATUS_IS_ERR(x) ((NT_STATUS_V(x) & 0xc0000000) == 0xc0000000)
+#define NT_STATUS_IS_INVALID(x) (NT_STATUS_V(x) == 0xFFFFFFFF)
#define NT_STATUS_EQUAL(x,y) (NT_STATUS_V(x) == NT_STATUS_V(y))
#define W_ERROR_IS_OK(x) (W_ERROR_V(x) == 0)
#define W_ERROR_EQUAL(x,y) (W_ERROR_V(x) == W_ERROR_V(y))
diff --git a/source3/include/nterr.h b/source3/include/nterr.h
index 6cf5a756d2..417719625e 100644
--- a/source3/include/nterr.h
+++ b/source3/include/nterr.h
@@ -37,6 +37,9 @@
#define STATUS_NOTIFY_ENUM_DIR NT_STATUS(0x010c)
#define ERROR_INVALID_DATATYPE NT_STATUS(0x070c)
+/* Special "invalid" NT status code. */
+#define NT_STATUS_INVALID NT_STATUS(0xFFFFFFFF)
+
/* Win32 Error codes extracted using a loop in smbclient then printing a
netmon sniff to a file. */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index efa74436ee..d12459c2f9 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -357,14 +357,14 @@ typedef struct time_info
} UTIME;
/* Structure used when SMBwritebmpx is active */
-typedef struct
-{
- size_t wr_total_written; /* So we know when to discard this */
- int32 wr_timeout;
- int32 wr_errclass;
- int32 wr_error; /* Cached errors */
- BOOL wr_mode; /* write through mode) */
- BOOL wr_discard; /* discard all further data */
+typedef struct {
+ size_t wr_total_written; /* So we know when to discard this */
+ int32 wr_timeout;
+ int32 wr_errclass; /* Cached errors */
+ int32 wr_error; /* Cached errors */
+ NTSTATUS wr_status; /* Cached errors */
+ BOOL wr_mode; /* write through mode) */
+ BOOL wr_discard; /* discard all further data */
} write_bmpx_struct;
typedef struct write_cache
@@ -1384,13 +1384,6 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
*/
#define COPYBUF_SIZE (8*1024)
-/*
- * Values used to override error codes.
- */
-extern int unix_ERR_class;
-extern int unix_ERR_code;
-extern NTSTATUS unix_ERR_ntstatus;
-
/*
* Used in chaining code.
*/
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 2b3140783b..e19c51884f 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -97,9 +97,6 @@
#define CHECK_WRITE(fsp) if (!(fsp)->can_write) \
return(ERROR_DOS(ERRDOS,ERRbadaccess))
-#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \
- return(CACHED_ERROR(fsp))
-
#define ERROR_WAS_LOCK_DENIED(status) (NT_STATUS_EQUAL((status), NT_STATUS_LOCK_NOT_GRANTED) || \
NT_STATUS_EQUAL((status), NT_STATUS_FILE_LOCK_CONFLICT) )
@@ -158,25 +155,23 @@
#define SMB_LARGE_LKLEN_OFFSET_HIGH(indx) (12 + (20 * (indx)))
#define SMB_LARGE_LKLEN_OFFSET_LOW(indx) (16 + (20 * (indx)))
-/* Macro to cache an error in a write_bmpx_struct */
-#define CACHE_ERROR(w,c,e) ((w)->wr_errclass = (c), (w)->wr_error = (e), \
- w->wr_discard = True, -1)
/* Macro to test if an error has been cached for this fnum */
#define HAS_CACHED_ERROR(fsp) ((fsp)->wbmpx_ptr && \
(fsp)->wbmpx_ptr->wr_discard)
/* Macro to turn the cached error into an error packet */
#define CACHED_ERROR(fsp) cached_error_packet(outbuf,fsp,__LINE__,__FILE__)
-/* these are the datagram types */
-#define DGRAM_DIRECT_UNIQUE 0x10
-
-#define ERROR_DOS(class,code) error_packet(outbuf,NT_STATUS_OK,class,code,False,__LINE__,__FILE__)
-#define ERROR_FORCE_DOS(class,code) error_packet(outbuf,NT_STATUS_OK,class,code,True,__LINE__,__FILE__)
-#define ERROR_NT(status) error_packet(outbuf,status,0,0,False,__LINE__,__FILE__)
-#define ERROR_BOTH(status,class,code) error_packet(outbuf,status,class,code,False,__LINE__,__FILE__)
+#define ERROR_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_OK,__LINE__,__FILE__)
+#define ERROR_FORCE_DOS(class,code) error_packet(outbuf,class,code,NT_STATUS_INVALID,__LINE__,__FILE__)
+#define ERROR_NT(status) error_packet(outbuf,0,0,status,__LINE__,__FILE__)
+#define ERROR_FORCE_NT(status) error_packet(outbuf,-1,-1,status,__LINE__,__FILE__)
+#define ERROR_BOTH(status,class,code) error_packet(outbuf,class,code,status,__LINE__,__FILE__)
/* this is how errors are generated */
-#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__,__FILE__)
+#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,NT_STATUS_OK,__LINE__,__FILE__)
+
+/* these are the datagram types */
+#define DGRAM_DIRECT_UNIQUE 0x10
#define SMB_ROUNDUP(x,r) ( ((x)%(r)) ? ( (((x)+(r))/(r))*(r) ) : (x))