Removed version number from file header.
[nivanova/samba-autobuild/.git] / source3 / include / vfs.h
1 /* 
2    Unix SMB/CIFS implementation.
3    VFS structures and parameters
4    Copyright (C) Tim Potter 1999
5    
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.
10    
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.
15    
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.
19 */
20
21 #ifndef _VFS_H
22 #define _VFS_H
23
24 /* Avoid conflict with an AIX include file */
25
26 #ifdef vfs_ops
27 #undef vfs_ops
28 #endif
29
30 /*
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...
33  */
34
35 /*
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
38  * vfs_ops below. JRA.
39  */
40
41 /* Changed to version 2 for CIFS UNIX extensions (mknod and link added). JRA. */
42 #define SMB_VFS_INTERFACE_VERSION 2
43
44 /* VFS operations structure */
45
46 struct connection_struct;
47 struct files_struct;
48 struct security_descriptor_info;
49
50 struct vfs_ops {
51
52         /* Disk operations */
53     
54         int (*connect)(struct connection_struct *conn, const char *service, const char *user);
55         void (*disconnect)(struct connection_struct *conn);
56         SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, const char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
57                         SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
58     
59         /* Directory operations */
60
61         DIR *(*opendir)(struct connection_struct *conn, const char *fname);
62         struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
63         int (*mkdir)(struct connection_struct *conn, const char *path, mode_t mode);
64         int (*rmdir)(struct connection_struct *conn, const char *path);
65         int (*closedir)(struct connection_struct *conn, DIR *dir);
66     
67         /* File operations */
68     
69         int (*open)(struct connection_struct *conn, const char *fname, int flags, mode_t mode);
70         int (*close)(struct files_struct *fsp, int fd);
71         ssize_t (*read)(struct files_struct *fsp, int fd, void *data, size_t n);
72         ssize_t (*write)(struct files_struct *fsp, int fd, const void *data, size_t n);
73         SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
74         int (*rename)(struct connection_struct *conn, const char *old, const char *new);
75         int (*fsync)(struct files_struct *fsp, int fd);
76         int (*stat)(struct connection_struct *conn, const char *fname, SMB_STRUCT_STAT *sbuf);
77         int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
78         int (*lstat)(struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf);
79         int (*unlink)(struct connection_struct *conn, const char *path);
80         int (*chmod)(struct connection_struct *conn, const char *path, mode_t mode);
81         int (*fchmod)(struct files_struct *fsp, int fd, mode_t mode);
82         int (*chown)(struct connection_struct *conn, const char *path, uid_t uid, gid_t gid);
83         int (*fchown)(struct files_struct *fsp, int fd, uid_t uid, gid_t gid);
84         int (*chdir)(struct connection_struct *conn, const char *path);
85         char *(*getwd)(struct connection_struct *conn, char *buf);
86         int (*utime)(struct connection_struct *conn, const char *path, struct utimbuf *times);
87         int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset);
88         BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
89         int (*symlink)(struct connection_struct *conn, const char *oldpath, const char *newpath);
90         int (*readlink)(struct connection_struct *conn, const char *path, char *buf, size_t bufsiz);
91         int (*link)(struct connection_struct *conn, const char *oldpath, const char *newpath);
92         int (*mknod)(struct connection_struct *conn, const char *path, mode_t mode, SMB_DEV_T dev);
93
94         /* NT ACL operations. */
95
96         size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc);
97         size_t (*get_nt_acl)(struct files_struct *fsp, const char *name, struct security_descriptor_info **ppdesc);
98         BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
99         BOOL (*set_nt_acl)(struct files_struct *fsp, const char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
100
101         /* POSIX ACL operations. */
102
103         int (*chmod_acl)(struct connection_struct *conn, const char *name, mode_t mode);
104         int (*fchmod_acl)(struct files_struct *fsp, int fd, mode_t mode);
105         
106 };
107
108 struct vfs_options {
109     struct vfs_options *prev, *next;
110     char *name;
111     char *value;
112 };
113
114 #endif /* _VFS_H */