From 3020ec12a39276eaf3978323f4048b8a2e430bea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 17:22:31 -0800 Subject: Fix the mess that ab just made of the new VFS code. NEEDS MORE TESTING ! Jeremy. (This used to be commit bcc94aed6f03211866aa85753a90fece87846ba9) --- source3/include/vfs.h | 50 +++++++++++++++++++++----------------------- source3/include/vfs_macros.h | 38 ++++++++++++++++----------------- 2 files changed, 43 insertions(+), 45 deletions(-) (limited to 'source3/include') diff --git a/source3/include/vfs.h b/source3/include/vfs.h index be3cd91520..b0da7e81a5 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -70,7 +70,6 @@ * timestamp resolition. JRA. */ /* Changed to version21 to add chflags operation -- jpeach */ /* Changed to version22 to add lchown operation -- jra */ -/* Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ /* Leave at 22 - not yet released. But change set_nt_acl to return an NTSTATUS. jra. */ /* Leave at 22 - not yet released. Add file_id_create operation. --metze */ /* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */ @@ -104,8 +103,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ - - +/* Leave at 22 - not yet released. Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ #define SMB_VFS_INTERFACE_VERSION 22 @@ -266,7 +264,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_IS_REMOTESTORAGE, /* This should always be last enum value */ - + SMB_VFS_OP_LAST } vfs_op_type; @@ -276,7 +274,7 @@ typedef enum _vfs_op_type { struct vfs_ops { struct vfs_fn_pointers { /* Disk operations */ - + int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user); void (*disconnect)(struct vfs_handle_struct *handle); SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize, @@ -285,9 +283,9 @@ struct vfs_ops { int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels); int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf); - + /* Directory operations */ - + SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes); SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp); void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset); @@ -296,9 +294,9 @@ struct vfs_ops { int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode); int (*rmdir)(struct vfs_handle_struct *handle, const char *path); int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir); - + /* File operations */ - + int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); @@ -343,7 +341,7 @@ struct vfs_ops { struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode); /* NT ACL operations. */ - + NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 security_info, @@ -361,12 +359,12 @@ struct vfs_ops { const char *name, uint32 security_info_sent, struct security_descriptor *psd); - + /* POSIX ACL operations. */ - + int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode); int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); - + int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); @@ -413,11 +411,11 @@ struct vfs_ops { int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout); bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); - + /* offline operations */ - int (*is_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); - int (*set_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - bool (*is_remotestorage)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); + int (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); + int (*set_offline)(struct vfs_handle_struct *handle, const char *path); + bool (*is_remotestorage)(struct vfs_handle_struct *handle, const char *path); } ops; @@ -540,7 +538,7 @@ struct vfs_ops { struct vfs_handle_struct *aio_fsync; struct vfs_handle_struct *aio_suspend; struct vfs_handle_struct *aio_force; - + /* offline operations */ struct vfs_handle_struct *is_offline; struct vfs_handle_struct *set_offline; @@ -550,22 +548,22 @@ struct vfs_ops { /* Possible VFS operation layers (per-operation) - + These values are used by VFS subsystem when building vfs_ops for connection from multiple VFS modules. Internally, Samba differentiates only opaque and transparent layers at this process. Other types are used for providing better diagnosing facilities. - + Most modules will provide transparent layers. Opaque layer is for modules which implement actual file system calls (like DB-based VFS). For example, default POSIX VFS which is built in into Samba is an opaque VFS module. - + Other layer types (audit, splitter, scanner) were designed to provide different degree of transparency and for diagnosing VFS module behaviour. - + Each module can implement several layers at the same time provided that only one layer is used per each operation. - + */ typedef enum _vfs_op_layer { @@ -584,7 +582,7 @@ typedef enum _vfs_op_layer { /* VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem, - which describes all operations this module is willing to intercept. + which describes all operations this module is willing to intercept. VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs using this information. */ @@ -609,12 +607,12 @@ typedef struct vfs_handle_struct { typedef struct vfs_statvfs_struct { /* For undefined recommended transfer size return -1 in that field */ uint32 OptimalTransferSize; /* bsize on some os, iosize on other os */ - uint32 BlockSize; + uint32 BlockSize; /* The next three fields are in terms of the block size. (above). If block size is unknown, 4096 would be a - reasonable block size for a server to report. + reasonable block size for a server to report. Note that returning the blocks/blocksavail removes need to make a second call (to QFSInfo level 0x103 to get this info. UserBlockAvail is typically less than or equal to BlocksAvail, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index dbba781377..39f245fa35 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -1,18 +1,18 @@ -/* +/* Unix SMB/CIFS implementation. VFS wrapper macros Copyright (C) Stefan (metze) Metzmacher 2003 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_CONNECT(conn, service, user) ((conn)->vfs.ops.connect_fn((conn)->vfs.handles.connect_hnd, (service), (user))) #define SMB_VFS_DISCONNECT(conn) ((conn)->vfs.ops.disconnect((conn)->vfs.handles.disconnect)) #define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs.ops.disk_free((conn)->vfs.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -44,7 +44,7 @@ #define SMB_VFS_MKDIR(conn, path, mode) ((conn)->vfs.ops.mkdir((conn)->vfs.handles.mkdir,(path), (mode))) #define SMB_VFS_RMDIR(conn, path) ((conn)->vfs.ops.rmdir((conn)->vfs.handles.rmdir, (path))) #define SMB_VFS_CLOSEDIR(conn, dir) ((conn)->vfs.ops.closedir((conn)->vfs.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) @@ -141,9 +141,9 @@ #define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(conn),(path))) -#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path))) +#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(path))) /******************************************************************* Don't access conn->vfs_opaque.ops directly!!! @@ -151,7 +151,7 @@ (Fixes should also go into the vfs_* and vfs_next_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_OPAQUE_CONNECT(conn, service, user) ((conn)->vfs_opaque.ops.connect_fn((conn)->vfs_opaque.handles.connect_hnd, (service), (user))) #define SMB_VFS_OPAQUE_DISCONNECT(conn) ((conn)->vfs_opaque.ops.disconnect((conn)->vfs_opaque.handles.disconnect)) #define SMB_VFS_OPAQUE_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs_opaque.ops.disk_free((conn)->vfs_opaque.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -169,7 +169,7 @@ #define SMB_VFS_OPAQUE_MKDIR(conn, path, mode) ((conn)->vfs_opaque.ops.mkdir((conn)->vfs_opaque.handles.mkdir,(path), (mode))) #define SMB_VFS_OPAQUE_RMDIR(conn, path) ((conn)->vfs_opaque.ops.rmdir((conn)->vfs_opaque.handles.rmdir, (path))) #define SMB_VFS_OPAQUE_CLOSEDIR(conn, dir) ((conn)->vfs_opaque.ops.closedir((conn)->vfs_opaque.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) @@ -266,9 +266,9 @@ #define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(conn),(path))) -#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path))) +#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(path))) /******************************************************************* Don't access handle->vfs_next.ops.* directly!!! @@ -276,7 +276,7 @@ (Fixes should go also into the vfs_* and vfs_opaque_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_NEXT_CONNECT(handle, service, user) ((handle)->vfs_next.ops.connect_fn((handle)->vfs_next.handles.connect_hnd, (service), (user))) #define SMB_VFS_NEXT_DISCONNECT(handle) ((handle)->vfs_next.ops.disconnect((handle)->vfs_next.handles.disconnect)) #define SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree ,dsize) ((handle)->vfs_next.ops.disk_free((handle)->vfs_next.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -295,7 +295,7 @@ #define SMB_VFS_NEXT_MKDIR(handle, path, mode) ((handle)->vfs_next.ops.mkdir((handle)->vfs_next.handles.mkdir,(path), (mode))) #define SMB_VFS_NEXT_RMDIR(handle, path) ((handle)->vfs_next.ops.rmdir((handle)->vfs_next.handles.rmdir, (path))) #define SMB_VFS_NEXT_CLOSEDIR(handle, dir) ((handle)->vfs_next.ops.closedir((handle)->vfs_next.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) @@ -392,8 +392,8 @@ #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_NEXT_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_next.ops.is_offline((conn)->vfs_next.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_NEXT_SET_OFFLINE(conn,path) ((conn)->vfs_next.ops.set_offline((conn)->vfs_next.handles.set_offline,(conn),(path))) -#define SMB_VFS_NEXT_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_next.ops.is_remotestorage((conn)->vfs_next.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf,offline) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path))) +#define SMB_VFS_NEXT_IS_REMOTESTORAGE(handle,path) ((handle)->vfs_next.ops.is_remotestorage((handle)->vfs_next.handles.is_remotestorage,(path))) #endif /* _VFS_MACROS_H */ -- cgit