2 Unix SMB/CIFS implementation.
3 VFS structures and parameters
4 Copyright (C) Tim Potter 1999
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* Avoid conflict with an AIX include file */
31 * As we're now (thanks Andrew ! :-) using file_structs and connection
32 * structs in the vfs - then anyone writing a vfs must include includes.h...
36 * This next constant specifies the version number of the VFS interface
37 * this smbd will load. Increment this if *ANY* changes are made to the
41 /* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */
42 /* Changed to version 3 for POSIX acl extensions. JRA. */
43 #define SMB_VFS_INTERFACE_VERSION 3
45 /* VFS operations structure */
47 struct connection_struct;
49 struct security_descriptor_info;
55 int (*connect)(struct connection_struct *conn, const char *service, const char *user);
56 void (*disconnect)(struct connection_struct *conn);
57 SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize,
58 SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
60 /* Directory operations */
62 DIR *(*opendir)(struct connection_struct *conn, const char *fname);
63 struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
64 int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode);
65 int (*rmdir)(struct connection_struct *conn, const char *path);
66 int (*closedir)(struct connection_struct *conn, DIR *dir);
70 int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode);
71 int (*close)(struct files_struct *fsp, int fd);
72 ssize_t (*read)(struct files_struct *fsp, int fd, void *data, size_t n);
73 ssize_t (*write)(struct files_struct *fsp, int fd, const void *data, size_t n);
74 SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
75 int (*rename)(struct connection_struct *conn, const char *old, const char *new);
76 int (*fsync)(struct files_struct *fsp, int fd);
77 int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
78 int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
79 int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
80 int (*unlink)(struct connection_struct *conn, const char *path);
81 int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode);
82 int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode);
83 int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
84 int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
85 int (*chdir)(struct connection_struct *conn, const char *path);
86 char *(*getwd)(struct connection_struct *conn, char *buf);
87 int (*utime)(struct connection_struct *conn, const char *path, struct utimbuf *times);
88 int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset);
89 BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
90 int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath);
91 int (*readlink)(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
92 int (*link)(struct connection_struct *conn, const char *oldpath, const char *newpath);
93 int (*mknod)(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev);
94 char *(*realpath)(struct connection_struct *conn, const char *path, char *resolved_path);
96 /* NT ACL operations. */
98 size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc);
99 size_t (*get_nt_acl)(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc);
100 BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
101 BOOL (*set_nt_acl)(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
103 /* POSIX ACL operations. */
105 int (*chmod_acl)(struct connection_struct *conn, const char *name, mode_t mode);
106 int (*fchmod_acl)(struct files_struct *fsp, int fd, mode_t mode);
108 int (*sys_acl_get_entry)(struct connection_struct *conn, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p);
109 int (*sys_acl_get_tag_type)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p);
110 int (*sys_acl_get_permset)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p);
111 void * (*sys_acl_get_qualifier)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry_d);
112 SMB_ACL_T (*sys_acl_get_file)(struct connection_struct *conn, const char *path_p, SMB_ACL_TYPE_T type);
113 SMB_ACL_T (*sys_acl_get_fd)(struct files_struct *fsp, int fd);
114 int (*sys_acl_clear_perms)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset);
115 int (*sys_acl_add_perm)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
116 char * (*sys_acl_to_text)(struct connection_struct *conn, SMB_ACL_T theacl, ssize_t *plen);
117 SMB_ACL_T (*sys_acl_init)(struct connection_struct *conn, int count);
118 int (*sys_acl_create_entry)(struct connection_struct *conn, SMB_ACL_T *pacl, SMB_ACL_ENTRY_T *pentry);
119 int (*sys_acl_set_tag_type)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_TAG_T tagtype);
120 int (*sys_acl_set_qualifier)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, void *qual);
121 int (*sys_acl_set_permset)(struct connection_struct *conn, SMB_ACL_ENTRY_T entry, SMB_ACL_PERMSET_T permset);
122 int (*sys_acl_valid)(struct connection_struct *conn, SMB_ACL_T theacl );
123 int (*sys_acl_set_file)(struct connection_struct *conn, const char *name, SMB_ACL_TYPE_T acltype, SMB_ACL_T theacl);
124 int (*sys_acl_set_fd)(struct files_struct *fsp, int fd, SMB_ACL_T theacl);
125 int (*sys_acl_delete_def_file)(struct connection_struct *conn, const char *path);
126 int (*sys_acl_get_perm)(struct connection_struct *conn, SMB_ACL_PERMSET_T permset, SMB_ACL_PERM_T perm);
127 int (*sys_acl_free_text)(struct connection_struct *conn, char *text);
128 int (*sys_acl_free_acl)(struct connection_struct *conn, SMB_ACL_T posix_acl);
129 int (*sys_acl_free_qualifier)(struct connection_struct *conn, void *qualifier, SMB_ACL_TAG_T tagtype);
133 struct vfs_options *prev, *next;