From 49ca690b4b22ee6e597179059c9442e94c5bd423 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 14 May 2009 15:34:42 +0200 Subject: 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. --- source3/printing/nt_printing.c | 4 ++-- source3/printing/printfsp.c | 2 +- source3/printing/printing.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 39e9661bd68..a05e0def7b7 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -1352,7 +1352,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr if (SMB_VFS_FSTAT(fsp, &st) == -1) { goto error_exit; } - old_create_time = st.st_mtime; + old_create_time = convert_timespec_to_time_t(st.st_ex_mtime); DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", (long)old_create_time)); } @@ -1404,7 +1404,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr if (SMB_VFS_FSTAT(fsp, &st) == -1) { goto error_exit; } - new_create_time = st.st_mtime; + new_create_time = convert_timespec_to_time_t(st.st_ex_mtime); DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", (long)new_create_time)); } diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c index 243b8ea03b7..a8e175a6845 100644 --- a/source3/printing/printfsp.c +++ b/source3/printing/printfsp.c @@ -75,7 +75,7 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn, string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); fsp->wcp = NULL; SMB_VFS_FSTAT(fsp, psbuf); - fsp->mode = psbuf->st_mode; + fsp->mode = psbuf->st_ex_mode; fsp->file_id = vfs_file_id_from_sbuf(conn, psbuf); return NT_STATUS_OK; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index ce98792096a..3f337d01bee 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -2563,7 +2563,7 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type) if ((close_type == NORMAL_CLOSE || close_type == SHUTDOWN_CLOSE) && (sys_fstat(pjob->fd, &sbuf) == 0)) { - pjob->size = sbuf.st_size; + pjob->size = sbuf.st_ex_size; close(pjob->fd); pjob->fd = -1; } else { -- cgit v1.2.1