converted smbd to use NTSTATUS by default
[sfrench/samba-autobuild/.git] / source3 / include / smb_macros.h
index e1deaf58ea0d54016e664310298f47cb07de2722..0c66a8e7a9fff54ba1bb527516e38decbdbd21e0 100644 (file)
 #define FNUM_OK(fsp,c) (OPEN_FSP(fsp) && (c)==(fsp)->conn)
 
 #define CHECK_FSP(fsp,conn) if (!FNUM_OK(fsp,conn)) \
-                               return(ERROR(ERRDOS,ERRbadfid)); \
+                               return(ERROR_DOS(ERRDOS,ERRbadfid)); \
                             else if((fsp)->fd == -1) \
-                               return(ERROR(ERRDOS,ERRbadaccess))
+                               return(ERROR_DOS(ERRDOS,ERRbadaccess))
 
 #define CHECK_READ(fsp) if (!(fsp)->can_read) \
-                               return(ERROR(ERRDOS,ERRbadaccess))
+                               return(ERROR_DOS(ERRDOS,ERRbadaccess))
 #define CHECK_WRITE(fsp) if (!(fsp)->can_write) \
-                               return(ERROR(ERRDOS,ERRbadaccess))
-#define CHECK_ERROR(fsp) if (HAS_CACHED_ERROR(fsp)) \
-                               return(CACHED_ERROR(fsp))
+                               return(ERROR_DOS(ERRDOS,ERRbadaccess))
 
 /* translates a connection number into a service number */
 #define SNUM(conn)         ((conn)?(conn)->service:-1)
 #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(inbuf,outbuf,fsp,__LINE__)
-
 /* these are the datagram types */
 #define DGRAM_DIRECT_UNIQUE 0x10
 
-#define ERROR(class,x) error_packet(inbuf,outbuf,class,x,__LINE__)
+#define ERROR_DOS(class,code) error_packet(outbuf,0,class,code,__LINE__)
+#define ERROR_NT(status) error_packet(outbuf,status,0,0,__LINE__)
+#define ERROR_BOTH(status,class,code) error_packet(outbuf,status,class,code,__LINE__)
 
 /* this is how errors are generated */
-#define UNIXERROR(defclass,deferror) unix_error_packet(inbuf,outbuf,defclass,deferror,__LINE__)
+#define UNIXERROR(defclass,deferror) unix_error_packet(outbuf,defclass,deferror,__LINE__)
 
 #define SMB_ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))