Added John Reillys patch for error code returns from clean_up_printer_driver_strunct()
[sfrench/samba-autobuild/.git] / source / include / vfs.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    VFS structures and parameters
5    Copyright (C) Tim Potter 1999
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #ifndef _VFS_H
23 #define _VFS_H
24
25 /* Avoid conflict with an AIX include file */
26
27 #ifdef vfs_ops
28 #undef vfs_ops
29 #endif
30
31 /*
32  * As we're now (thanks Andrew ! :-) using file_structs and connection
33  * structs in the vfs - then anyone writing a vfs must include includes.h...
34  */
35
36 /* VFS operations structure */
37
38 struct connection_struct;
39 struct files_struct;
40 struct security_descriptor_info;
41
42 struct vfs_ops {
43
44     /* Disk operations */
45     
46     int (*connect)(struct connection_struct *conn, char *service, char *user);
47     void (*disconnect)(struct connection_struct *conn);
48     SMB_BIG_UINT (*disk_free)(struct connection_struct *conn, char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
49                               SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
50     
51     /* Directory operations */
52
53     DIR *(*opendir)(struct connection_struct *conn, char *fname);
54     struct dirent *(*readdir)(struct connection_struct *conn, DIR *dirp);
55     int (*mkdir)(struct connection_struct *conn, char *path, mode_t mode);
56     int (*rmdir)(struct connection_struct *conn, char *path);
57     int (*closedir)(struct connection_struct *conn, DIR *dir);
58     
59     /* File operations */
60     
61     int (*open)(struct connection_struct *conn, char *fname, int flags, mode_t mode);
62     int (*close)(struct files_struct *fsp, int fd);
63     ssize_t (*read)(struct files_struct *fsp, int fd, char *data, size_t n);
64     ssize_t (*write)(struct files_struct *fsp, int fd, char *data, size_t n);
65     SMB_OFF_T (*lseek)(struct files_struct *fsp, int filedes, SMB_OFF_T offset, int whence);
66     int (*rename)(struct connection_struct *conn, char *old, char *new);
67     int (*fsync)(struct files_struct *fsp, int fd);
68     int (*stat)(struct connection_struct *conn, char *fname, SMB_STRUCT_STAT *sbuf);
69     int (*fstat)(struct files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf);
70     int (*lstat)(struct connection_struct *conn, char *path, SMB_STRUCT_STAT *sbuf);
71     int (*unlink)(struct connection_struct *conn, char *path);
72     int (*chmod)(struct connection_struct *conn, char *path, mode_t mode);
73         int (*chown)(struct connection_struct *conn, char *path, uid_t uid, gid_t gid);
74         int (*chdir)(struct connection_struct *conn, char *path);
75         char *(*getwd)(struct connection_struct *conn, char *buf);
76     int (*utime)(struct connection_struct *conn, char *path, struct utimbuf *times);
77         int (*ftruncate)(struct files_struct *fsp, int fd, SMB_OFF_T offset);
78         BOOL (*lock)(struct files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type);
79
80         size_t (*fget_nt_acl)(struct files_struct *fsp, int fd, struct security_descriptor_info **ppdesc);
81         size_t (*get_nt_acl)(struct files_struct *fsp, char *name, struct security_descriptor_info **ppdesc);
82         BOOL (*fset_nt_acl)(struct files_struct *fsp, int fd, uint32 security_info_sent, struct security_descriptor_info *psd);
83         BOOL (*set_nt_acl)(struct files_struct *fsp, char *name, uint32 security_info_sent, struct security_descriptor_info *psd);
84 };
85
86 struct vfs_options {
87     struct vfs_options *prev, *next;
88     char *name;
89     char *value;
90 };
91
92 #endif /* _VFS_H */