diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-05-05 12:18:47 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-06-03 14:03:50 +0200 |
commit | c43591c2168577a790051fc27840ab5cef7866c4 (patch) | |
tree | ff8e24efb47d96cd33b6b672d31bafcb635047bd /source4/ntvfs/posix/pvfs_fileinfo.c | |
parent | 0827b08a433b7dec91be7ca7406804087f3fef07 (diff) | |
download | samba-c43591c2168577a790051fc27840ab5cef7866c4.tar.gz samba-c43591c2168577a790051fc27840ab5cef7866c4.tar.bz2 samba-c43591c2168577a790051fc27840ab5cef7866c4.zip |
pvfs: add PVFS_RESOLVE_NO_OPENDB flag and get the write time from the opendb
By default get the current write time from the opendb,
but allow callers to pass PVFS_RESOLVE_NO_OPENDB
for performance reasons, if they don't need to the write time.
metze
(This used to be commit def52cc0988c26a815e74b3391e5857512408d90)
Diffstat (limited to 'source4/ntvfs/posix/pvfs_fileinfo.c')
-rw-r--r-- | source4/ntvfs/posix/pvfs_fileinfo.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source4/ntvfs/posix/pvfs_fileinfo.c b/source4/ntvfs/posix/pvfs_fileinfo.c index 04f6ad78d0..a14c8f64ae 100644 --- a/source4/ntvfs/posix/pvfs_fileinfo.c +++ b/source4/ntvfs/posix/pvfs_fileinfo.c @@ -52,8 +52,13 @@ static uint32_t dos_mode_from_stat(struct pvfs_state *pvfs, struct stat *st) /* fill in the dos file attributes for a file */ -NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name, int fd) +NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name, + uint_t flags, int fd) { + NTSTATUS status; + DATA_BLOB lkey; + NTTIME write_time; + /* make directories appear as size 0 with 1 link */ if (S_ISDIR(name->st.st_mode)) { name->st.st_size = 0; @@ -85,7 +90,29 @@ NTSTATUS pvfs_fill_dos_info(struct pvfs_state *pvfs, struct pvfs_filename *name, name->dos.file_id = (((uint64_t)name->st.st_dev)<<32) | name->st.st_ino; name->dos.flags = 0; - return pvfs_dosattrib_load(pvfs, name, fd); + status = pvfs_dosattrib_load(pvfs, name, fd); + NT_STATUS_NOT_OK_RETURN(status); + + if (flags & PVFS_RESOLVE_NO_OPENDB) { + return NT_STATUS_OK; + } + + status = pvfs_locking_key(name, name, &lkey); + NT_STATUS_NOT_OK_RETURN(status); + + status = odb_get_file_infos(pvfs->odb_context, &lkey, + NULL, &write_time); + data_blob_free(&lkey); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1,("WARNING: odb_get_file_infos: %s\n", nt_errstr(status))); + return status; + } + + if (!null_time(write_time)) { + name->dos.write_time = write_time; + } + + return NT_STATUS_OK; } |