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/libsmb | |
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/libsmb')
-rw-r--r-- | source3/libsmb/clifile.c | 28 | ||||
-rw-r--r-- | source3/libsmb/clirap.c | 6 | ||||
-rw-r--r-- | source3/libsmb/libsmb_stat.c | 12 |
3 files changed, 23 insertions, 23 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 2c80f1dd1a..1225aa6bae 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -294,31 +294,31 @@ bool cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbu return false; } - sbuf->st_size = IVAL2_TO_SMB_BIG_UINT(rdata,0); /* total size, in bytes */ - sbuf->st_blocks = IVAL2_TO_SMB_BIG_UINT(rdata,8); /* number of blocks allocated */ + sbuf->st_ex_size = IVAL2_TO_SMB_BIG_UINT(rdata,0); /* total size, in bytes */ + sbuf->st_ex_blocks = IVAL2_TO_SMB_BIG_UINT(rdata,8); /* number of blocks allocated */ #if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE) - sbuf->st_blocks /= STAT_ST_BLOCKSIZE; + sbuf->st_ex_blocks /= STAT_ST_BLOCKSIZE; #else /* assume 512 byte blocks */ - sbuf->st_blocks /= 512; + sbuf->st_ex_blocks /= 512; #endif - set_ctimespec(sbuf, interpret_long_date(rdata + 16)); /* time of last change */ - set_atimespec(sbuf, interpret_long_date(rdata + 24)); /* time of last access */ - set_mtimespec(sbuf, interpret_long_date(rdata + 32)); /* time of last modification */ + sbuf->st_ex_ctime = interpret_long_date(rdata + 16); /* time of last change */ + sbuf->st_ex_atime = interpret_long_date(rdata + 24); /* time of last access */ + sbuf->st_ex_mtime = interpret_long_date(rdata + 32); /* time of last modification */ - sbuf->st_uid = (uid_t) IVAL(rdata,40); /* user ID of owner */ - sbuf->st_gid = (gid_t) IVAL(rdata,48); /* group ID of owner */ - sbuf->st_mode |= unix_filetype_from_wire(IVAL(rdata, 56)); + sbuf->st_ex_uid = (uid_t) IVAL(rdata,40); /* user ID of owner */ + sbuf->st_ex_gid = (gid_t) IVAL(rdata,48); /* group ID of owner */ + sbuf->st_ex_mode |= unix_filetype_from_wire(IVAL(rdata, 56)); #if defined(HAVE_MAKEDEV) { uint32_t dev_major = IVAL(rdata,60); uint32_t dev_minor = IVAL(rdata,68); - sbuf->st_rdev = makedev(dev_major, dev_minor); + sbuf->st_ex_rdev = makedev(dev_major, dev_minor); } #endif - sbuf->st_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(rdata,76); /* inode */ - sbuf->st_mode |= wire_perms_to_unix(IVAL(rdata,84)); /* protection */ - sbuf->st_nlink = IVAL(rdata,92); /* number of hard links */ + sbuf->st_ex_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(rdata,76); /* inode */ + sbuf->st_ex_mode |= wire_perms_to_unix(IVAL(rdata,84)); /* protection */ + sbuf->st_ex_nlink = IVAL(rdata,92); /* number of hard links */ SAFE_FREE(rdata); SAFE_FREE(rparam); diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 1771e8fd25..c3ec82bd3e 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -1105,9 +1105,9 @@ bool cli_qpathinfo_basic( struct cli_state *cli, const char *name, return False; } - set_atimespec(sbuf, interpret_long_date( rdata+8 )); /* Access time. */ - set_mtimespec(sbuf, interpret_long_date( rdata+16 )); /* Write time. */ - set_ctimespec(sbuf, interpret_long_date( rdata+24 )); /* Change time. */ + sbuf->st_ex_atime = interpret_long_date( rdata+8 ); /* Access time. */ + sbuf->st_ex_mtime = interpret_long_date( rdata+16 ); /* Write time. */ + sbuf->st_ex_ctime = interpret_long_date( rdata+24 ); /* Change time. */ *attributes = IVAL( rdata, 32 ); diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c index af7800ba32..4349b0a700 100644 --- a/source3/libsmb/libsmb_stat.c +++ b/source3/libsmb/libsmb_stat.c @@ -188,9 +188,9 @@ SMBC_stat_ctx(SMBCCTX *context, setup_stat(context, st, (char *) fname, size, mode); - set_atimespec(st, access_time_ts); - set_ctimespec(st, change_time_ts); - set_mtimespec(st, write_time_ts); + st->st_atime = convert_timespec_to_time_t(access_time_ts); + st->st_ctime = convert_timespec_to_time_t(change_time_ts); + st->st_mtime = convert_timespec_to_time_t(write_time_ts); st->st_dev = srv->dev; TALLOC_FREE(frame); @@ -293,9 +293,9 @@ SMBC_fstat_ctx(SMBCCTX *context, setup_stat(context, st, file->fname, size, mode); - set_atimespec(st, access_time_ts); - set_ctimespec(st, change_time_ts); - set_mtimespec(st, write_time_ts); + st->st_atime = convert_timespec_to_time_t(access_time_ts); + st->st_ctime = convert_timespec_to_time_t(change_time_ts); + st->st_mtime = convert_timespec_to_time_t(write_time_ts); st->st_dev = file->srv->dev; TALLOC_FREE(frame); |