summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-14 15:34:42 +0200
committerVolker Lendecke <vl@samba.org>2009-05-26 17:48:23 +0200
commit49ca690b4b22ee6e597179059c9442e94c5bd423 (patch)
treead233a9bcfee2d467824290448ca366219dbd301 /source3/client
parent52f2f9449f8d53aa9181d656a4b54a007c80fa81 (diff)
downloadsamba-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/client')
-rw-r--r--source3/client/client.c42
-rw-r--r--source3/client/clitar.c5
2 files changed, 26 insertions, 21 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 59e5c1ad72..13dee6081d 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3022,7 +3022,7 @@ static int cmd_getfacl(void)
}
d_printf("# file: %s\n", src);
- d_printf("# owner: %u\n# group: %u\n", (unsigned int)sbuf.st_uid, (unsigned int)sbuf.st_gid);
+ d_printf("# owner: %u\n# group: %u\n", (unsigned int)sbuf.st_ex_uid, (unsigned int)sbuf.st_ex_gid);
if (num_file_acls == 0 && num_dir_acls == 0) {
d_printf("No acls found.\n");
@@ -3120,6 +3120,7 @@ static int cmd_stat(void)
fstring mode_str;
SMB_STRUCT_STAT sbuf;
struct tm *lt;
+ time_t tmp_time;
if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
d_printf("stat file\n");
@@ -3152,30 +3153,31 @@ static int cmd_stat(void)
/* Print out the stat values. */
d_printf("File: %s\n", src);
d_printf("Size: %-12.0f\tBlocks: %u\t%s\n",
- (double)sbuf.st_size,
- (unsigned int)sbuf.st_blocks,
- filetype_to_str(sbuf.st_mode));
+ (double)sbuf.st_ex_size,
+ (unsigned int)sbuf.st_ex_blocks,
+ filetype_to_str(sbuf.st_ex_mode));
#if defined(S_ISCHR) && defined(S_ISBLK)
- if (S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode)) {
+ if (S_ISCHR(sbuf.st_ex_mode) || S_ISBLK(sbuf.st_ex_mode)) {
d_printf("Inode: %.0f\tLinks: %u\tDevice type: %u,%u\n",
- (double)sbuf.st_ino,
- (unsigned int)sbuf.st_nlink,
- unix_dev_major(sbuf.st_rdev),
- unix_dev_minor(sbuf.st_rdev));
+ (double)sbuf.st_ex_ino,
+ (unsigned int)sbuf.st_ex_nlink,
+ unix_dev_major(sbuf.st_ex_rdev),
+ unix_dev_minor(sbuf.st_ex_rdev));
} else
#endif
d_printf("Inode: %.0f\tLinks: %u\n",
- (double)sbuf.st_ino,
- (unsigned int)sbuf.st_nlink);
+ (double)sbuf.st_ex_ino,
+ (unsigned int)sbuf.st_ex_nlink);
d_printf("Access: (0%03o/%s)\tUid: %u\tGid: %u\n",
- ((int)sbuf.st_mode & 0777),
- unix_mode_to_str(mode_str, sbuf.st_mode),
- (unsigned int)sbuf.st_uid,
- (unsigned int)sbuf.st_gid);
+ ((int)sbuf.st_ex_mode & 0777),
+ unix_mode_to_str(mode_str, sbuf.st_ex_mode),
+ (unsigned int)sbuf.st_ex_uid,
+ (unsigned int)sbuf.st_ex_gid);
- lt = localtime(&sbuf.st_atime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_atime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3183,7 +3185,8 @@ static int cmd_stat(void)
}
d_printf("Access: %s\n", mode_str);
- lt = localtime(&sbuf.st_mtime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_mtime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3191,7 +3194,8 @@ static int cmd_stat(void)
}
d_printf("Modify: %s\n", mode_str);
- lt = localtime(&sbuf.st_ctime);
+ tmp_time = convert_timespec_to_time_t(sbuf.st_ex_ctime);
+ lt = localtime(&tmp_time);
if (lt) {
strftime(mode_str, sizeof(mode_str), "%Y-%m-%d %T %z", lt);
} else {
@@ -3400,7 +3404,7 @@ static int cmd_newer(void)
ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL);
if (ok && (sys_stat(buf,&sbuf) == 0)) {
- newer_than = sbuf.st_mtime;
+ newer_than = convert_timespec_to_time_t(sbuf.st_ex_mtime);
DEBUG(1,("Getting files newer than %s",
time_to_asc(newer_than)));
} else {
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index ff71924555..d973329427 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -412,7 +412,7 @@ static void dotareof(int f)
/* Could be a pipe, in which case S_ISREG should fail,
* and we should write out at full size */
if (tp > 0) {
- size_t towrite = S_ISREG(stbuf.st_mode) ? tp : tbufsiz;
+ size_t towrite = S_ISREG(stbuf.st_ex_mode) ? tp : tbufsiz;
if (sys_write(f, tarbuf, towrite) != towrite) {
DEBUG(0,("dotareof: sys_write fail\n"));
}
@@ -1793,7 +1793,8 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
SMB_STRUCT_STAT stbuf;
if (sys_stat(argv[Optind], &stbuf) == 0) {
- newer_than = stbuf.st_mtime;
+ newer_than = convert_timespec_to_time_t(
+ stbuf.st_ex_mtime);
DEBUG(1,("Getting files newer than %s",
time_to_asc(newer_than)));
newOptind++;