Add set-create-time VFS call.
authorJames Peach <jpeach@apple.com>
Mon, 15 Oct 2007 21:30:33 +0000 (14:30 -0700)
committerJames Peach <jpeach@apple.com>
Mon, 15 Oct 2007 21:30:33 +0000 (14:30 -0700)
This patch adds a Samba VFS call to support altering the file
creation time on a path.

source/include/vfs.h
source/include/vfs_macros.h
source/modules/vfs_default.c

index 541266301505200fd617aa6d6d7f47db21bf6dd5..0fba26ef4cc51aef57f2b9dcde44a51eaded262e 100644 (file)
@@ -150,6 +150,7 @@ typedef enum _vfs_op_type {
        SMB_VFS_OP_CHDIR,
        SMB_VFS_OP_GETWD,
        SMB_VFS_OP_NTIMES,
+       SMB_VFS_OP_SET_CREATE_TIME,
        SMB_VFS_OP_FTRUNCATE,
        SMB_VFS_OP_LOCK,
        SMB_VFS_OP_KERNEL_FLOCK,
@@ -277,6 +278,7 @@ struct vfs_ops {
                int (*chdir)(struct vfs_handle_struct *handle, const char *path);
                char *(*getwd)(struct vfs_handle_struct *handle, char *buf);
                int (*ntimes)(struct vfs_handle_struct *handle, const char *path, const struct timespec ts[2]);
+               int (*set_create_time)(struct vfs_handle_struct *handle, const char *path, time_t times);
                int (*ftruncate)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, SMB_OFF_T offset);
                BOOL (*lock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
                int (*kernel_flock)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd, uint32 share_mode);
@@ -403,6 +405,7 @@ struct vfs_ops {
                struct vfs_handle_struct *chdir;
                struct vfs_handle_struct *getwd;
                struct vfs_handle_struct *ntimes;
+               struct vfs_handle_struct *set_create_time;
                struct vfs_handle_struct *ftruncate;
                struct vfs_handle_struct *lock;
                struct vfs_handle_struct *kernel_flock;
index c441f93c7cf72cbaf8f6df690a52ab3604673599..030d70856034afc0474d0f87ada2579cdc3c0b67 100644 (file)
@@ -68,6 +68,7 @@
 #define SMB_VFS_CHDIR(conn, path) ((conn)->vfs.ops.chdir((conn)->vfs.handles.chdir, (path)))
 #define SMB_VFS_GETWD(conn, buf) ((conn)->vfs.ops.getwd((conn)->vfs.handles.getwd, (buf)))
 #define SMB_VFS_NTIMES(conn, path, ts) ((conn)->vfs.ops.ntimes((conn)->vfs.handles.ntimes, (path), (ts)))
+#define SMB_VFS_SET_CREATE_TIME(conn, path, createtime) ((conn)->vfs.ops.set_create_time((conn)->vfs.handles.set_create_time, (path), (createtime)))
 #define SMB_VFS_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs.ops.ftruncate((fsp)->conn->vfs.handles.ftruncate, (fsp), (fd), (offset)))
 #define SMB_VFS_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs.ops.lock((fsp)->conn->vfs.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
 #define SMB_VFS_KERNEL_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs.ops.kernel_flock((fsp)->conn->vfs.handles.kernel_flock, (fsp), (fd), (share_mode)))
 #define SMB_VFS_OPAQUE_CHDIR(conn, path) ((conn)->vfs_opaque.ops.chdir((conn)->vfs_opaque.handles.chdir, (path)))
 #define SMB_VFS_OPAQUE_GETWD(conn, buf) ((conn)->vfs_opaque.ops.getwd((conn)->vfs_opaque.handles.getwd, (buf)))
 #define SMB_VFS_OPAQUE_NTIMES(conn, path, ts) ((conn)->vfs_opaque.ops.ntimes((conn)->vfs_opaque.handles.ntimes, (path), (ts)))
+#define SMB_VFS_OPAQUE_SET_CREATE_TIME(conn, path, createtime) ((conn)->vfs_opaque.ops.set_create_time((conn)->vfs_opaque.handles.set_create_time, (path), (createtime)))
 #define SMB_VFS_OPAQUE_FTRUNCATE(fsp, fd, offset) ((fsp)->conn->vfs_opaque.ops.ftruncate((fsp)->conn->vfs_opaque.handles.ftruncate, (fsp), (fd), (offset)))
 #define SMB_VFS_OPAQUE_LOCK(fsp, fd, op, offset, count, type) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
 #define SMB_VFS_OPAQUE_FLOCK(fsp, fd, share_mode) ((fsp)->conn->vfs_opaque.ops.lock((fsp)->conn->vfs_opaque.handles.kernel_flock, (fsp), (fd), (share_mode)))
 #define SMB_VFS_NEXT_CHDIR(handle, path) ((handle)->vfs_next.ops.chdir((handle)->vfs_next.handles.chdir, (path)))
 #define SMB_VFS_NEXT_GETWD(handle, buf) ((handle)->vfs_next.ops.getwd((handle)->vfs_next.handles.getwd, (buf)))
 #define SMB_VFS_NEXT_NTIMES(handle, path, ts) ((handle)->vfs_next.ops.ntimes((handle)->vfs_next.handles.ntimes, (path), (ts)))
+#define SMB_VFS_NEXT_SET_CREATE_TIME(conn, path, createtime) ((conn)->vfs_next.ops.set_create_time((conn)->vfs_next.handles.set_create_time, (path), (createtime)))
 #define SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset) ((handle)->vfs_next.ops.ftruncate((handle)->vfs_next.handles.ftruncate, (fsp), (fd), (offset)))
 #define SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type) ((handle)->vfs_next.ops.lock((handle)->vfs_next.handles.lock, (fsp), (fd) ,(op), (offset), (count), (type)))
 #define SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, fd, share_mode)((handle)->vfs_next.ops.kernel_flock((handle)->vfs_next.handles.kernel_flock, (fsp), (fd), (share_mode)))
index ddcd081ce6930983133e4efd83d0f93091f6bcc0..b32f664fdb3223633a6b13fc7fabd110cd7d872d 100644 (file)
@@ -645,6 +645,12 @@ static int vfswrap_ntimes(vfs_handle_struct *handle, const char *path, const str
        return result;
 }
 
+static int vfswrap_set_create_time(vfs_handle_struct *handle,  const char *path, time_t createtime)
+{
+       errno = ENOSYS;
+       return -1;
+}
+
 /*********************************************************************
  A version of ftruncate that will write the space on disk if strict
  allocate is set.
@@ -1280,6 +1286,8 @@ static vfs_op_tuple vfs_default_ops[] = {
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_ntimes),    SMB_VFS_OP_NTIMES,
         SMB_VFS_LAYER_OPAQUE},
+       {SMB_VFS_OP(vfswrap_set_create_time),   SMB_VFS_OP_SET_CREATE_TIME,
+        SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_ftruncate), SMB_VFS_OP_FTRUNCATE,
         SMB_VFS_LAYER_OPAQUE},
        {SMB_VFS_OP(vfswrap_lock),      SMB_VFS_OP_LOCK,