diff options
author | Volker Lendecke <vl@samba.org> | 2009-05-14 15:34:42 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-05-26 17:48:23 +0200 |
commit | 49ca690b4b22ee6e597179059c9442e94c5bd423 (patch) | |
tree | ad233a9bcfee2d467824290448ca366219dbd301 /source3/include | |
parent | 52f2f9449f8d53aa9181d656a4b54a007c80fa81 (diff) | |
download | samba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.gz samba-49ca690b4b22ee6e597179059c9442e94c5bd423.tar.bz2 samba-49ca690b4b22ee6e597179059c9442e94c5bd423.zip |
Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces
struct stat_ex {
dev_t st_ex_dev;
ino_t st_ex_ino;
mode_t st_ex_mode;
nlink_t st_ex_nlink;
uid_t st_ex_uid;
gid_t st_ex_gid;
dev_t st_ex_rdev;
off_t st_ex_size;
struct timespec st_ex_atime;
struct timespec st_ex_mtime;
struct timespec st_ex_ctime;
struct timespec st_ex_btime; /* birthtime */
blksize_t st_ex_blksize;
blkcnt_t st_ex_blocks;
};
typedef struct stat_ex SMB_STRUCT_STAT;
It is really large because due to the friendly libc headers playing macro
tricks with fields like st_ino, so I renamed them to st_ex_xxx.
Why this change? To support birthtime, we already have quite a few #ifdef's at
places where it does not really belong. With a stat struct that we control, we
can consolidate the nanosecond timestamps and the birthtime deep in the VFS
stat calls.
At this moment it is triggered by a request to support the birthtime field for
GPFS. GPFS does not extend the system level struct stat, but instead has a
separate call that gets us the additional information beyond posix. Without
being able to do that within the VFS stat calls, that support would have to be
scattered around the main smbd code.
It will very likely break all the onefs modules, but I think the changes will
be reasonably easy to do.
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/includes.h | 33 | ||||
-rw-r--r-- | source3/include/proto.h | 11 | ||||
-rw-r--r-- | source3/include/smb_macros.h | 6 |
3 files changed, 31 insertions, 19 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h index 596c772d9e..a2f6048c27 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -435,13 +435,32 @@ typedef uint64_t br_off; * Type for stat structure. */ -#ifndef SMB_STRUCT_STAT -# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T) -# define SMB_STRUCT_STAT struct stat64 -# else -# define SMB_STRUCT_STAT struct stat -# endif -#endif +struct stat_ex { + dev_t st_ex_dev; + ino_t st_ex_ino; + mode_t st_ex_mode; + nlink_t st_ex_nlink; + uid_t st_ex_uid; + gid_t st_ex_gid; + dev_t st_ex_rdev; + off_t st_ex_size; + struct timespec st_ex_atime; + struct timespec st_ex_mtime; + struct timespec st_ex_ctime; + struct timespec st_ex_btime; /* birthtime */ + blksize_t st_ex_blksize; + blkcnt_t st_ex_blocks; + + /* + * Add space for VFS internal extensions. The initial user of this + * would be the onefs modules, passing the snapid from the stat calls + * to the file_id_create call. Maybe we'll have to expand this later, + * but the core of Samba should never look at this field. + */ + uint64_t vfs_private; +}; + +typedef struct stat_ex SMB_STRUCT_STAT; /* * Type for dirent structure. diff --git a/source3/include/proto.h b/source3/include/proto.h index e0b0e59700..c78d2c8e0b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1010,13 +1010,6 @@ void srv_put_dos_date2(char *buf,int offset, time_t unixdate); void srv_put_dos_date3(char *buf,int offset,time_t unixdate); void put_long_date_timespec(char *p, struct timespec ts); void put_long_date(char *p, time_t t); -struct timespec get_create_timespec(const SMB_STRUCT_STAT *st,bool fake_dirs); -struct timespec get_atimespec(const SMB_STRUCT_STAT *pst); -void set_atimespec(SMB_STRUCT_STAT *pst, struct timespec ts); -struct timespec get_mtimespec(const SMB_STRUCT_STAT *pst); -void set_mtimespec(SMB_STRUCT_STAT *pst, struct timespec ts); -struct timespec get_ctimespec(const SMB_STRUCT_STAT *pst); -void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts); void dos_filetime_timespec(struct timespec *tsp); time_t make_unix_date2(const void *date_ptr, int zone_offset); time_t make_unix_date3(const void *date_ptr, int zone_offset); @@ -4087,7 +4080,7 @@ bool lp_recursive_veto_delete(int ); bool lp_dos_filemode(int ); bool lp_dos_filetimes(int ); bool lp_dos_filetime_resolution(int ); -bool lp_fake_dir_create_times(int ); +bool lp_fake_dir_create_times(void); bool lp_blocking_locks(int ); bool lp_inherit_perms(int ); bool lp_inherit_acls(int ); @@ -6174,7 +6167,7 @@ bool get_dir_entry(TALLOC_CTX *ctx, char **pp_fname_out, SMB_OFF_T *size, uint32 *mode, - time_t *date, + struct timespec *date, bool check_descend, bool ask_sharemode); bool is_visible_file(connection_struct *conn, const char *dir_path, const char *name, SMB_STRUCT_STAT *pst, bool use_veto); diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 22cfaaf581..7528883c2d 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -88,9 +88,9 @@ * stat structure is valid. */ -#define VALID_STAT(st) ((st).st_nlink != 0) -#define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR((st).st_mode)) -#define SET_STAT_INVALID(st) ((st).st_nlink = 0) +#define VALID_STAT(st) ((st).st_ex_nlink != 0) +#define VALID_STAT_OF_DIR(st) (VALID_STAT(st) && S_ISDIR((st).st_ex_mode)) +#define SET_STAT_INVALID(st) ((st).st_ex_nlink = 0) /* Macros to get at offsets within smb_lkrng and smb_unlkrng structures. We cannot define these as actual structures |