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 --- 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 ++++++++++++++++++++------------------- 7 files changed, 46 insertions(+), 49 deletions(-) (limited to 'source3/include') 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, -- cgit