summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-09-03 18:40:31 +0000
committerJeremy Allison <jra@samba.org>1998-09-03 18:40:31 +0000
commit7bb86c1b132bce31a006ea9768a54db7a45fe1a5 (patch)
tree1802e8e2741345e91187fc4b149016af75990971 /source3/include
parent4acd373e5bbd615141ceb5fb3c4a588a5b4581d7 (diff)
downloadsamba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.tar.gz
samba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.tar.bz2
samba-7bb86c1b132bce31a006ea9768a54db7a45fe1a5.zip
Ok - this is the 64 bit widening check in. It changes the configure
to check for stat64 and friends, and then changes much of Samba to use the data type SMB_OFF_T for file size information. stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide the 64 bit calls if needed. Note that this still does not expose 64 bit functionality to the client, as the changes to the reply_xxx smb's are not yet done. This code change should make these changes possible. Still to do before full 64 bit-ness to the client: fcntl lock code. statfs code widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T types being in place). Let me know if wierd things happen after this check-in and I'll fix them :-). Jeremy. (This used to be commit 14500936c321d15995c963766aac67bf1f4e3824)
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/config.h.in16
-rw-r--r--source3/include/includes.h30
-rw-r--r--source3/include/proto.h22
-rw-r--r--source3/include/smb.h12
4 files changed, 61 insertions, 19 deletions
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index f67061a289..71304c86b4 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -59,6 +59,7 @@
#undef HAVE_ERRNO_DECL
#undef HAVE_LONGLONG
#undef HAVE_OFF64_T
+#undef SIZEOF_OFF_T
#undef HAVE_REMSH
#undef HAVE_UNSIGNED_CHAR
#undef HAVE_UTIMBUF
@@ -158,6 +159,21 @@
/* Define if you have the ftruncate function. */
#undef HAVE_FTRUNCATE
+/* Define if you have the stat64 function. */
+#undef HAVE_STAT64
+
+/* Define if you have the fstat64 function. */
+#undef HAVE_FSTAT64
+
+/* Define if you have the lstat64 function. */
+#undef HAVE_LSTAT64
+
+/* Define if you have the lseek64 function. */
+#undef HAVE_LSEEK64
+
+/* Define if you have the ftruncate64 function. */
+#undef HAVE_FTRUNCATE64
+
/* Define if you have the getauthuid function. */
#undef HAVE_GETAUTHUID
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 15112cb163..41fccce5fe 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -318,7 +318,7 @@
#endif
/*
- * Type for device and inodes.
+ * Types for devices, inodes and offsets.
*/
#ifndef SMB_DEV_T
@@ -329,16 +329,36 @@
#define SMB_INO_T uint32
#endif
+#ifndef SMB_OFF_T
+#ifdef HAVE_OFF64_T
+#define SMB_OFF_T off64_t
+#else
+#define SMB_OFF_T off_t
+#endif
+#endif
+
+/*
+ * Set the define that tells us if we can do 64 bit
+ * NT SMB calls.
+ */
+
+#ifndef LARGE_SMB_OFF_T
+#if defined(HAVE_OFF64_T) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
+#define LARGE_SMB_OFF_T 1
+#endif
+#endif
+
/*
- * Type for stat structure. This will
- * soon change to a user defined type
- * once we wrap stat(), fstat() and lstat()
- * for 64 bit file sizes. JRA.
+ * Type for stat structure.
*/
#ifndef SMB_STRUCT_STAT
+#if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
+#define SMB_STRUCT_STAT struct stat64
+#else
#define SMB_STRUCT_STAT struct stat
#endif
+#endif
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 969b8c6a86..0e6dc54d34 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -165,6 +165,11 @@ int smbrun(char *cmd,char *outfile,BOOL shared);
int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
int sys_select(int maxfd, fd_set *fds,struct timeval *tval);
+int sys_stat(char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf);
+int sys_lstat(char *fname,SMB_STRUCT_STAT *sbuf);
+int sys_ftruncate(int fd, SMB_OFF_T offset);
+int sys_lseek(int fd, SMB_OFF_T offset, int whence);
int dos_unlink(char *fname);
int dos_open(char *fname,int flags,int mode);
DIR *dos_opendir(char *dname);
@@ -177,7 +182,7 @@ int dos_chdir(char *dname);
int dos_utime(char *fname,struct utimbuf *times);
int dos_rename(char *from, char *to);
int dos_chmod(char *fname,int mode);
-char *sys_getwd(char *s);
+char *dos_getwd(char *s);
int sys_chown(char *fname,int uid,int gid);
int sys_chroot(char *dname);
struct hostent *sys_gethostbyname(char *name);
@@ -230,7 +235,7 @@ int name_mangle( char *In, char *Out, char name_type );
BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
time_t file_modtime(char *fname);
BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
-uint32 file_size(char *file_name);
+SMB_OFF_T file_size(char *file_name);
char *attrib_string(int mode);
int StrCaseCmp(char *s, char *t);
int StrnCaseCmp(char *s, char *t, int n);
@@ -265,7 +270,7 @@ void expand_mask(char *Mask,BOOL doext);
BOOL strhasupper(char *s);
BOOL strhaslower(char *s);
int count_chars(char *s,char c);
-void make_dir_struct(char *buf,char *mask,char *fname,unsigned int size,int mode,time_t date);
+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 set_blocking(int fd, BOOL set);
int write_socket(int fd,char *buf,int len);
@@ -276,7 +281,7 @@ 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);
-int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align);
+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);
@@ -301,7 +306,7 @@ BOOL mask_match(char *str, char *regexp, int case_sig,BOOL trans2);
void become_daemon(void);
BOOL yesno(char *p);
char *fgets_slash(char *s2,int maxlen,FILE *f);
-int set_filelen(int fd, long len);
+int set_filelen(int fd, SMB_OFF_T len);
int byte_checksum(char *buf,int len);
char *dirname_dos(char *path,char *buf);
void *Realloc(void *p,int size);
@@ -1977,7 +1982,8 @@ BOOL dptr_zero(char *buf);
void *dptr_fetch(char *buf,int *num);
void *dptr_fetch_lanman2(int dptr_num);
BOOL dir_check_ftype(connection_struct *conn,int mode,SMB_STRUCT_STAT *st,int dirtype);
-BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,int *size,int *mode,time_t *date,BOOL check_descend);
+BOOL get_dir_entry(connection_struct *conn,char *mask,int dirtype,char *fname,
+ SMB_OFF_T *size,int *mode,time_t *date,BOOL check_descend);
void *OpenDir(connection_struct *conn, char *name, BOOL use_veto);
void CloseDir(void *p);
char *ReadDirName(void *p);
@@ -2003,7 +2009,7 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int
/*The following definitions come from smbd/fileio.c */
-int seek_file(files_struct *fsp,uint32 pos);
+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);
void sync_file(connection_struct *conn, files_struct *fsp);
@@ -2144,7 +2150,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,int offset,char *buf,char **ptr,int num);
+int read_predict(int fd,SMB_OFF_T offset,char *buf,char **ptr,int 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 b27c531937..8600bcc120 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -442,10 +442,10 @@ struct cli_state {
typedef struct
{
- int size;
+ SMB_OFF_T size;
int mode;
- int uid;
- int gid;
+ uid_t uid;
+ gid_t gid;
/* these times are normally kept in GMT */
time_t mtime;
time_t atime;
@@ -559,12 +559,12 @@ typedef struct files_struct
int fnum;
connection_struct *conn;
file_fd_struct *fd_ptr;
- int pos;
- uint32 size;
+ SMB_OFF_T pos;
+ SMB_OFF_T size;
int mode;
int vuid;
char *mmap_ptr;
- uint32 mmap_size;
+ SMB_OFF_T mmap_size;
write_bmpx_struct *wbmpx_ptr;
struct timeval open_time;
BOOL open;