lib/system.c: Fixed gcc warnings.
[kai/samba.git] / source3 / 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 /* Types used in the definition of VFS operations.  These are included
26    here so the vfs.h file can be included by VFS modules without
27    having to pull in unnecessary amounts of other stuff.  Note to VFS
28    writers: you must include config.h before including this file.
29    The following type definitions reference the HAVE_* symbols which
30    are defined in config.h */
31
32 #ifndef SMB_OFF_T
33 #  ifdef HAVE_OFF64_T
34 #    define SMB_OFF_T off64_t
35 #  else
36 #    define SMB_OFF_T off_t
37 #  endif
38 #endif
39
40 #ifndef SMB_STRUCT_STAT
41 #  if defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
42 #    define SMB_STRUCT_STAT struct stat64
43 #  else
44 #    define SMB_STRUCT_STAT struct stat
45 #  endif
46 #endif
47
48 #ifndef _BOOL
49 typedef int BOOL;
50 #endif
51
52 #ifndef _PSTRING
53 #define PSTRING_LEN 1024
54 #define FSTRING_LEN 128
55
56 typedef char pstring[PSTRING_LEN];
57 typedef char fstring[FSTRING_LEN];
58 #define _PSTRING
59 #endif
60
61 #if defined(HAVE_LONGLONG)
62 #define SMB_BIG_UINT unsigned long long
63 #else
64 #define SMB_BIG_UINT unsigned long
65 #endif
66
67 /* Information from the connection_struct passed to the vfs layer */
68
69 struct vfs_connection_struct {
70
71     /* Connection information */
72
73     BOOL printer;
74     BOOL ipc;
75     BOOL read_only;
76     BOOL admin_user;
77
78     /* Handle on dlopen() call */
79
80     void *dl_handle;
81
82     /* Paths */
83
84     pstring dirpath;
85     pstring connectpath;
86     pstring origpath;
87     pstring service;
88     
89     /* Information on user who *opened* this connection */
90
91     pstring user;
92     uid_t uid;
93     gid_t gid;
94     int ngroups;
95     gid_t *groups;
96 };
97
98 /* Avoid conflict with an AIX include file */
99
100 #ifdef vfs_ops
101 #undef vfs_ops
102 #endif
103
104 /* VFS operations structure */
105
106 struct vfs_ops {
107
108     /* Disk operations */
109     
110     int (*connect)(struct vfs_connection_struct *conn, char *service, 
111                    char *user);
112     void (*disconnect)(void);
113     SMB_BIG_UINT (*disk_free)(char *path, BOOL small_query, SMB_BIG_UINT *bsize, 
114                               SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
115     
116     /* Directory operations */
117
118     DIR *(*opendir)(char *fname);
119     struct dirent *(*readdir)(DIR *dirp);
120     int (*mkdir)(char *path, mode_t mode);
121     int (*rmdir)(char *path);
122     int (*closedir)(DIR *dir);
123     
124     /* File operations */
125     
126     int (*open)(char *fname, int flags, mode_t mode);
127     int (*close)(int fd);
128     ssize_t (*read)(int fd, char *data, size_t n);
129     ssize_t (*write)(int fd, char *data, size_t n);
130     SMB_OFF_T (*lseek)(int filedes, SMB_OFF_T offset, int whence);
131     int (*rename)(char *old, char *new);
132     void (*fsync)(int fd);
133     int (*stat)(char *fname, SMB_STRUCT_STAT *sbuf);
134     int (*fstat)(int fd, SMB_STRUCT_STAT *sbuf);
135     int (*lstat)(char *path, SMB_STRUCT_STAT *sbuf);
136     int (*unlink)(char *path);
137     int (*chmod)(char *path, mode_t mode);
138     int (*utime)(char *path, struct utimbuf *times);
139 };
140
141 struct vfs_options {
142     struct vfs_options *prev, *next;
143     char *name;
144     char *value;
145 };
146
147 #endif /* _VFS_H */