From 6aa12fcb30c8f7246fd0215b1d808191c0d87668 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 5 Apr 2012 14:53:08 +1000 Subject: build: Remove SMB_OFF_T, replace with off_t Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T. Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Fri Apr 6 01:47:43 CEST 2012 on sn-devel-104 --- examples/VFS/skel_opaque.c | 20 +++++----- examples/VFS/skel_transparent.c | 20 +++++----- source3/client/client.c | 10 ++--- source3/client/clitar.c | 2 +- source3/include/includes.h | 8 +--- source3/include/libsmb_internal.h | 6 +-- source3/include/printing.h | 2 +- source3/include/proto.h | 20 +++++----- source3/include/smb.h | 10 ++--- source3/include/transfer_file.h | 2 +- source3/include/vfs.h | 47 +++++++++++----------- source3/lib/recvfile.c | 8 ++-- source3/lib/sendfile.c | 18 ++++----- source3/lib/system.c | 10 ++--- source3/lib/util.c | 6 +-- source3/lib/util_transfer_file.c | 4 +- source3/libsmb/clifile.c | 16 ++++---- source3/libsmb/clirap.c | 10 ++--- source3/libsmb/clirap.h | 10 ++--- source3/libsmb/clireadwrite.c | 20 +++++----- source3/libsmb/libsmb_dir.c | 2 +- source3/libsmb/libsmb_file.c | 8 ++-- source3/libsmb/libsmb_stat.c | 6 +-- source3/libsmb/libsmb_xattr.c | 6 +-- source3/libsmb/proto.h | 16 ++++---- source3/locking/posix.c | 64 +++++++++++++++--------------- source3/modules/onefs.h | 4 +- source3/modules/onefs_streams.c | 4 +- source3/modules/onefs_system.c | 8 ++-- source3/modules/vfs_aio_fork.c | 2 +- source3/modules/vfs_cacheprime.c | 12 +++--- source3/modules/vfs_commit.c | 14 +++---- source3/modules/vfs_crossrename.c | 4 +- source3/modules/vfs_default.c | 30 +++++++------- source3/modules/vfs_full_audit.c | 22 +++++----- source3/modules/vfs_gpfs.c | 6 +-- source3/modules/vfs_gpfs_hsm_notify.c | 4 +- source3/modules/vfs_onefs.c | 4 +- source3/modules/vfs_prealloc.c | 10 ++--- source3/modules/vfs_readahead.c | 8 ++-- source3/modules/vfs_recycle.c | 20 +++++----- source3/modules/vfs_smb_traffic_analyzer.c | 8 ++-- source3/modules/vfs_streams_depot.c | 4 +- source3/modules/vfs_streams_xattr.c | 14 +++---- source3/modules/vfs_time_audit.c | 24 +++++------ source3/modules/vfs_tsmsm.c | 6 +-- source3/passdb/pdb_smbpasswd.c | 4 +- source3/printing/nt_printing.c | 6 +-- source3/printing/printspoolss.c | 2 +- source3/smbd/aio.c | 12 +++--- source3/smbd/close.c | 2 +- source3/smbd/dir.c | 4 +- source3/smbd/fileio.c | 14 +++---- source3/smbd/nttrans.c | 8 ++-- source3/smbd/proto.h | 30 +++++++------- source3/smbd/reply.c | 58 +++++++++++++-------------- source3/smbd/smb2_read.c | 2 +- source3/smbd/trans2.c | 12 +++--- source3/smbd/vfs.c | 38 +++++++++--------- source3/torture/cmd_vfs.c | 6 +-- source3/torture/test_posix_append.c | 2 +- source3/torture/torture.c | 10 ++--- source3/torture/utable.c | 2 +- 63 files changed, 384 insertions(+), 387 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 40691ed7f9..1a44a39f2d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -183,7 +183,7 @@ static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void return -1; } -static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset) { errno = ENOSYS; return -1; @@ -195,25 +195,25 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const vo return -1; } -static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, off_t offset) { errno = ENOSYS; return -1; } -static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) +static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence) { errno = ENOSYS; - return (SMB_OFF_T)-1; + return (off_t)-1; } -static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, off_t offset, size_t n) { errno = ENOSYS; return -1; } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t n) { errno = ENOSYS; return -1; @@ -314,7 +314,7 @@ static int skel_ntimes(vfs_handle_struct *handle, return -1; } -static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t offset) { errno = ENOSYS; return -1; @@ -322,13 +322,13 @@ static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_ static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, SMB_OFF_T len) + off_t offset, off_t len) { errno = ENOSYS; return -1; } -static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type) { errno = ENOSYS; return false; @@ -346,7 +346,7 @@ static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_st return -1; } -static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { errno = ENOSYS; return false; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 2d5fcdd63b..ba7e898cf8 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -189,7 +189,7 @@ static ssize_t skel_vfs_read(vfs_handle_struct *handle, files_struct *fsp, void return SMB_VFS_NEXT_READ(handle, fsp, data, n); } -static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset) { return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } @@ -199,22 +199,22 @@ static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, const vo return SMB_VFS_NEXT_WRITE(handle, fsp, data, n); } -static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) +static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, off_t offset) { return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } -static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) +static off_t skel_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence) { return SMB_VFS_NEXT_LSEEK(handle, fsp, offset, whence); } -static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, SMB_OFF_T offset, size_t n) +static ssize_t skel_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, off_t offset, size_t n) { return SMB_VFS_NEXT_SENDFILE(handle, tofd, fromfsp, hdr, offset, n); } -static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t n) +static ssize_t skel_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t n) { return SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, n); } @@ -299,20 +299,20 @@ static int skel_ntimes(vfs_handle_struct *handle, return SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft); } -static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset) +static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t offset) { return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); } static int skel_fallocate(vfs_handle_struct *handle, files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { return SMB_VFS_NEXT_FALLOCATE(handle, fsp, mode, offset, len); } -static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool skel_lock(vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type) { return SMB_VFS_NEXT_LOCK(handle, fsp, op, offset, count, type); } @@ -327,7 +327,7 @@ static int skel_linux_setlease(struct vfs_handle_struct *handle, struct files_st return SMB_VFS_NEXT_LINUX_SETLEASE(handle, fsp, leasetype); } -static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool skel_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { return SMB_VFS_NEXT_GETLOCK(handle, fsp, poffset, pcount, ptype, ppid); } diff --git a/source3/client/client.c b/source3/client/client.c index 3bfe8e94a7..a4a7ebdeab 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -251,7 +251,7 @@ static int readfile(uint8_t *b, int n, XFILE *f) struct push_state { XFILE *f; - SMB_OFF_T nread; + off_t nread; }; static size_t push_source(uint8_t *buf, size_t n, void *priv) @@ -1070,9 +1070,9 @@ static int do_get(const char *rname, const char *lname_in, bool reget) bool newhandle = false; struct timespec tp_start; uint16 attr; - SMB_OFF_T size; + off_t size; off_t start = 0; - SMB_OFF_T nread = 0; + off_t nread = 0; int rc = 0; struct cli_state *targetcli = NULL; char *targetname = NULL; @@ -1678,7 +1678,7 @@ static int do_allinfo(const char *name) { fstring altname; struct timespec b_time, a_time, m_time, c_time; - SMB_OFF_T size; + off_t size; uint16_t mode; SMB_INO_T ino; NTTIME tmp; @@ -1838,7 +1838,7 @@ static int do_put(const char *rname, const char *lname, bool reput) TALLOC_CTX *ctx = talloc_tos(); uint16_t fnum; XFILE *f; - SMB_OFF_T start = 0; + off_t start = 0; int rc = 0; struct timespec tp_start; struct cli_state *targetcli; diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 43311c13ae..b02ada427e 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -45,7 +45,7 @@ static int clipfind(char **aret, int ret, char *tok); typedef struct file_info_struct file_info2; struct file_info_struct { - SMB_OFF_T size; + off_t size; uint16 mode; uid_t uid; gid_t gid; diff --git a/source3/include/includes.h b/source3/include/includes.h index 8e5b1cd41f..7bdd20074a 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -298,10 +298,6 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T; #define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs)))) #endif -#ifndef SMB_OFF_T -# define SMB_OFF_T off_t -#endif - /* TODO: remove this macros */ #define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v) #define BIG_UINT(p, ofs) BVAL(p, ofs) @@ -310,7 +306,7 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T; /* this should really be a 64 bit type if possible */ typedef uint64_t br_off; -#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8) +#define SMB_OFF_T_BITS (sizeof(off_t)*8) /* * Set the define that tells us if we can do 64 bit @@ -319,7 +315,7 @@ typedef uint64_t br_off; #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32)) #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32)) -#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) ))) +#define IVAL_TO_SMB_OFF_T(buf,off) ((off_t)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) ))) #ifndef HAVE_BLKSIZE_T /* This is mainly for HP/UX which defines st_blksize as long */ diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index 7f16ab6859..0c8d8ab270 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -40,7 +40,7 @@ */ typedef struct DOS_ATTR_DESC { int mode; - SMB_OFF_T size; + off_t size; time_t create_time; time_t access_time; time_t write_time; @@ -96,7 +96,7 @@ struct smbc_dir_list { struct _SMBCFILE { int cli_fd; char *fname; - SMB_OFF_T offset; + off_t offset; struct _SMBCSRV *srv; bool file; struct smbc_dir_list *dir_list, *dir_end, *dir_next; @@ -368,7 +368,7 @@ SMBC_getatr(SMBCCTX * context, SMBCSRV *srv, const char *path, uint16 *mode, - SMB_OFF_T *size, + off_t *size, struct timespec *create_time_ts, struct timespec *access_time_ts, struct timespec *write_time_ts, diff --git a/source3/include/printing.h b/source3/include/printing.h index debf63f5e0..3551d8e62a 100644 --- a/source3/include/printing.h +++ b/source3/include/printing.h @@ -179,7 +179,7 @@ NTSTATUS print_spool_open(files_struct *fsp, uint16_t current_vuid); int print_spool_write(files_struct *fsp, const char *data, uint32_t size, - SMB_OFF_T offset, uint32_t *written); + off_t offset, uint32_t *written); void print_spool_end(files_struct *fsp, enum file_close_type close_type); diff --git a/source3/include/proto.h b/source3/include/proto.h index 1d3dba6a83..34c9fe8e53 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -192,17 +192,17 @@ void pidfile_unlink(void); ssize_t sys_recvfile(int fromfd, int tofd, - SMB_OFF_T offset, + off_t offset, size_t count); ssize_t sys_recvfile(int fromfd, int tofd, - SMB_OFF_T offset, + off_t offset, size_t count); ssize_t drain_socket(int sockfd, size_t count); /* The following definitions come from lib/sendfile.c */ -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count); /* The following definitions come from lib/server_mutex.c */ @@ -321,8 +321,8 @@ int sys_set_nfs_quota(const char *path, const char *bdev, ssize_t sys_read(int fd, void *buf, size_t count); ssize_t sys_write(int fd, const void *buf, size_t count); ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt); -ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off); -ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off); +ssize_t sys_pread(int fd, void *buf, size_t count, off_t off); +ssize_t sys_pwrite(int fd, const void *buf, size_t count, off_t off); ssize_t sys_send(int s, const void *msg, size_t len, int flags); ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); int sys_fcntl_ptr(int fd, int cmd, void *arg); @@ -334,8 +334,8 @@ int sys_fstat(int fd, SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times); int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf, bool fake_dir_create_times); -int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len); -int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len); +int sys_posix_fallocate(int fd, off_t offset, off_t len); +int sys_fallocate(int fd, enum vfs_fallocate_mode mode, off_t offset, off_t len); void kernel_flock(int fd, uint32 share_mode, uint32 access_mask); DIR *sys_fdopendir(int fd); int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev); @@ -458,7 +458,7 @@ int set_message_bcc(char *buf,int num_bytes); ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob); char *unix_clean_name(TALLOC_CTX *ctx, const char *s); char *clean_name(TALLOC_CTX *ctx, const char *s); -ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos); +ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, off_t pos); int set_blocking(int fd, bool set); NTSTATUS init_before_fork(void); NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx, @@ -487,8 +487,8 @@ const char *readdirname(DIR *p); bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensitive); void set_namearray(name_compare_entry **ppname_array, const char *namelist); void free_namearray(name_compare_entry *name_array); -bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); -bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); +bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type); +bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid); bool is_myname(const char *s); void ra_lanman_string( const char *native_lanman ); const char *get_remote_arch_str(void); diff --git a/source3/include/smb.h b/source3/include/smb.h index ddf3227336..758ad9959d 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -128,8 +128,8 @@ typedef union unid_t { #include "librpc/gen_ndr/security.h" typedef struct write_cache { - SMB_OFF_T file_size; - SMB_OFF_T offset; + off_t file_size; + off_t offset; size_t alloc_size; size_t data_size; char *data; @@ -139,7 +139,7 @@ struct fd_handle { size_t ref_count; int fd; uint64_t position_information; - SMB_OFF_T pos; + off_t pos; uint32 private_options; /* NT Create options, but we only look at * NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and * NTCREATEX_OPTIONS_PRIVATE_DENY_FCB and @@ -340,8 +340,8 @@ struct trans_state { */ struct stream_struct { - SMB_OFF_T size; - SMB_OFF_T alloc_size; + off_t size; + off_t alloc_size; char *name; }; diff --git a/source3/include/transfer_file.h b/source3/include/transfer_file.h index 79ad9c4c34..546104f8f3 100644 --- a/source3/include/transfer_file.h +++ b/source3/include/transfer_file.h @@ -27,6 +27,6 @@ ssize_t transfer_file_internal(void *in_file, ssize_t (*read_fn)(void *, void *, size_t), ssize_t (*write_fn)(void *, const void *, size_t)); -SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n); +off_t transfer_file(int infd, int outfd, off_t n); #endif /* __TRANSFER_FILE_H__ */ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 48b0973fe5..e858235a91 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -139,6 +139,7 @@ /* Leave at 29 - not yet releases. Add fsctl. Richard Sharpe */ /* Leave at 29 - not yet released. add SMB_VFS_GET_DFS_REFERRAL() - metze */ /* Leave at 29 - not yet released. Remove l{list,get,set,remove}xattr - abartlet */ +/* Leave at 29 - not yet released. move to plain off_t - abartlet */ #define SMB_VFS_INTERFACE_VERSION 29 /* @@ -241,12 +242,12 @@ struct vfs_fn_pointers { int *pinfo); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp); ssize_t (*read_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); - ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, SMB_OFF_T offset); + ssize_t (*pread_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, off_t offset); ssize_t (*write_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n); - ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset); - SMB_OFF_T (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset, int whence); - ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, SMB_OFF_T offset, size_t count); - ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count); + ssize_t (*pwrite_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n, off_t offset); + off_t (*lseek_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset, int whence); + ssize_t (*sendfile_fn)(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, off_t offset, size_t count); + ssize_t (*recvfile_fn)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, off_t offset, size_t count); int (*rename_fn)(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst); @@ -267,17 +268,17 @@ struct vfs_fn_pointers { int (*ntimes_fn)(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, struct smb_file_time *ft); - int (*ftruncate_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T offset); + int (*ftruncate_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t offset); int (*fallocate_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len); - bool (*lock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type); + off_t offset, + off_t len); + bool (*lock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, off_t offset, off_t count, int type); int (*kernel_flock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32_t access_mask); int (*linux_setlease_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype); - bool (*getlock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid); + bool (*getlock_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid); int (*symlink_fn)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); int (*readlink_fn)(struct vfs_handle_struct *handle, const char *path, char *buf, size_t bufsiz); int (*link_fn)(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); @@ -598,21 +599,21 @@ ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, - SMB_OFF_T offset); + off_t offset); ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, size_t n); ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, - size_t n, SMB_OFF_T offset); -SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T offset, + size_t n, off_t offset); +off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle, + struct files_struct *fsp, off_t offset, int whence); ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, - SMB_OFF_T offset, size_t count); + off_t offset, size_t count); ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd, - files_struct *tofsp, SMB_OFF_T offset, + files_struct *tofsp, off_t offset, size_t count); int smb_vfs_call_rename(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, @@ -646,23 +647,23 @@ int smb_vfs_call_ntimes(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, struct smb_file_time *ft); int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T offset); + struct files_struct *fsp, off_t offset); int smb_vfs_call_fallocate(struct vfs_handle_struct *handle, struct files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len); + off_t offset, + off_t len); bool smb_vfs_call_lock(struct vfs_handle_struct *handle, - struct files_struct *fsp, int op, SMB_OFF_T offset, - SMB_OFF_T count, int type); + struct files_struct *fsp, int op, off_t offset, + off_t count, int type); int smb_vfs_call_kernel_flock(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 share_mode, uint32_t access_mask); int smb_vfs_call_linux_setlease(struct vfs_handle_struct *handle, struct files_struct *fsp, int leasetype); bool smb_vfs_call_getlock(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T *poffset, - SMB_OFF_T *pcount, int *ptype, pid_t *ppid); + struct files_struct *fsp, off_t *poffset, + off_t *pcount, int *ptype, pid_t *ppid); int smb_vfs_call_symlink(struct vfs_handle_struct *handle, const char *oldpath, const char *newpath); int smb_vfs_call_readlink(struct vfs_handle_struct *handle, diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c index 6c8a1a3b57..c53ba77e5c 100644 --- a/source3/lib/recvfile.c +++ b/source3/lib/recvfile.c @@ -44,7 +44,7 @@ static ssize_t default_sys_recvfile(int fromfd, int tofd, - SMB_OFF_T offset, + off_t offset, size_t count) { int saved_errno = 0; @@ -62,7 +62,7 @@ static ssize_t default_sys_recvfile(int fromfd, return 0; } - if (tofd != -1 && offset != (SMB_OFF_T)-1) { + if (tofd != -1 && offset != (off_t)-1) { if (lseek(tofd, offset, SEEK_SET) == -1) { if (errno != ESPIPE) { return -1; @@ -140,7 +140,7 @@ static ssize_t default_sys_recvfile(int fromfd, ssize_t sys_recvfile(int fromfd, int tofd, - SMB_OFF_T offset, + off_t offset, size_t count) { static int pipefd[2] = { -1, -1 }; @@ -230,7 +230,7 @@ ssize_t sys_recvfile(int fromfd, ssize_t sys_recvfile(int fromfd, int tofd, - SMB_OFF_T offset, + off_t offset, size_t count) { return default_sys_recvfile(fromfd, tofd, offset, count); diff --git a/source3/lib/sendfile.c b/source3/lib/sendfile.c index 50b522ed19..a9607fa825 100644 --- a/source3/lib/sendfile.c +++ b/source3/lib/sendfile.c @@ -33,7 +33,7 @@ #define MSG_MORE 0x8000 #endif -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { size_t total=0; ssize_t ret; @@ -103,7 +103,7 @@ extern int32 sendfile (int out_fd, int in_fd, int32 *offset, uint32 count); #define MSG_MORE 0x8000 #endif -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { size_t total=0; ssize_t ret; @@ -118,7 +118,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of * and uses a normal read. JRA. */ - if ((sizeof(SMB_OFF_T) >= 8) && (offset + count > (SMB_OFF_T)0x7FFFFFFF)) { + if ((sizeof(off_t) >= 8) && (offset + count > (off_t)0x7FFFFFFF)) { errno = ENOSYS; return -1; } @@ -184,7 +184,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #include -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { int sfvcnt; size_t total, xferred; @@ -270,7 +270,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #include #include -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { size_t total=0; struct iovec hdtrl[2]; @@ -341,7 +341,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #include #include -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { size_t total=0; struct sf_hdtr hdr; @@ -364,7 +364,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of total = count; while (total + hdtrl.iov_len) { - SMB_OFF_T nwritten; + off_t nwritten; int ret; /* @@ -418,7 +418,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of /* Contributed by William Jojo */ #include -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { struct sf_parms hdtrl; @@ -472,7 +472,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T of #else /* No sendfile implementation. Return error. */ -ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count) +ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset, size_t count) { /* No sendfile syscall. */ errno = ENOSYS; diff --git a/source3/lib/system.c b/source3/lib/system.c index 8a381732cd..8a0b0f154e 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -121,7 +121,7 @@ A pread wrapper that will deal with EINTR ********************************************************************/ #if defined(HAVE_PREAD) -ssize_t sys_pread(int fd, void *buf, size_t count, SMB_OFF_T off) +ssize_t sys_pread(int fd, void *buf, size_t count, off_t off) { ssize_t ret; @@ -137,7 +137,7 @@ A write wrapper that will deal with EINTR ********************************************************************/ #if defined(HAVE_PWRITE) -ssize_t sys_pwrite(int fd, const void *buf, size_t count, SMB_OFF_T off) +ssize_t sys_pwrite(int fd, const void *buf, size_t count, off_t off) { ssize_t ret; @@ -517,14 +517,14 @@ int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf, /******************************************************************* An posix_fallocate() wrapper. ********************************************************************/ -int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len) +int sys_posix_fallocate(int fd, off_t offset, off_t len) { #if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_BROKEN_POSIX_FALLOCATE) return posix_fallocate(fd, offset, len); #elif defined(F_RESVSP64) /* this handles XFS on IRIX */ struct flock64 fl; - SMB_OFF_T new_len = offset + len; + off_t new_len = offset + len; int ret; struct stat64 sbuf; @@ -559,7 +559,7 @@ int sys_posix_fallocate(int fd, SMB_OFF_T offset, SMB_OFF_T len) #include #endif -int sys_fallocate(int fd, enum vfs_fallocate_mode mode, SMB_OFF_T offset, SMB_OFF_T len) +int sys_fallocate(int fd, enum vfs_fallocate_mode mode, off_t offset, off_t len) { #if defined(HAVE_LINUX_FALLOCATE64) || defined(HAVE_LINUX_FALLOCATE) int lmode; diff --git a/source3/lib/util.c b/source3/lib/util.c index 22fc1e7abe..e43cfbbcb8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -320,12 +320,12 @@ char *clean_name(TALLOC_CTX *ctx, const char *s) Write data into an fd at a given offset. Ignore seek errors. ********************************************************************/ -ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos) +ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, off_t pos) { size_t total=0; ssize_t ret; - if (pos == (SMB_OFF_T)-1) { + if (pos == (off_t)-1) { return write_data(fd, buffer, N); } #if defined(HAVE_PWRITE) || defined(HAVE_PRWITE64) @@ -1213,7 +1213,7 @@ void set_namearray(name_compare_entry **ppname_array, const char *namelist_in) F_UNLCK in *ptype if the region is unlocked). False if the call failed. ****************************************************************************/ -bool fcntl_getlock(int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +bool fcntl_getlock(int fd, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { struct flock lock; int ret; diff --git a/source3/lib/util_transfer_file.c b/source3/lib/util_transfer_file.c index 8303b2bfe1..37a7d6e248 100644 --- a/source3/lib/util_transfer_file.c +++ b/source3/lib/util_transfer_file.c @@ -104,8 +104,8 @@ static ssize_t sys_write_fn(void *file, const void *buf, size_t len) return sys_write(*fd, buf, len); } -SMB_OFF_T transfer_file(int infd, int outfd, SMB_OFF_T n) +off_t transfer_file(int infd, int outfd, off_t n) { - return (SMB_OFF_T)transfer_file_internal(&infd, &outfd, (size_t)n, + return (off_t)transfer_file_internal(&infd, &outfd, (size_t)n, sys_read_fn, sys_write_fn); } diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 1a67bcdd98..38b95e2457 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -3238,7 +3238,7 @@ struct cli_getattrE_state { uint16_t vwv[1]; int zone_offset; uint16_t attr; - SMB_OFF_T size; + off_t size; time_t change_time; time_t access_time; time_t write_time; @@ -3288,7 +3288,7 @@ static void cli_getattrE_done(struct tevent_req *subreq) return; } - state->size = (SMB_OFF_T)IVAL(vwv+6,0); + state->size = (off_t)IVAL(vwv+6,0); state->attr = SVAL(vwv+10,0); state->change_time = make_unix_date2(vwv+0, state->zone_offset); state->access_time = make_unix_date2(vwv+2, state->zone_offset); @@ -3299,7 +3299,7 @@ static void cli_getattrE_done(struct tevent_req *subreq) NTSTATUS cli_getattrE_recv(struct tevent_req *req, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *change_time, time_t *access_time, time_t *write_time) @@ -3332,7 +3332,7 @@ NTSTATUS cli_getattrE_recv(struct tevent_req *req, NTSTATUS cli_getattrE(struct cli_state *cli, uint16_t fnum, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *change_time, time_t *access_time, time_t *write_time) @@ -3388,7 +3388,7 @@ static void cli_getatr_done(struct tevent_req *subreq); struct cli_getatr_state { int zone_offset; uint16_t attr; - SMB_OFF_T size; + off_t size; time_t write_time; }; @@ -3449,7 +3449,7 @@ static void cli_getatr_done(struct tevent_req *subreq) } state->attr = SVAL(vwv+0,0); - state->size = (SMB_OFF_T)IVAL(vwv+3,0); + state->size = (off_t)IVAL(vwv+3,0); state->write_time = make_unix_date3(vwv+1, state->zone_offset); tevent_req_done(req); @@ -3457,7 +3457,7 @@ static void cli_getatr_done(struct tevent_req *subreq) NTSTATUS cli_getatr_recv(struct tevent_req *req, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *write_time) { struct cli_getatr_state *state = tevent_req_data( @@ -3482,7 +3482,7 @@ NTSTATUS cli_getatr_recv(struct tevent_req *req, NTSTATUS cli_getatr(struct cli_state *cli, const char *fname, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *write_time) { TALLOC_CTX *frame = talloc_stackframe(); diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index b20d089382..2815243f2f 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -620,7 +620,7 @@ NTSTATUS cli_qpathinfo1_recv(struct tevent_req *req, time_t *change_time, time_t *access_time, time_t *write_time, - SMB_OFF_T *size, + off_t *size, uint16 *mode) { struct cli_qpathinfo1_state *state = tevent_req_data( @@ -662,7 +662,7 @@ NTSTATUS cli_qpathinfo1(struct cli_state *cli, time_t *change_time, time_t *access_time, time_t *write_time, - SMB_OFF_T *size, + off_t *size, uint16 *mode) { TALLOC_CTX *frame = talloc_stackframe(); @@ -797,7 +797,7 @@ NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req, struct timespec *access_time, struct timespec *write_time, struct timespec *change_time, - SMB_OFF_T *size, uint16 *mode, + off_t *size, uint16 *mode, SMB_INO_T *ino) { struct cli_qpathinfo2_state *state = tevent_req_data( @@ -837,7 +837,7 @@ NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname, struct timespec *access_time, struct timespec *write_time, struct timespec *change_time, - SMB_OFF_T *size, uint16 *mode, + off_t *size, uint16 *mode, SMB_INO_T *ino) { TALLOC_CTX *frame = talloc_stackframe(); @@ -1114,7 +1114,7 @@ NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, ****************************************************************************/ NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum, - uint16 *mode, SMB_OFF_T *size, + uint16 *mode, off_t *size, struct timespec *create_time, struct timespec *access_time, struct timespec *write_time, diff --git a/source3/libsmb/clirap.h b/source3/libsmb/clirap.h index de770dba7e..32f1b11e1b 100644 --- a/source3/libsmb/clirap.h +++ b/source3/libsmb/clirap.h @@ -49,14 +49,14 @@ NTSTATUS cli_qpathinfo1_recv(struct tevent_req *req, time_t *change_time, time_t *access_time, time_t *write_time, - SMB_OFF_T *size, + off_t *size, uint16 *mode); NTSTATUS cli_qpathinfo1(struct cli_state *cli, const char *fname, time_t *change_time, time_t *access_time, time_t *write_time, - SMB_OFF_T *size, + off_t *size, uint16 *mode); NTSTATUS cli_setpathinfo_basic(struct cli_state *cli, const char *fname, time_t create_time, @@ -73,14 +73,14 @@ NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req, struct timespec *access_time, struct timespec *write_time, struct timespec *change_time, - SMB_OFF_T *size, uint16 *mode, + off_t *size, uint16 *mode, SMB_INO_T *ino); NTSTATUS cli_qpathinfo2(struct cli_state *cli, const char *fname, struct timespec *create_time, struct timespec *access_time, struct timespec *write_time, struct timespec *change_time, - SMB_OFF_T *size, uint16 *mode, + off_t *size, uint16 *mode, SMB_INO_T *ino); struct tevent_req *cli_qpathinfo_streams_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -97,7 +97,7 @@ NTSTATUS cli_qpathinfo_streams(struct cli_state *cli, const char *fname, NTSTATUS cli_qfilename(struct cli_state *cli, uint16_t fnum, TALLOC_CTX *mem_ctx, char **name); NTSTATUS cli_qfileinfo_basic(struct cli_state *cli, uint16_t fnum, - uint16 *mode, SMB_OFF_T *size, + uint16 *mode, off_t *size, struct timespec *create_time, struct timespec *access_time, struct timespec *write_time, diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 8e845ee637..8f137c0e81 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -415,7 +415,7 @@ struct cli_pull_state { struct cli_state *cli; uint16_t fnum; off_t start_offset; - SMB_OFF_T size; + off_t size; NTSTATUS (*sink)(char *buf, size_t n, void *priv); void *priv; @@ -432,7 +432,7 @@ struct cli_pull_state { /* * For how many bytes did we send requests already? */ - SMB_OFF_T requested; + off_t requested; /* * Next request index to push into "sink". This walks around the "req" @@ -446,7 +446,7 @@ struct cli_pull_state { * How many bytes did we push into "sink"? */ - SMB_OFF_T pushed; + off_t pushed; }; static char *cli_pull_print(struct tevent_req *req, TALLOC_CTX *mem_ctx) @@ -475,7 +475,7 @@ struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_state *cli, uint16_t fnum, off_t start_offset, - SMB_OFF_T size, size_t window_size, + off_t size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, void *priv), void *priv) @@ -528,7 +528,7 @@ struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx, for (i=0; inum_reqs; i++) { struct cli_pull_subreq *subreq = &state->reqs[i]; - SMB_OFF_T size_left; + off_t size_left; size_t request_thistime; if (state->requested >= size) { @@ -629,7 +629,7 @@ static void cli_pull_read_done(struct tevent_req *subreq) if (state->requested < state->size) { struct tevent_req *new_req; - SMB_OFF_T size_left; + off_t size_left; size_t request_thistime; size_left = state->size - state->requested; @@ -664,7 +664,7 @@ static void cli_pull_read_done(struct tevent_req *subreq) tevent_req_done(req); } -NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received) +NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received) { struct cli_pull_state *state = tevent_req_data( req, struct cli_pull_state); @@ -678,9 +678,9 @@ NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received) } NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum, - off_t start_offset, SMB_OFF_T size, size_t window_size, + off_t start_offset, off_t size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, void *priv), - void *priv, SMB_OFF_T *received) + void *priv, off_t *received) { TALLOC_CTX *frame = talloc_stackframe(); struct event_context *ev; @@ -732,7 +732,7 @@ NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum, size_t *nread) { NTSTATUS status; - SMB_OFF_T ret; + off_t ret; status = cli_pull(cli, fnum, offset, size, size, cli_read_sink, &buf, &ret); diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index ef93dd064b..61d1a726da 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -1818,7 +1818,7 @@ SMBC_unlink_ctx(SMBCCTX *context, if (errno == EACCES) { /* Check if the file is a directory */ int saverr = errno; - SMB_OFF_T size = 0; + off_t size = 0; uint16 mode = 0; struct timespec write_time_ts; struct timespec access_time_ts; diff --git a/source3/libsmb/libsmb_file.c b/source3/libsmb/libsmb_file.c index b5932c8164..c09011bb0a 100644 --- a/source3/libsmb/libsmb_file.c +++ b/source3/libsmb/libsmb_file.c @@ -489,7 +489,7 @@ SMBC_getatr(SMBCCTX * context, SMBCSRV *srv, const char *path, uint16 *mode, - SMB_OFF_T *size, + off_t *size, struct timespec *create_time_ts, struct timespec *access_time_ts, struct timespec *write_time_ts, @@ -679,7 +679,7 @@ SMBC_lseek_ctx(SMBCCTX *context, off_t offset, int whence) { - SMB_OFF_T size; + off_t size; char *server = NULL, *share = NULL, *user = NULL, *password = NULL; char *path = NULL; char *targetpath = NULL; @@ -745,7 +745,7 @@ SMBC_lseek_ctx(SMBCCTX *context, targetcli, file->cli_fd, NULL, &size, NULL, NULL, NULL, NULL, NULL))) { - SMB_OFF_T b_size = size; + off_t b_size = size; if (!NT_STATUS_IS_OK(cli_getattrE(targetcli, file->cli_fd, NULL, &b_size, NULL, NULL, NULL))) { errno = EINVAL; @@ -775,7 +775,7 @@ SMBC_ftruncate_ctx(SMBCCTX *context, SMBCFILE *file, off_t length) { - SMB_OFF_T size = length; + off_t size = length; char *server = NULL; char *share = NULL; char *user = NULL; diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index 30b9291903..2a08b30d70 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -54,7 +54,7 @@ static int setup_stat(SMBCCTX *context, struct stat *st, const char *fname, - SMB_OFF_T size, + off_t size, int mode) { TALLOC_CTX *frame = talloc_stackframe(); @@ -118,7 +118,7 @@ SMBC_stat_ctx(SMBCCTX *context, struct timespec write_time_ts; struct timespec access_time_ts; struct timespec change_time_ts; - SMB_OFF_T size = 0; + off_t size = 0; uint16 mode = 0; SMB_INO_T ino = 0; TALLOC_CTX *frame = talloc_stackframe(); @@ -204,7 +204,7 @@ SMBC_fstat_ctx(SMBCCTX *context, struct timespec change_time_ts; struct timespec access_time_ts; struct timespec write_time_ts; - SMB_OFF_T size; + off_t size; uint16 mode; char *server = NULL; char *share = NULL; diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c index 5ed38415bf..199f225975 100644 --- a/source3/libsmb/libsmb_xattr.c +++ b/source3/libsmb/libsmb_xattr.c @@ -556,7 +556,7 @@ dos_attr_query(SMBCCTX *context, struct timespec write_time_ts; struct timespec access_time_ts; struct timespec change_time_ts; - SMB_OFF_T size = 0; + off_t size = 0; uint16 mode = 0; SMB_INO_T inode = 0; DOS_ATTR_DESC *ret; @@ -651,7 +651,7 @@ dos_attr_parse(SMBCCTX *context, } if (strncasecmp_m(tok, "SIZE:", 5) == 0) { - dad->size = (SMB_OFF_T)atof(tok+5); + dad->size = (off_t)atof(tok+5); continue; } @@ -743,7 +743,7 @@ cacl_get(SMBCCTX *context, time_t write_time = (time_t)0; time_t access_time = (time_t)0; time_t change_time = (time_t)0; - SMB_OFF_T size = 0; + off_t size = 0; uint16 mode = 0; SMB_INO_T ino = 0; struct cli_state *cli = srv->cli; diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h index 336c95f07c..735c36aeb6 100644 --- a/source3/libsmb/proto.h +++ b/source3/libsmb/proto.h @@ -465,14 +465,14 @@ struct tevent_req *cli_getattrE_send(TALLOC_CTX *mem_ctx, uint16_t fnum); NTSTATUS cli_getattrE_recv(struct tevent_req *req, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *change_time, time_t *access_time, time_t *write_time); NTSTATUS cli_getattrE(struct cli_state *cli, uint16_t fnum, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *change_time, time_t *access_time, time_t *write_time); @@ -495,12 +495,12 @@ struct tevent_req *cli_getatr_send(TALLOC_CTX *mem_ctx, const char *fname); NTSTATUS cli_getatr_recv(struct tevent_req *req, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *write_time); NTSTATUS cli_getatr(struct cli_state *cli, const char *fname, uint16_t *attr, - SMB_OFF_T *size, + off_t *size, time_t *write_time); struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx, struct event_context *ev, @@ -765,15 +765,15 @@ struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_state *cli, uint16_t fnum, off_t start_offset, - SMB_OFF_T size, size_t window_size, + off_t size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, void *priv), void *priv); -NTSTATUS cli_pull_recv(struct tevent_req *req, SMB_OFF_T *received); +NTSTATUS cli_pull_recv(struct tevent_req *req, off_t *received); NTSTATUS cli_pull(struct cli_state *cli, uint16_t fnum, - off_t start_offset, SMB_OFF_T size, size_t window_size, + off_t start_offset, off_t size, size_t window_size, NTSTATUS (*sink)(char *buf, size_t n, void *priv), - void *priv, SMB_OFF_T *received); + void *priv, off_t *received); NTSTATUS cli_read(struct cli_state *cli, uint16_t fnum, char *buf, off_t offset, size_t size, size_t *nread); diff --git a/source3/locking/posix.c b/source3/locking/posix.c index b219c75fb3..463aa21fd8 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -83,29 +83,29 @@ static const char *posix_lock_type_name(int lock_type) False if not. ****************************************************************************/ -static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, +static bool posix_lock_in_range(off_t *offset_out, off_t *count_out, uint64_t u_offset, uint64_t u_count) { - SMB_OFF_T offset = (SMB_OFF_T)u_offset; - SMB_OFF_T count = (SMB_OFF_T)u_count; + off_t offset = (off_t)u_offset; + off_t count = (off_t)u_count; /* * For the type of system we are, attempt to - * find the maximum positive lock offset as an SMB_OFF_T. + * find the maximum positive lock offset as an off_t. */ #if defined(MAX_POSITIVE_LOCK_OFFSET) /* Some systems have arbitrary limits. */ - SMB_OFF_T max_positive_lock_offset = (MAX_POSITIVE_LOCK_OFFSET); + off_t max_positive_lock_offset = (MAX_POSITIVE_LOCK_OFFSET); #else /* - * In this case SMB_OFF_T is 64 bits, + * In this case off_t is 64 bits, * and the underlying system can handle 64 bit signed locks. */ - SMB_OFF_T mask2 = ((SMB_OFF_T)0x4) << (SMB_OFF_T_BITS-4); - SMB_OFF_T mask = (mask2<<1); - SMB_OFF_T max_positive_lock_offset = ~mask; + off_t mask2 = ((off_t)0x4) << (SMB_OFF_T_BITS-4); + off_t mask = (mask2<<1); + off_t max_positive_lock_offset = ~mask; #endif /* @@ -114,7 +114,7 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, * any Win32 locks of length zero. JRA. */ - if (count == (SMB_OFF_T)0) { + if (count == (off_t)0) { DEBUG(10,("posix_lock_in_range: count = 0, ignoring.\n")); return False; } @@ -170,8 +170,8 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out, } bool smb_vfs_call_lock(struct vfs_handle_struct *handle, - struct files_struct *fsp, int op, SMB_OFF_T offset, - SMB_OFF_T count, int type) + struct files_struct *fsp, int op, off_t offset, + off_t count, int type) { VFS_FIND(lock); return handle->fns->lock_fn(handle, fsp, op, offset, count, type); @@ -182,7 +182,7 @@ bool smb_vfs_call_lock(struct vfs_handle_struct *handle, broken NFS implementations. ****************************************************************************/ -static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool posix_fcntl_lock(files_struct *fsp, int op, off_t offset, off_t count, int type) { bool ret; @@ -202,12 +202,12 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF * 32 bit NFS mounted filesystems. Just ignore it. */ - if (offset & ~((SMB_OFF_T)0x7fffffff)) { + if (offset & ~((off_t)0x7fffffff)) { DEBUG(0,("Offset greater than 31 bits. Returning success.\n")); return True; } - if (count & ~((SMB_OFF_T)0x7fffffff)) { + if (count & ~((off_t)0x7fffffff)) { /* 32 bit NFS file system, retry with smaller offset */ DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n")); errno = 0; @@ -221,8 +221,8 @@ static bool posix_fcntl_lock(files_struct *fsp, int op, SMB_OFF_T offset, SMB_OF } bool smb_vfs_call_getlock(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T *poffset, - SMB_OFF_T *pcount, int *ptype, pid_t *ppid) + struct files_struct *fsp, off_t *poffset, + off_t *pcount, int *ptype, pid_t *ppid) { VFS_FIND(getlock); return handle->fns->getlock_fn(handle, fsp, poffset, pcount, ptype, @@ -234,7 +234,7 @@ bool smb_vfs_call_getlock(struct vfs_handle_struct *handle, broken NFS implementations. ****************************************************************************/ -static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype) +static bool posix_fcntl_getlock(files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype) { pid_t pid; bool ret; @@ -256,12 +256,12 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T * 32 bit NFS mounted filesystems. Just ignore it. */ - if (*poffset & ~((SMB_OFF_T)0x7fffffff)) { + if (*poffset & ~((off_t)0x7fffffff)) { DEBUG(0,("Offset greater than 31 bits. Returning success.\n")); return True; } - if (*pcount & ~((SMB_OFF_T)0x7fffffff)) { + if (*pcount & ~((off_t)0x7fffffff)) { /* 32 bit NFS file system, retry with smaller offset */ DEBUG(0,("Count greater than 31 bits - retrying with 31 bit truncated length.\n")); errno = 0; @@ -285,8 +285,8 @@ bool is_posix_locked(files_struct *fsp, enum brl_type *plock_type, enum brl_flavour lock_flav) { - SMB_OFF_T offset; - SMB_OFF_T count; + off_t offset; + off_t count; int posix_lock_type = map_posix_lock_type(fsp,*plock_type); DEBUG(10,("is_posix_locked: File %s, offset = %.0f, count = %.0f, " @@ -735,8 +735,8 @@ int fd_close_posix(struct files_struct *fsp) struct lock_list { struct lock_list *next; struct lock_list *prev; - SMB_OFF_T start; - SMB_OFF_T size; + off_t start; + off_t size; }; /**************************************************************************** @@ -973,8 +973,8 @@ bool set_posix_lock_windows_flavour(files_struct *fsp, int num_locks, int *errno_ret) { - SMB_OFF_T offset; - SMB_OFF_T count; + off_t offset; + off_t count; int posix_lock_type = map_posix_lock_type(fsp,lock_type); bool ret = True; size_t lock_count; @@ -1111,8 +1111,8 @@ bool release_posix_lock_windows_flavour(files_struct *fsp, const struct lock_struct *plocks, int num_locks) { - SMB_OFF_T offset; - SMB_OFF_T count; + off_t offset; + off_t count; bool ret = True; TALLOC_CTX *ul_ctx = NULL; struct lock_list *ulist = NULL; @@ -1233,8 +1233,8 @@ bool set_posix_lock_posix_flavour(files_struct *fsp, enum brl_type lock_type, int *errno_ret) { - SMB_OFF_T offset; - SMB_OFF_T count; + off_t offset; + off_t count; int posix_lock_type = map_posix_lock_type(fsp,lock_type); DEBUG(5,("set_posix_lock_posix_flavour: File %s, offset = %.0f, count " @@ -1277,8 +1277,8 @@ bool release_posix_lock_posix_flavour(files_struct *fsp, int num_locks) { bool ret = True; - SMB_OFF_T offset; - SMB_OFF_T count; + off_t offset; + off_t count; TALLOC_CTX *ul_ctx = NULL; struct lock_list *ulist = NULL; struct lock_list *ul = NULL; diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h index 1f72a9f207..b12a67e367 100644 --- a/source3/modules/onefs.h +++ b/source3/modules/onefs.h @@ -163,10 +163,10 @@ int onefs_sys_create_file(connection_struct *conn, int *granted_oplock); ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd, - const DATA_BLOB *header, SMB_OFF_T offset, + const DATA_BLOB *header, off_t offset, size_t count); -ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset, +ssize_t onefs_sys_recvfile(int fromfd, int tofd, off_t offset, size_t count); void init_stat_ex_from_onefs_stat(struct stat_ex *dst, const struct stat *src); diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c index c79619922c..0a1d98c809 100644 --- a/source3/modules/onefs_streams.c +++ b/source3/modules/onefs_streams.c @@ -547,8 +547,8 @@ struct streaminfo_state { static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams, - const char *name, SMB_OFF_T size, - SMB_OFF_T alloc_size) + const char *name, off_t size, + off_t alloc_size) { struct stream_struct *tmp; diff --git a/source3/modules/onefs_system.c b/source3/modules/onefs_system.c index 05b033181e..07272cc86b 100644 --- a/source3/modules/onefs_system.c +++ b/source3/modules/onefs_system.c @@ -230,7 +230,7 @@ int onefs_sys_create_file(connection_struct *conn, * FreeBSD based sendfile implementation that allows for atomic semantics. */ static ssize_t onefs_sys_do_sendfile(int tofd, int fromfd, - const DATA_BLOB *header, SMB_OFF_T offset, size_t count, bool atomic) + const DATA_BLOB *header, off_t offset, size_t count, bool atomic) { size_t total=0; struct sf_hdtr hdr; @@ -258,7 +258,7 @@ static ssize_t onefs_sys_do_sendfile(int tofd, int fromfd, total = count; while (total + hdtrl.iov_len) { - SMB_OFF_T nwritten; + off_t nwritten; int ret; /* @@ -330,7 +330,7 @@ static ssize_t onefs_sys_do_sendfile(int tofd, int fromfd, * Handles the subtleties of using sendfile with CIFS. */ ssize_t onefs_sys_sendfile(connection_struct *conn, int tofd, int fromfd, - const DATA_BLOB *header, SMB_OFF_T offset, + const DATA_BLOB *header, off_t offset, size_t count) { bool atomic = false; @@ -536,7 +536,7 @@ static char *get_spill_buffer(size_t new_count) * from the socket into the buffer, the spill buffer is then written with a * standard pwrite. */ -ssize_t onefs_sys_recvfile(int fromfd, int tofd, SMB_OFF_T offset, +ssize_t onefs_sys_recvfile(int fromfd, int tofd, off_t offset, size_t count) { char *spill_buffer = NULL; diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index fa3db933a3..0d928cb522 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -78,7 +78,7 @@ fail: struct rw_cmd { size_t n; - SMB_OFF_T offset; + off_t offset; bool read_cmd; }; diff --git a/source3/modules/vfs_cacheprime.c b/source3/modules/vfs_cacheprime.c index bd11797f6b..65e63e2b39 100644 --- a/source3/modules/vfs_cacheprime.c +++ b/source3/modules/vfs_cacheprime.c @@ -49,13 +49,13 @@ static void * g_readbuf = NULL; static bool prime_cache( struct vfs_handle_struct * handle, files_struct * fsp, - SMB_OFF_T offset, + off_t offset, size_t count) { - SMB_OFF_T * last; + off_t * last; ssize_t nread; - last = (SMB_OFF_T *)VFS_ADD_FSP_EXTENSION(handle, fsp, SMB_OFF_T, NULL); + last = (off_t *)VFS_ADD_FSP_EXTENSION(handle, fsp, off_t, NULL); if (!last) { return False; } @@ -134,7 +134,7 @@ static ssize_t cprime_sendfile( int tofd, files_struct * fromfsp, const DATA_BLOB * header, - SMB_OFF_T offset, + off_t offset, size_t count) { if (g_readbuf && offset == 0) { @@ -151,7 +151,7 @@ static ssize_t cprime_read( void * data, size_t count) { - SMB_OFF_T offset; + off_t offset; offset = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); if (offset >= 0 && g_readbuf) { @@ -167,7 +167,7 @@ static ssize_t cprime_pread( files_struct * fsp, void * data, size_t count, - SMB_OFF_T offset) + off_t offset) { if (g_readbuf) { prime_cache(handle, fsp, offset, count); diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index af1f98b20f..865250a5d8 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -68,11 +68,11 @@ enum eof_mode struct commit_info { /* For chunk-based commits */ - SMB_OFF_T dbytes; /* Dirty (uncommitted) bytes */ - SMB_OFF_T dthresh; /* Dirty data threshold */ + off_t dbytes; /* Dirty (uncommitted) bytes */ + off_t dthresh; /* Dirty data threshold */ /* For commits on EOF */ enum eof_mode on_eof; - SMB_OFF_T eof; /* Expected file size */ + off_t eof; /* Expected file size */ }; static int commit_do( @@ -121,7 +121,7 @@ static int commit_all( static int commit( struct vfs_handle_struct * handle, files_struct * fsp, - SMB_OFF_T offset, + off_t offset, ssize_t last_write) { struct commit_info *c; @@ -183,7 +183,7 @@ static int commit_open( int flags, mode_t mode) { - SMB_OFF_T dthresh; + off_t dthresh; const char *eof_mode; struct commit_info *c = NULL; int fd; @@ -261,7 +261,7 @@ static ssize_t commit_pwrite( files_struct * fsp, const void * data, size_t count, - SMB_OFF_T offset) + off_t offset) { ssize_t ret; @@ -287,7 +287,7 @@ static int commit_close( static int commit_ftruncate( vfs_handle_struct * handle, files_struct * fsp, - SMB_OFF_T len) + off_t len) { int result; diff --git a/source3/modules/vfs_crossrename.c b/source3/modules/vfs_crossrename.c index a38ae45948..19a182c453 100644 --- a/source3/modules/vfs_crossrename.c +++ b/source3/modules/vfs_crossrename.c @@ -22,7 +22,7 @@ #include "smbprofile.h" #define MODULE "crossrename" -static SMB_OFF_T module_sizelimit; +static off_t module_sizelimit; static int crossrename_connect( struct vfs_handle_struct * handle, @@ -35,7 +35,7 @@ static int crossrename_connect( return ret; } - module_sizelimit = (SMB_OFF_T) lp_parm_int(SNUM(handle->conn), + module_sizelimit = (off_t) lp_parm_int(SNUM(handle->conn), MODULE, "sizelimit", 20); /* convert from MiB to byte: */ module_sizelimit *= 1048576; diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 9704f5edbb..cf2bdb05c5 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -534,7 +534,7 @@ static ssize_t vfswrap_read(vfs_handle_struct *handle, files_struct *fsp, void * } static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, - size_t n, SMB_OFF_T offset) + size_t n, off_t offset) { ssize_t result; @@ -550,7 +550,7 @@ static ssize_t vfswrap_pread(vfs_handle_struct *handle, files_struct *fsp, void } #else /* HAVE_PREAD */ - SMB_OFF_T curr; + off_t curr; int lerrno; curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); @@ -588,7 +588,7 @@ static ssize_t vfswrap_write(vfs_handle_struct *handle, files_struct *fsp, const } static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, - size_t n, SMB_OFF_T offset) + size_t n, off_t offset) { ssize_t result; @@ -603,7 +603,7 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons } #else /* HAVE_PWRITE */ - SMB_OFF_T curr; + off_t curr; int lerrno; curr = SMB_VFS_LSEEK(fsp, 0, SEEK_CUR); @@ -626,9 +626,9 @@ static ssize_t vfswrap_pwrite(vfs_handle_struct *handle, files_struct *fsp, cons return result; } -static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T offset, int whence) +static off_t vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, off_t offset, int whence) { - SMB_OFF_T result = 0; + off_t result = 0; START_PROFILE(syscall_lseek); @@ -653,7 +653,7 @@ static SMB_OFF_T vfswrap_lseek(vfs_handle_struct *handle, files_struct *fsp, SMB } static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, - SMB_OFF_T offset, size_t n) + off_t offset, size_t n) { ssize_t result; @@ -666,7 +666,7 @@ static ssize_t vfswrap_sendfile(vfs_handle_struct *handle, int tofd, files_struc static ssize_t vfswrap_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, - SMB_OFF_T offset, + off_t offset, size_t n) { ssize_t result; @@ -1361,9 +1361,9 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, allocate is set. **********************************************************************/ -static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len) +static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t len) { - SMB_OFF_T space_to_write; + off_t space_to_write; uint64_t space_avail; uint64_t bsize,dfree,dsize; int ret; @@ -1428,7 +1428,7 @@ static int strict_allocate_ftruncate(vfs_handle_struct *handle, files_struct *fs return 0; } -static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T len) +static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, off_t len) { int result = -1; SMB_STRUCT_STAT *pst; @@ -1499,8 +1499,8 @@ static int vfswrap_ftruncate(vfs_handle_struct *handle, files_struct *fsp, SMB_O static int vfswrap_fallocate(vfs_handle_struct *handle, files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { int result; @@ -1517,7 +1517,7 @@ static int vfswrap_fallocate(vfs_handle_struct *handle, return result; } -static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) +static bool vfswrap_lock(vfs_handle_struct *handle, files_struct *fsp, int op, off_t offset, off_t count, int type) { bool result; @@ -1536,7 +1536,7 @@ static int vfswrap_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, return 0; } -static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) +static bool vfswrap_getlock(vfs_handle_struct *handle, files_struct *fsp, off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { bool result; diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 4457860d2e..de4f7996bf 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -952,7 +952,7 @@ static ssize_t smb_full_audit_read(vfs_handle_struct *handle, files_struct *fsp, } static ssize_t smb_full_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - void *data, size_t n, SMB_OFF_T offset) + void *data, size_t n, off_t offset) { ssize_t result; @@ -979,7 +979,7 @@ static ssize_t smb_full_audit_write(vfs_handle_struct *handle, files_struct *fsp static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, - SMB_OFF_T offset) + off_t offset) { ssize_t result; @@ -991,8 +991,8 @@ static ssize_t smb_full_audit_pwrite(vfs_handle_struct *handle, files_struct *fs return result; } -static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T offset, int whence) +static off_t smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, + off_t offset, int whence) { ssize_t result; @@ -1006,7 +1006,7 @@ static SMB_OFF_T smb_full_audit_lseek(vfs_handle_struct *handle, files_struct *f static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, - const DATA_BLOB *hdr, SMB_OFF_T offset, + const DATA_BLOB *hdr, off_t offset, size_t n) { ssize_t result; @@ -1021,7 +1021,7 @@ static ssize_t smb_full_audit_sendfile(vfs_handle_struct *handle, int tofd, static ssize_t smb_full_audit_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, - SMB_OFF_T offset, + off_t offset, size_t n) { ssize_t result; @@ -1229,7 +1229,7 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle, } static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T len) + off_t len) { int result; @@ -1243,8 +1243,8 @@ static int smb_full_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { int result; @@ -1257,7 +1257,7 @@ static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp } static bool smb_full_audit_lock(vfs_handle_struct *handle, files_struct *fsp, - int op, SMB_OFF_T offset, SMB_OFF_T count, int type) + int op, off_t offset, off_t count, int type) { bool result; @@ -1296,7 +1296,7 @@ static int smb_full_audit_linux_setlease(vfs_handle_struct *handle, files_struct } static bool smb_full_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid) + off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { bool result; diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index fce1b28c64..80f6d6e653 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -1261,7 +1261,7 @@ static int vfs_gpfs_ntimes(struct vfs_handle_struct *handle, static int vfs_gpfs_fallocate(struct vfs_handle_struct *handle, struct files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, SMB_OFF_T len) + off_t offset, off_t len) { int ret; struct gpfs_config_data *config; @@ -1296,7 +1296,7 @@ static int vfs_gpfs_fallocate(struct vfs_handle_struct *handle, } static int vfs_gpfs_ftruncate(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T len) + off_t len) { int result; struct gpfs_config_data *config; @@ -1368,7 +1368,7 @@ static bool vfs_gpfs_aio_force(struct vfs_handle_struct *handle, static ssize_t vfs_gpfs_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr, - SMB_OFF_T offset, size_t n) + off_t offset, size_t n) { if ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0) { errno = ENOSYS; diff --git a/source3/modules/vfs_gpfs_hsm_notify.c b/source3/modules/vfs_gpfs_hsm_notify.c index 7ff5355c95..d53363c460 100644 --- a/source3/modules/vfs_gpfs_hsm_notify.c +++ b/source3/modules/vfs_gpfs_hsm_notify.c @@ -34,7 +34,7 @@ #include "vfs_gpfs.h" static ssize_t vfs_gpfs_hsm_notify_pread(vfs_handle_struct *handle, files_struct *fsp, - void *data, size_t n, SMB_OFF_T offset) + void *data, size_t n, off_t offset) { ssize_t ret; @@ -56,7 +56,7 @@ static ssize_t vfs_gpfs_hsm_notify_pread(vfs_handle_struct *handle, files_struct static ssize_t vfs_gpfs_hsm_notify_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, - const void *data, size_t n, SMB_OFF_T offset) + const void *data, size_t n, off_t offset) { ssize_t ret; diff --git a/source3/modules/vfs_onefs.c b/source3/modules/vfs_onefs.c index 5866eb49c8..619e3874a3 100644 --- a/source3/modules/vfs_onefs.c +++ b/source3/modules/vfs_onefs.c @@ -64,7 +64,7 @@ static int onefs_open(vfs_handle_struct *handle, static ssize_t onefs_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, - SMB_OFF_T offset, size_t count) + off_t offset, size_t count) { ssize_t result; @@ -76,7 +76,7 @@ static ssize_t onefs_sendfile(vfs_handle_struct *handle, int tofd, } static ssize_t onefs_recvfile(vfs_handle_struct *handle, int fromfd, - files_struct *tofsp, SMB_OFF_T offset, + files_struct *tofsp, off_t offset, size_t count) { ssize_t result; diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c index 15be7d121b..f67cefbe2f 100644 --- a/source3/modules/vfs_prealloc.c +++ b/source3/modules/vfs_prealloc.c @@ -56,7 +56,7 @@ #define MODULE "prealloc" static int module_debug; -static int preallocate_space(int fd, SMB_OFF_T size) +static int preallocate_space(int fd, off_t size) { int err; #ifndef HAVE_GPFS @@ -170,9 +170,9 @@ static int prealloc_open(vfs_handle_struct* handle, * truncate calls specially. */ if ((flags & O_CREAT) || (flags & O_TRUNC)) { - SMB_OFF_T * psize; + off_t * psize; - psize = VFS_ADD_FSP_EXTENSION(handle, fsp, SMB_OFF_T, NULL); + psize = VFS_ADD_FSP_EXTENSION(handle, fsp, off_t, NULL); if (psize == NULL || *psize == -1) { return fd; } @@ -201,9 +201,9 @@ normal_open: static int prealloc_ftruncate(vfs_handle_struct * handle, files_struct * fsp, - SMB_OFF_T offset) + off_t offset) { - SMB_OFF_T *psize; + off_t *psize; int ret = SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset); /* Maintain the allocated space even in the face of truncates. */ diff --git a/source3/modules/vfs_readahead.c b/source3/modules/vfs_readahead.c index b48d95faa9..8cb85c7561 100644 --- a/source3/modules/vfs_readahead.c +++ b/source3/modules/vfs_readahead.c @@ -24,8 +24,8 @@ ssize_t readahead(int fd, off_t offset, size_t count); #endif struct readahead_data { - SMB_OFF_T off_bound; - SMB_OFF_T len; + off_t off_bound; + off_t len; bool didmsg; }; @@ -43,7 +43,7 @@ static ssize_t readahead_sendfile(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, - SMB_OFF_T offset, + off_t offset, size_t count) { struct readahead_data *rhd = (struct readahead_data *)handle->data; @@ -86,7 +86,7 @@ static ssize_t readahead_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, size_t count, - SMB_OFF_T offset) + off_t offset) { struct readahead_data *rhd = (struct readahead_data *)handle->data; diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index 80332523ed..37d930f793 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -126,9 +126,9 @@ static const char **recycle_noversions(vfs_handle_struct *handle) return tmp_lp; } -static SMB_OFF_T recycle_maxsize(vfs_handle_struct *handle) +static off_t recycle_maxsize(vfs_handle_struct *handle) { - SMB_OFF_T maxsize; + off_t maxsize; maxsize = conv_str_size(lp_parm_const_string(SNUM(handle->conn), "recycle", "maxsize", NULL)); @@ -138,9 +138,9 @@ static SMB_OFF_T recycle_maxsize(vfs_handle_struct *handle) return maxsize; } -static SMB_OFF_T recycle_minsize(vfs_handle_struct *handle) +static off_t recycle_minsize(vfs_handle_struct *handle) { - SMB_OFF_T minsize; + off_t minsize; minsize = conv_str_size(lp_parm_const_string(SNUM(handle->conn), "recycle", "minsize", NULL)); @@ -225,23 +225,23 @@ static bool recycle_file_exist(vfs_handle_struct *handle, * @param fname file name * @return size in bytes **/ -static SMB_OFF_T recycle_get_file_size(vfs_handle_struct *handle, +static off_t recycle_get_file_size(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { struct smb_filename *smb_fname_tmp = NULL; NTSTATUS status; - SMB_OFF_T size; + off_t size; status = copy_smb_filename(talloc_tos(), smb_fname, &smb_fname_tmp); if (!NT_STATUS_IS_OK(status)) { - size = (SMB_OFF_T)0; + size = (off_t)0; goto out; } if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) != 0) { DEBUG(0,("recycle: stat for %s returned %s\n", smb_fname_str_dbg(smb_fname_tmp), strerror(errno))); - size = (SMB_OFF_T)0; + size = (off_t)0; goto out; } @@ -442,8 +442,8 @@ static int recycle_unlink(vfs_handle_struct *handle, const char *base; char *repository = NULL; int i = 1; - SMB_OFF_T maxsize, minsize; - SMB_OFF_T file_size; /* space_avail; */ + off_t maxsize, minsize; + off_t file_size; /* space_avail; */ bool exist; NTSTATUS status; int rc = -1; diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c index 025fbbda90..c728e7d5e9 100644 --- a/source3/modules/vfs_smb_traffic_analyzer.c +++ b/source3/modules/vfs_smb_traffic_analyzer.c @@ -769,7 +769,7 @@ static ssize_t smb_traffic_analyzer_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *hdr, - SMB_OFF_T offset, + off_t offset, size_t n) { struct rw_data s_data; @@ -787,7 +787,7 @@ static ssize_t smb_traffic_analyzer_sendfile(vfs_handle_struct *handle, static ssize_t smb_traffic_analyzer_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, - SMB_OFF_T offset, + off_t offset, size_t n) { struct rw_data s_data; @@ -820,7 +820,7 @@ static ssize_t smb_traffic_analyzer_read(vfs_handle_struct *handle, \ static ssize_t smb_traffic_analyzer_pread(vfs_handle_struct *handle, \ - files_struct *fsp, void *data, size_t n, SMB_OFF_T offset) + files_struct *fsp, void *data, size_t n, off_t offset) { struct rw_data s_data; @@ -853,7 +853,7 @@ static ssize_t smb_traffic_analyzer_write(vfs_handle_struct *handle, \ } static ssize_t smb_traffic_analyzer_pwrite(vfs_handle_struct *handle, \ - files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset) + files_struct *fsp, const void *data, size_t n, off_t offset) { struct rw_data s_data; diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index 172a0c634d..f984f75e9f 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -748,8 +748,8 @@ done: static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams, - const char *name, SMB_OFF_T size, - SMB_OFF_T alloc_size) + const char *name, off_t size, + off_t alloc_size) { struct stream_struct *tmp; diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 2ac0491f28..291531e59a 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -726,8 +726,8 @@ static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp, static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, struct stream_struct **streams, - const char *name, SMB_OFF_T size, - SMB_OFF_T alloc_size) + const char *name, off_t size, + off_t alloc_size) { struct stream_struct *tmp; @@ -843,7 +843,7 @@ static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle, static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, - size_t n, SMB_OFF_T offset) + size_t n, off_t offset) { struct stream_io *sio = (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); @@ -906,7 +906,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, static ssize_t streams_xattr_pread(vfs_handle_struct *handle, files_struct *fsp, void *data, - size_t n, SMB_OFF_T offset) + size_t n, off_t offset) { struct stream_io *sio = (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); @@ -950,7 +950,7 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle, static int streams_xattr_ftruncate(struct vfs_handle_struct *handle, struct files_struct *fsp, - SMB_OFF_T offset) + off_t offset) { int ret; uint8 *tmp; @@ -1018,8 +1018,8 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle, static int streams_xattr_fallocate(struct vfs_handle_struct *handle, struct files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { struct stream_io *sio = (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index ac96893cc4..a5ca407673 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -501,7 +501,7 @@ static ssize_t smb_time_audit_read(vfs_handle_struct *handle, static ssize_t smb_time_audit_pread(vfs_handle_struct *handle, files_struct *fsp, - void *data, size_t n, SMB_OFF_T offset) + void *data, size_t n, off_t offset) { ssize_t result; struct timespec ts1,ts2; @@ -542,7 +542,7 @@ static ssize_t smb_time_audit_write(vfs_handle_struct *handle, static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle, files_struct *fsp, const void *data, size_t n, - SMB_OFF_T offset) + off_t offset) { ssize_t result; struct timespec ts1,ts2; @@ -560,11 +560,11 @@ static ssize_t smb_time_audit_pwrite(vfs_handle_struct *handle, return result; } -static SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle, +static off_t smb_time_audit_lseek(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T offset, int whence) + off_t offset, int whence) { - SMB_OFF_T result; + off_t result; struct timespec ts1,ts2; double timediff; @@ -582,7 +582,7 @@ static SMB_OFF_T smb_time_audit_lseek(vfs_handle_struct *handle, static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fromfsp, - const DATA_BLOB *hdr, SMB_OFF_T offset, + const DATA_BLOB *hdr, off_t offset, size_t n) { ssize_t result; @@ -603,7 +603,7 @@ static ssize_t smb_time_audit_sendfile(vfs_handle_struct *handle, int tofd, static ssize_t smb_time_audit_recvfile(vfs_handle_struct *handle, int fromfd, files_struct *tofsp, - SMB_OFF_T offset, + off_t offset, size_t n) { ssize_t result; @@ -909,7 +909,7 @@ static int smb_time_audit_ntimes(vfs_handle_struct *handle, static int smb_time_audit_ftruncate(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T len) + off_t len) { int result; struct timespec ts1,ts2; @@ -930,8 +930,8 @@ static int smb_time_audit_ftruncate(vfs_handle_struct *handle, static int smb_time_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { int result; struct timespec ts1,ts2; @@ -950,7 +950,7 @@ static int smb_time_audit_fallocate(vfs_handle_struct *handle, } static bool smb_time_audit_lock(vfs_handle_struct *handle, files_struct *fsp, - int op, SMB_OFF_T offset, SMB_OFF_T count, + int op, off_t offset, off_t count, int type) { bool result; @@ -1012,7 +1012,7 @@ static int smb_time_audit_linux_setlease(vfs_handle_struct *handle, static bool smb_time_audit_getlock(vfs_handle_struct *handle, files_struct *fsp, - SMB_OFF_T *poffset, SMB_OFF_T *pcount, + off_t *poffset, off_t *pcount, int *ptype, pid_t *ppid) { bool result; diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index d7cc050024..8b138d385c 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -298,7 +298,7 @@ static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_s } static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr, - SMB_OFF_T offset, size_t n) + off_t offset, size_t n) { bool file_offline = tsmsm_aio_force(handle, fsp); @@ -314,7 +314,7 @@ static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct /* We do overload pread to allow notification when file becomes online after offline status */ /* We don't intercept SMB_VFS_READ here because all file I/O now goes through SMB_VFS_PREAD instead */ static ssize_t tsmsm_pread(struct vfs_handle_struct *handle, struct files_struct *fsp, - void *data, size_t n, SMB_OFF_T offset) { + void *data, size_t n, off_t offset) { ssize_t result; bool notify_online = tsmsm_aio_force(handle, fsp); @@ -332,7 +332,7 @@ static ssize_t tsmsm_pread(struct vfs_handle_struct *handle, struct files_struct } static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, - const void *data, size_t n, SMB_OFF_T offset) { + const void *data, size_t n, off_t offset) { ssize_t result; bool notify_online = tsmsm_aio_force(handle, fsp); diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 9146ed281c..99b275de40 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -642,7 +642,7 @@ static NTSTATUS add_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, int fd; size_t new_entry_length; char *new_entry; - SMB_OFF_T offpos; + off_t offpos; /* Open the smbpassword file - for update. */ fp = startsmbfilepwent(pfile, PWF_UPDATE, &smbpasswd_state->pw_file_lock_depth); @@ -750,7 +750,7 @@ static bool mod_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con bool found_entry = False; bool got_pass_last_set_time = False; - SMB_OFF_T pwd_seekpos = 0; + off_t pwd_seekpos = 0; int i; int wr_len; diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 92aa320b71..96947f199b 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -199,7 +199,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 } /* Skip OEM header (if any) and the DOS stub to start of Windows header */ - if (SMB_VFS_LSEEK(fsp, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (SMB_OFF_T)-1) { + if (SMB_VFS_LSEEK(fsp, SVAL(buf,DOS_HEADER_LFANEW_OFFSET), SEEK_SET) == (off_t)-1) { DEBUG(3,("get_file_version: File [%s] too short, errno = %d\n", fname, errno)); /* Assume this isn't an error... the file just looks sort of like a PE/NE file */ @@ -222,7 +222,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 /* Just skip over optional header to get to section table */ if (SMB_VFS_LSEEK(fsp, SVAL(buf,PE_HEADER_OPTIONAL_HEADER_SIZE)-(NE_HEADER_SIZE-PE_HEADER_SIZE), - SEEK_CUR) == (SMB_OFF_T)-1) { + SEEK_CUR) == (off_t)-1) { DEBUG(3,("get_file_version: File [%s] Windows optional header too short, errno = %d\n", fname, errno)); goto error_exit; @@ -266,7 +266,7 @@ static int get_file_version(files_struct *fsp, char *fname,uint32 *major, uint32 } /* Seek to the start of the .rsrc section info */ - if (SMB_VFS_LSEEK(fsp, section_pos, SEEK_SET) == (SMB_OFF_T)-1) { + if (SMB_VFS_LSEEK(fsp, section_pos, SEEK_SET) == (off_t)-1) { DEBUG(3,("get_file_version: PE file [%s] too short for section info, errno = %d\n", fname, errno)); goto error_exit; diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index 32f33c6348..2cb805d146 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -223,7 +223,7 @@ done: int print_spool_write(files_struct *fsp, const char *data, uint32_t size, - SMB_OFF_T offset, uint32_t *written) + off_t offset, uint32_t *written) { SMB_STRUCT_STAT st; ssize_t n; diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 44081f69a0..000206a985 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -147,7 +147,7 @@ static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx, NTSTATUS schedule_aio_read_and_X(connection_struct *conn, struct smb_request *smbreq, - files_struct *fsp, SMB_OFF_T startpos, + files_struct *fsp, off_t startpos, size_t smb_maxcnt) { struct aio_extra *aio_ex; @@ -254,7 +254,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn, NTSTATUS schedule_aio_write_and_X(connection_struct *conn, struct smb_request *smbreq, files_struct *fsp, const char *data, - SMB_OFF_T startpos, + off_t startpos, size_t numtowrite) { struct aio_extra *aio_ex; @@ -418,7 +418,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, files_struct *fsp, TALLOC_CTX *ctx, DATA_BLOB *preadbuf, - SMB_OFF_T startpos, + off_t startpos, size_t smb_maxcnt) { struct aio_extra *aio_ex; @@ -1060,7 +1060,7 @@ void cancel_aio_by_fsp(files_struct *fsp) #else NTSTATUS schedule_aio_read_and_X(connection_struct *conn, struct smb_request *smbreq, - files_struct *fsp, SMB_OFF_T startpos, + files_struct *fsp, off_t startpos, size_t smb_maxcnt) { return NT_STATUS_RETRY; @@ -1069,7 +1069,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn, NTSTATUS schedule_aio_write_and_X(connection_struct *conn, struct smb_request *smbreq, files_struct *fsp, const char *data, - SMB_OFF_T startpos, + off_t startpos, size_t numtowrite) { return NT_STATUS_RETRY; @@ -1085,7 +1085,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, files_struct *fsp, TALLOC_CTX *ctx, DATA_BLOB *preadbuf, - SMB_OFF_T startpos, + off_t startpos, size_t smb_maxcnt) { return NT_STATUS_RETRY; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index da6d8483a1..dc6df47ee6 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -118,7 +118,7 @@ static NTSTATUS check_magic(struct files_struct *fsp) goto out; } - if (transfer_file(tmp_fd,outfd,(SMB_OFF_T)st.st_ex_size) == (SMB_OFF_T)-1) { + if (transfer_file(tmp_fd,outfd,(off_t)st.st_ex_size) == (off_t)-1) { int err = errno; close(tmp_fd); close(outfd); diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 79a0f8bf18..cb27110f26 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -82,7 +82,7 @@ bool make_dir_struct(TALLOC_CTX *ctx, char *buf, const char *mask, const char *fname, - SMB_OFF_T size, + off_t size, uint32 mode, time_t date, bool uc) @@ -1221,7 +1221,7 @@ bool get_dir_entry(TALLOC_CTX *ctx, const char *mask, uint32_t dirtype, char **_fname, - SMB_OFF_T *_size, + off_t *_size, uint32_t *_mode, struct timespec *_date, bool check_descend, diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 85d879d8c5..8bdb66bcfe 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -25,13 +25,13 @@ #include "smbd/globals.h" #include "smbprofile.h" -static bool setup_write_cache(files_struct *, SMB_OFF_T); +static bool setup_write_cache(files_struct *, off_t); /**************************************************************************** Read from write cache if we can. ****************************************************************************/ -static bool read_from_write_cache(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) +static bool read_from_write_cache(files_struct *fsp,char *data,off_t pos,size_t n) { write_cache *wcp = fsp->wcp; @@ -54,7 +54,7 @@ static bool read_from_write_cache(files_struct *fsp,char *data,SMB_OFF_T pos,siz Read from a file. ****************************************************************************/ -ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n) +ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n) { ssize_t ret=0,readret; @@ -121,7 +121,7 @@ tryagain: static ssize_t real_write_file(struct smb_request *req, files_struct *fsp, const char *data, - SMB_OFF_T pos, + off_t pos, size_t n) { ssize_t ret; @@ -287,7 +287,7 @@ void trigger_write_time_update_immediate(struct files_struct *fsp) ssize_t write_file(struct smb_request *req, files_struct *fsp, const char *data, - SMB_OFF_T pos, + off_t pos, size_t n) { write_cache *wcp = fsp->wcp; @@ -905,7 +905,7 @@ void delete_write_cache(files_struct *fsp) Setup the write cache structure. ****************************************************************************/ -static bool setup_write_cache(files_struct *fsp, SMB_OFF_T file_size) +static bool setup_write_cache(files_struct *fsp, off_t file_size) { ssize_t alloc_size = lp_write_cache_size(SNUM(fsp->conn)); write_cache *wcp; @@ -950,7 +950,7 @@ static bool setup_write_cache(files_struct *fsp, SMB_OFF_T file_size) Cope with a size change. ****************************************************************************/ -void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size) +void set_filelen_write_cache(files_struct *fsp, off_t file_size) { if(fsp->wcp) { /* The cache *must* have been flushed before we do this. */ diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 20379ac6d9..168ef56553 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -451,7 +451,7 @@ void reply_ntcreate_and_X(struct smb_request *req) /* Breakout the oplock request bits so we can set the reply bits separately. */ uint32 fattr=0; - SMB_OFF_T file_len = 0; + off_t file_len = 0; int info = 0; files_struct *fsp = NULL; char *p = NULL; @@ -972,7 +972,7 @@ static void call_nt_transact_create(connection_struct *conn, char *data = *ppdata; /* Breakout the oplock request bits so we can set the reply bits separately. */ uint32 fattr=0; - SMB_OFF_T file_len = 0; + off_t file_len = 0; int info = 0; files_struct *fsp = NULL; char *p = NULL; @@ -1355,7 +1355,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, files_struct *fsp1,*fsp2; uint32 fattr; int info; - SMB_OFF_T ret=-1; + off_t ret=-1; NTSTATUS status = NT_STATUS_OK; char *parent; @@ -1470,7 +1470,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx, file_set_dosmode(conn, smb_fname_dst, fattr, parent, false); TALLOC_FREE(parent); - if (ret < (SMB_OFF_T)smb_fname_src->st.st_ex_size) { + if (ret < (off_t)smb_fname_src->st.st_ex_size) { status = NT_STATUS_DISK_FULL; goto out; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1af07882b5..ca267a0500 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -66,19 +66,19 @@ void srv_set_signing(struct smbd_server_connection *conn, NTSTATUS schedule_aio_read_and_X(connection_struct *conn, struct smb_request *req, - files_struct *fsp, SMB_OFF_T startpos, + files_struct *fsp, off_t startpos, size_t smb_maxcnt); NTSTATUS schedule_aio_write_and_X(connection_struct *conn, struct smb_request *req, files_struct *fsp, const char *data, - SMB_OFF_T startpos, + off_t startpos, size_t numtowrite); NTSTATUS schedule_smb2_aio_read(connection_struct *conn, struct smb_request *smbreq, files_struct *fsp, TALLOC_CTX *ctx, DATA_BLOB *preadbuf, - SMB_OFF_T startpos, + off_t startpos, size_t smb_maxcnt); NTSTATUS schedule_aio_smb2_write(connection_struct *conn, struct smb_request *smbreq, @@ -185,7 +185,7 @@ bool make_dir_struct(TALLOC_CTX *ctx, char *buf, const char *mask, const char *fname, - SMB_OFF_T size, + off_t size, uint32 mode, time_t date, bool uc); @@ -229,7 +229,7 @@ bool get_dir_entry(TALLOC_CTX *ctx, const char *mask, uint32 dirtype, char **pp_fname_out, - SMB_OFF_T *size, + off_t *size, uint32 *mode, struct timespec *date, bool check_descend, @@ -317,7 +317,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode); /* The following definitions come from smbd/fileio.c */ -ssize_t read_file(files_struct *fsp,char *data,SMB_OFF_T pos,size_t n); +ssize_t read_file(files_struct *fsp,char *data,off_t pos,size_t n); void update_write_time_handler(struct event_context *ctx, struct timed_event *te, struct timeval now, @@ -327,10 +327,10 @@ void trigger_write_time_update_immediate(struct files_struct *fsp); ssize_t write_file(struct smb_request *req, files_struct *fsp, const char *data, - SMB_OFF_T pos, + off_t pos, size_t n); void delete_write_cache(files_struct *fsp); -void set_filelen_write_cache(files_struct *fsp, SMB_OFF_T file_size); +void set_filelen_write_cache(files_struct *fsp, off_t file_size); ssize_t flush_write_cache(files_struct *fsp, enum flush_reason_enum reason); NTSTATUS sync_file(connection_struct *conn, files_struct *fsp, bool write_through); int fsp_stat(files_struct *fsp); @@ -867,7 +867,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, uint32 dirtype, struct smb_filename *smb_fname, bool has_wild); void reply_unlink(struct smb_request *req); -ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread); +ssize_t fake_sendfile(files_struct *fsp, off_t startpos, size_t nread); void sendfile_short_send(files_struct *fsp, ssize_t nread, size_t headersize, @@ -1147,7 +1147,7 @@ bool smbd_vfs_init(connection_struct *conn); NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname); ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count); ssize_t vfs_pread_data(files_struct *fsp, char *buf, - size_t byte_count, SMB_OFF_T offset); + size_t byte_count, off_t offset); ssize_t vfs_write_data(struct smb_request *req, files_struct *fsp, const char *buffer, @@ -1156,12 +1156,12 @@ ssize_t vfs_pwrite_data(struct smb_request *req, files_struct *fsp, const char *buffer, size_t N, - SMB_OFF_T offset); + off_t offset); int vfs_allocate_file_space(files_struct *fsp, uint64_t len); -int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len); -int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len); -int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len); -SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n); +int vfs_set_filelen(files_struct *fsp, off_t len); +int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len); +int vfs_fill_sparse(files_struct *fsp, off_t len); +off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n); const char *vfs_readdirname(connection_struct *conn, void *p, SMB_STRUCT_STAT *sbuf, char **talloced); int vfs_ChDir(connection_struct *conn, const char *path); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 8cefba0dfc..dc4310639b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -1081,7 +1081,7 @@ void reply_getatr(struct smb_request *req) struct smb_filename *smb_fname = NULL; char *fname = NULL; int mode=0; - SMB_OFF_T size=0; + off_t size=0; time_t mtime=0; const char *p; NTSTATUS status; @@ -1374,7 +1374,7 @@ void reply_search(struct smb_request *req) char *directory = NULL; struct smb_filename *smb_fname = NULL; char *fname = NULL; - SMB_OFF_T size; + off_t size; uint32 mode; struct timespec date; uint32 dirtype; @@ -1716,7 +1716,7 @@ void reply_open(struct smb_request *req) struct smb_filename *smb_fname = NULL; char *fname = NULL; uint32 fattr=0; - SMB_OFF_T size = 0; + off_t size = 0; time_t mtime=0; int info; files_struct *fsp; @@ -1989,7 +1989,7 @@ void reply_open_and_X(struct smb_request *req) reply_nterror(req, NT_STATUS_DISK_FULL); goto out; } - retval = vfs_set_filelen(fsp, (SMB_OFF_T)allocation_size); + retval = vfs_set_filelen(fsp, (off_t)allocation_size); if (retval < 0) { close_file(req, fsp, ERROR_CLOSE); reply_nterror(req, NT_STATUS_DISK_FULL); @@ -2840,7 +2840,7 @@ static void fail_readraw(void) Fake (read/write) sendfile. Returns -1 on read or write fail. ****************************************************************************/ -ssize_t fake_sendfile(files_struct *fsp, SMB_OFF_T startpos, size_t nread) +ssize_t fake_sendfile(files_struct *fsp, off_t startpos, size_t nread) { size_t bufsize; size_t tosend = nread; @@ -3003,7 +3003,7 @@ static void reply_readbraw_error(struct smbd_server_connection *sconn) static void send_file_readbraw(connection_struct *conn, struct smb_request *req, files_struct *fsp, - SMB_OFF_T startpos, + off_t startpos, size_t nread, ssize_t mincount) { @@ -3134,10 +3134,10 @@ void reply_readbraw(struct smb_request *req) struct smbd_server_connection *sconn = req->sconn; ssize_t maxcount,mincount; size_t nread = 0; - SMB_OFF_T startpos; + off_t startpos; files_struct *fsp; struct lock_struct lock; - SMB_OFF_T size = 0; + off_t size = 0; START_PROFILE(SMBreadbraw); @@ -3208,7 +3208,7 @@ void reply_readbraw(struct smb_request *req) * This is a large offset (64 bit) read. */ - startpos |= (((SMB_OFF_T)IVAL(req->vwv+8, 0)) << 32); + startpos |= (((off_t)IVAL(req->vwv+8, 0)) << 32); if(startpos < 0) { DEBUG(0,("reply_readbraw: negative 64 bit " @@ -3280,7 +3280,7 @@ void reply_lockread(struct smb_request *req) connection_struct *conn = req->conn; ssize_t nread = -1; char *data; - SMB_OFF_T startpos; + off_t startpos; size_t numtoread; NTSTATUS status; files_struct *fsp; @@ -3392,7 +3392,7 @@ void reply_read(struct smb_request *req) size_t numtoread; ssize_t nread = 0; char *data; - SMB_OFF_T startpos; + off_t startpos; int outsize = 0; files_struct *fsp; struct lock_struct lock; @@ -3507,7 +3507,7 @@ static int setup_readX_header(struct smb_request *req, char *outbuf, ****************************************************************************/ static void send_file_readX(connection_struct *conn, struct smb_request *req, - files_struct *fsp, SMB_OFF_T startpos, + files_struct *fsp, off_t startpos, size_t smb_maxcnt) { ssize_t nread = -1; @@ -3704,7 +3704,7 @@ void reply_read_and_X(struct smb_request *req) struct smbd_server_connection *sconn = req->sconn; connection_struct *conn = req->conn; files_struct *fsp; - SMB_OFF_T startpos; + off_t startpos; size_t smb_maxcnt; bool big_readX = False; #if 0 @@ -3780,7 +3780,7 @@ void reply_read_and_X(struct smb_request *req) /* * This is a large offset (64 bit) read. */ - startpos |= (((SMB_OFF_T)IVAL(req->vwv+10, 0)) << 32); + startpos |= (((off_t)IVAL(req->vwv+10, 0)) << 32); } @@ -3875,7 +3875,7 @@ void reply_writebraw(struct smb_request *req) ssize_t total_written=0; size_t numtowrite=0; size_t tcount; - SMB_OFF_T startpos; + off_t startpos; const char *data=NULL; bool write_through; files_struct *fsp; @@ -4125,7 +4125,7 @@ void reply_writeunlock(struct smb_request *req) connection_struct *conn = req->conn; ssize_t nwritten = -1; size_t numtowrite; - SMB_OFF_T startpos; + off_t startpos; const char *data; NTSTATUS status = NT_STATUS_OK; files_struct *fsp; @@ -4239,7 +4239,7 @@ void reply_write(struct smb_request *req) connection_struct *conn = req->conn; size_t numtowrite; ssize_t nwritten = -1; - SMB_OFF_T startpos; + off_t startpos; const char *data; files_struct *fsp; struct lock_struct lock; @@ -4300,12 +4300,12 @@ void reply_write(struct smb_request *req) /* * This is actually an allocate call, and set EOF. JRA. */ - nwritten = vfs_allocate_file_space(fsp, (SMB_OFF_T)startpos); + nwritten = vfs_allocate_file_space(fsp, (off_t)startpos); if (nwritten < 0) { reply_nterror(req, NT_STATUS_DISK_FULL); goto strict_unlock; } - nwritten = vfs_set_filelen(fsp, (SMB_OFF_T)startpos); + nwritten = vfs_set_filelen(fsp, (off_t)startpos); if (nwritten < 0) { reply_nterror(req, NT_STATUS_DISK_FULL); goto strict_unlock; @@ -4448,7 +4448,7 @@ void reply_write_and_X(struct smb_request *req) connection_struct *conn = req->conn; files_struct *fsp; struct lock_struct lock; - SMB_OFF_T startpos; + off_t startpos; size_t numtowrite; bool write_through; ssize_t nwritten; @@ -4522,7 +4522,7 @@ void reply_write_and_X(struct smb_request *req) /* * This is a large offset (64 bit) write. */ - startpos |= (((SMB_OFF_T)IVAL(req->vwv+12, 0)) << 32); + startpos |= (((off_t)IVAL(req->vwv+12, 0)) << 32); } @@ -4620,8 +4620,8 @@ out: void reply_lseek(struct smb_request *req) { connection_struct *conn = req->conn; - SMB_OFF_T startpos; - SMB_OFF_T res= -1; + off_t startpos; + off_t res= -1; int mode,umode; files_struct *fsp; @@ -4643,7 +4643,7 @@ void reply_lseek(struct smb_request *req) mode = SVAL(req->vwv+1, 0) & 3; /* NB. This doesn't use IVAL_TO_SMB_OFF_T as startpos can be signed in this case. */ - startpos = (SMB_OFF_T)IVALS(req->vwv+2, 0); + startpos = (off_t)IVALS(req->vwv+2, 0); switch (mode) { case 0: @@ -4666,7 +4666,7 @@ void reply_lseek(struct smb_request *req) if (umode == SEEK_END) { if((res = SMB_VFS_LSEEK(fsp,startpos,umode)) == -1) { if(errno == EINVAL) { - SMB_OFF_T current_pos = startpos; + off_t current_pos = startpos; if(fsp_stat(fsp) == -1) { reply_nterror(req, @@ -4845,7 +4845,7 @@ void reply_writeclose(struct smb_request *req) size_t numtowrite; ssize_t nwritten = -1; NTSTATUS close_status = NT_STATUS_OK; - SMB_OFF_T startpos; + off_t startpos; const char *data; struct timespec mtime; files_struct *fsp; @@ -5454,7 +5454,7 @@ void reply_printwrite(struct smb_request *req) data = (const char *)req->buf + 3; - if (write_file(req,fsp,data,(SMB_OFF_T)-1,numtowrite) != numtowrite) { + if (write_file(req,fsp,data,(off_t)-1,numtowrite) != numtowrite) { reply_nterror(req, map_nt_error_from_unix(errno)); END_PROFILE(SMBsplwr); return; @@ -6695,7 +6695,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, bool target_is_directory) { struct smb_filename *smb_fname_dst_tmp = NULL; - SMB_OFF_T ret=-1; + off_t ret=-1; files_struct *fsp1,*fsp2; uint32 dosattrs; uint32 new_create_disposition; @@ -6840,7 +6840,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx, goto out; } - if (ret != (SMB_OFF_T)smb_fname_src->st.st_ex_size) { + if (ret != (off_t)smb_fname_src->st.st_ex_size) { status = NT_STATUS_DISK_FULL; goto out; } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 0b6e2ee461..53b0a9dc57 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -475,7 +475,7 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, fsp, state, &state->out_data, - (SMB_OFF_T)in_offset, + (off_t)in_offset, (size_t)in_length); if (NT_STATUS_IS_OK(status)) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 40a1a5dc80..dcf771a5b9 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1028,7 +1028,7 @@ static void call_trans2open(connection_struct *conn, uint32 open_size; char *pname; char *fname = NULL; - SMB_OFF_T size=0; + off_t size=0; int fattr=0,mtime=0; SMB_INO_T inode = 0; int smb_action = 0; @@ -5670,7 +5670,7 @@ static NTSTATUS smb_set_file_size(connection_struct *conn, files_struct *fsp, const struct smb_filename *smb_fname, const SMB_STRUCT_STAT *psbuf, - SMB_OFF_T size, + off_t size, bool fail_after_createfile) { NTSTATUS status = NT_STATUS_OK; @@ -6755,14 +6755,14 @@ static NTSTATUS smb_set_file_end_of_file_info(connection_struct *conn, const struct smb_filename *smb_fname, bool fail_after_createfile) { - SMB_OFF_T size; + off_t size; if (total_data < 8) { return NT_STATUS_INVALID_PARAMETER; } size = IVAL(pdata,0); - size |= (((SMB_OFF_T)IVAL(pdata,4)) << 32); + size |= (((off_t)IVAL(pdata,4)) << 32); DEBUG(10,("smb_set_file_end_of_file_info: Set end of file info for " "file %s to %.0f\n", smb_fname_str_dbg(smb_fname), (double)size)); @@ -6874,7 +6874,7 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, struct smb_file_time ft; uint32 raw_unixmode; mode_t unixmode; - SMB_OFF_T size = 0; + off_t size = 0; uid_t set_owner = (uid_t)SMB_UID_NO_CHANGE; gid_t set_grp = (uid_t)SMB_GID_NO_CHANGE; NTSTATUS status = NT_STATUS_OK; @@ -6895,7 +6895,7 @@ static NTSTATUS smb_set_file_unix_basic(connection_struct *conn, if(IVAL(pdata, 0) != SMB_SIZE_NO_CHANGE_LO && IVAL(pdata, 4) != SMB_SIZE_NO_CHANGE_HI) { size=IVAL(pdata,0); /* first 8 Bytes are size */ - size |= (((SMB_OFF_T)IVAL(pdata,4)) << 32); + size |= (((off_t)IVAL(pdata,4)) << 32); } ft.atime = interpret_long_date(pdata+24); /* access_time */ diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index f8a4199470..b330c03bfc 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -360,7 +360,7 @@ ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count) } ssize_t vfs_pread_data(files_struct *fsp, char *buf, - size_t byte_count, SMB_OFF_T offset) + size_t byte_count, off_t offset) { size_t total=0; @@ -400,7 +400,7 @@ ssize_t vfs_write_data(struct smb_request *req, req->unread_bytes = 0; return SMB_VFS_RECVFILE(req->sconn->sock, fsp, - (SMB_OFF_T)-1, + (off_t)-1, N); } @@ -421,7 +421,7 @@ ssize_t vfs_pwrite_data(struct smb_request *req, files_struct *fsp, const char *buffer, size_t N, - SMB_OFF_T offset) + off_t offset) { size_t total=0; ssize_t ret; @@ -471,7 +471,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len) DEBUG(10,("vfs_allocate_file_space: file %s, len %.0f\n", fsp_str_dbg(fsp), (double)len)); - if (((SMB_OFF_T)len) < 0) { + if (((off_t)len) < 0) { DEBUG(0,("vfs_allocate_file_space: %s negative len " "requested.\n", fsp_str_dbg(fsp))); errno = EINVAL; @@ -496,7 +496,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len) contend_level2_oplocks_begin(fsp, LEVEL2_CONTEND_ALLOC_SHRINK); flush_write_cache(fsp, SIZECHANGE_FLUSH); - if ((ret = SMB_VFS_FTRUNCATE(fsp, (SMB_OFF_T)len)) != -1) { + if ((ret = SMB_VFS_FTRUNCATE(fsp, (off_t)len)) != -1) { set_filelen_write_cache(fsp, len); } @@ -551,7 +551,7 @@ int vfs_allocate_file_space(files_struct *fsp, uint64_t len) Returns 0 on success, -1 on failure. ****************************************************************************/ -int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len) +int vfs_set_filelen(files_struct *fsp, off_t len) { int ret; @@ -583,7 +583,7 @@ int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len) #define SPARSE_BUF_WRITE_SIZE (32*1024) -int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len) +int vfs_slow_fallocate(files_struct *fsp, off_t offset, off_t len) { ssize_t pwrite_ret; size_t total = 0; @@ -619,11 +619,11 @@ int vfs_slow_fallocate(files_struct *fsp, SMB_OFF_T offset, SMB_OFF_T len) Returns 0 on success, -1 on failure. ****************************************************************************/ -int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len) +int vfs_fill_sparse(files_struct *fsp, off_t len) { int ret; NTSTATUS status; - SMB_OFF_T offset; + off_t offset; size_t num_to_write; status = vfs_stat_fsp(fsp); @@ -708,7 +708,7 @@ static ssize_t vfs_write_fn(void *file, const void *buf, size_t len) return SMB_VFS_WRITE(fsp, buf, len); } -SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n) +off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n) { return transfer_file_internal((void *)in, (void *)out, n, vfs_read_fn, vfs_write_fn); @@ -1511,7 +1511,7 @@ ssize_t smb_vfs_call_read(struct vfs_handle_struct *handle, ssize_t smb_vfs_call_pread(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n, - SMB_OFF_T offset) + off_t offset) { VFS_FIND(pread); return handle->fns->pread_fn(handle, fsp, data, n, offset); @@ -1527,14 +1527,14 @@ ssize_t smb_vfs_call_write(struct vfs_handle_struct *handle, ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, const void *data, - size_t n, SMB_OFF_T offset) + size_t n, off_t offset) { VFS_FIND(pwrite); return handle->fns->pwrite_fn(handle, fsp, data, n, offset); } -SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T offset, +off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle, + struct files_struct *fsp, off_t offset, int whence) { VFS_FIND(lseek); @@ -1543,7 +1543,7 @@ SMB_OFF_T smb_vfs_call_lseek(struct vfs_handle_struct *handle, ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd, files_struct *fromfsp, const DATA_BLOB *header, - SMB_OFF_T offset, size_t count) + off_t offset, size_t count) { VFS_FIND(sendfile); return handle->fns->sendfile_fn(handle, tofd, fromfsp, header, offset, @@ -1551,7 +1551,7 @@ ssize_t smb_vfs_call_sendfile(struct vfs_handle_struct *handle, int tofd, } ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd, - files_struct *tofsp, SMB_OFF_T offset, + files_struct *tofsp, off_t offset, size_t count) { VFS_FIND(recvfile); @@ -1765,7 +1765,7 @@ int smb_vfs_call_ntimes(struct vfs_handle_struct *handle, } int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle, - struct files_struct *fsp, SMB_OFF_T offset) + struct files_struct *fsp, off_t offset) { VFS_FIND(ftruncate); return handle->fns->ftruncate_fn(handle, fsp, offset); @@ -1774,8 +1774,8 @@ int smb_vfs_call_ftruncate(struct vfs_handle_struct *handle, int smb_vfs_call_fallocate(struct vfs_handle_struct *handle, struct files_struct *fsp, enum vfs_fallocate_mode mode, - SMB_OFF_T offset, - SMB_OFF_T len) + off_t offset, + off_t len) { VFS_FIND(fallocate); return handle->fns->fallocate_fn(handle, fsp, mode, offset, len); diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index b845048ebe..b6cc716a61 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -490,7 +490,7 @@ static NTSTATUS cmd_write(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv) { int fd, offset, whence; - SMB_OFF_T pos; + off_t pos; if (argc != 4) { printf("Usage: lseek \n...where whence is 1 => SEEK_SET, 2 => SEEK_CUR, 3 => SEEK_END\n"); @@ -507,7 +507,7 @@ static NTSTATUS cmd_lseek(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, } pos = SMB_VFS_LSEEK(vfs->files[fd], offset, whence); - if (pos == (SMB_OFF_T)-1) { + if (pos == (off_t)-1) { printf("lseek: error=%d (%s)\n", errno, strerror(errno)); return NT_STATUS_UNSUCCESSFUL; } @@ -936,7 +936,7 @@ static NTSTATUS cmd_utime(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv) { int fd; - SMB_OFF_T off; + off_t off; if (argc != 3) { printf("Usage: ftruncate \n"); return NT_STATUS_OK; diff --git a/source3/torture/test_posix_append.c b/source3/torture/test_posix_append.c index 2f562633e5..d4784e8e7c 100644 --- a/source3/torture/test_posix_append.c +++ b/source3/torture/test_posix_append.c @@ -33,7 +33,7 @@ bool run_posix_append(int dummy) const char *fname = "append"; NTSTATUS status; uint16_t fnum; - SMB_OFF_T size; + off_t size; uint8_t c = '\0'; bool ret = false; diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 1e9e59b280..5214e1319d 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -984,7 +984,7 @@ static bool run_readwritelarge_internal(void) static struct cli_state *cli1; uint16_t fnum1; const char *lockfname = "\\large.dat"; - SMB_OFF_T fsize; + off_t fsize; char buf[126*1024]; bool correct = True; NTSTATUS status; @@ -3281,7 +3281,7 @@ static bool run_trans2test(int dummy) { struct cli_state *cli; uint16_t fnum; - SMB_OFF_T size; + off_t size; time_t c_time, a_time, m_time; struct timespec c_time_ts, a_time_ts, m_time_ts, w_time_ts, m_time2_ts; const char *fname = "\\trans2.tst"; @@ -4851,7 +4851,7 @@ static bool run_opentest(int dummy) const char *fname = "\\readonly.file"; uint16_t fnum1, fnum2; char buf[20]; - SMB_OFF_T fsize; + off_t fsize; bool correct = True; char *tmp_path; NTSTATUS status; @@ -7016,7 +7016,7 @@ static bool run_mangle1(int dummy) fstring alt_name; NTSTATUS status; time_t change_time, access_time, write_time; - SMB_OFF_T size; + off_t size; uint16_t mode; printf("starting mangle1 test\n"); @@ -7586,7 +7586,7 @@ static bool run_streamerror(int dummy) "testdir:{4c8cc155-6c1e-11d1-8e41-00c04fb9386d}:$DATA"; NTSTATUS status; time_t change_time, access_time, write_time; - SMB_OFF_T size; + off_t size; uint16_t mode, fnum; bool ret = true; diff --git a/source3/torture/utable.c b/source3/torture/utable.c index 2a56f085fe..a2db3ba0fe 100644 --- a/source3/torture/utable.c +++ b/source3/torture/utable.c @@ -153,7 +153,7 @@ bool torture_casetable(int dummy) } for (c=1; c < 0x10000; c++) { - SMB_OFF_T size; + off_t size; if (c == '.' || c == '\\') continue; -- cgit