From 06cc91f9a631a23dcd4902d710b89e4b7584c459 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 11 Sep 1998 01:24:30 +0000 Subject: Added ssize_t to configure code. Got 'religion' about using size_t and ssize_t for read/write stuff as part of the code to expose 64 bits to the client. This checkin does all the 'easy' stuff - such as all the read/write/lock calls - but now comes the harder parts (open & friends) and all the file enquiry functions..... Jeremy. (This used to be commit 36544fe5476f7770bd5748574fc54be7b3ee4d4a) --- source3/include/config.h.in | 1 + source3/include/proto.h | 28 ++++++++++++++-------------- source3/include/smb.h | 6 +++++- 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'source3/include') diff --git a/source3/include/config.h.in b/source3/include/config.h.in index fc5dcd2c4e..615666b7ff 100644 --- a/source3/include/config.h.in +++ b/source3/include/config.h.in @@ -63,6 +63,7 @@ #undef HAVE_UNSIGNED_CHAR #undef HAVE_UTIMBUF #undef ino_t +#undef ssize_t #undef HAVE_CONNECT #undef HAVE_SHORT_INO_T #undef WITH_AFS diff --git a/source3/include/proto.h b/source3/include/proto.h index 862c11f350..4c966b2faa 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -258,18 +258,18 @@ BOOL strhaslower(char *s); int count_chars(char *s,char c); void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,time_t date); void close_low_fds(void); -int write_socket(int fd,char *buf,int len); -int read_udp_socket(int fd,char *buf,int len); -int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out); +ssize_t write_socket(int fd,char *buf,size_t len); +ssize_t read_udp_socket(int fd,char *buf,size_t len); +ssize_t read_with_timeout(int fd,char *buf,size_t mincnt,size_t maxcnt,unsigned int time_out); int TvalDiff(struct timeval *tvalold,struct timeval *tvalnew); BOOL send_keepalive(int client); -int read_data(int fd,char *buffer,int N); -int write_data(int fd,char *buffer,int N); +ssize_t read_data(int fd,char *buffer,size_t N); +ssize_t write_data(int fd,char *buffer,size_t N); SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n,char *header,int headlen,int align); -int read_smb_length(int fd,char *inbuf,int timeout); -BOOL receive_smb(int fd,char *buffer, int timeout); -BOOL client_receive_smb(int fd,char *buffer, int timeout); -BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout); +ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout); +BOOL receive_smb(int fd,char *buffer, unsigned int timeout); +BOOL client_receive_smb(int fd,char *buffer, unsigned int timeout); +BOOL receive_local_message(int fd, char *buffer, int buffer_len, unsigned int timeout); BOOL push_oplock_pending_smb_message(char *buf, int msg_len); BOOL receive_message_or_smb(int smbfd, int oplock_fd, char *buffer, int buffer_len, @@ -289,7 +289,7 @@ void become_daemon(void); BOOL yesno(char *p); char *fgets_slash(char *s2,int maxlen,FILE *f); int set_filelen(int fd, SMB_OFF_T len); -void *Realloc(void *p,int size); +void *Realloc(void *p,size_t size); BOOL get_myname(char *my_name,struct in_addr *ip); BOOL ip_equal(struct in_addr ip1,struct in_addr ip2); int open_socket_in(int type, int port, int dlevel,uint32 socket_addr); @@ -333,7 +333,7 @@ char *tab_depth(int depth); char *sid_to_string(pstring sidstr_out, DOM_SID *sid); BOOL string_to_sid(DOM_SID *sidout, char *sidstr); int str_checksum(char *s); -void zero_free(void *p, int size); +void zero_free(void *p, size_t size); /*The following definitions come from libsmb/clientgen.c */ @@ -1715,8 +1715,8 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int /*The following definitions come from smbd/fileio.c */ SMB_OFF_T seek_file(files_struct *fsp,SMB_OFF_T pos); -int read_file(files_struct *fsp,char *data,uint32 pos,int n); -int write_file(files_struct *fsp,char *data,int n); +ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n); +ssize_t write_file(files_struct *fsp,char *data,size_t n); void sync_file(connection_struct *conn, files_struct *fsp); /*The following definitions come from smbd/filename.c */ @@ -1846,7 +1846,7 @@ int reply_pipe_close(connection_struct *conn, char *inbuf,char *outbuf); /*The following definitions come from smbd/predict.c */ -int read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,int num); +ssize_t read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,size_t num); void do_read_prediction(void); void invalidate_read_prediction(int fd); diff --git a/source3/include/smb.h b/source3/include/smb.h index dae3e275d5..3e68f1c4ca 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -458,7 +458,7 @@ typedef struct /* Structure used when SMBwritebmpx is active */ typedef struct { - int wr_total_written; /* So we know when to discard this */ + size_t wr_total_written; /* So we know when to discard this */ int32 wr_timeout; int32 wr_errclass; int32 wr_error; /* Cached errors */ @@ -1413,6 +1413,10 @@ enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1}; #define SMB_LPID_OFFSET(indx) (10 * (indx)) #define SMB_LKOFF_OFFSET(indx) ( 2 + (10 * (indx))) #define SMB_LKLEN_OFFSET(indx) ( 6 + (10 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_HIGH(indx) (4 + (20 * (indx))) +#define SMB_LARGE_LKOFF_OFFSET_LOW(indx) (8 + (20 * (indx))) +#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), \ -- cgit