2 Unix SMB/Netbios implementation.
4 s Wrap disk only vfs functions to sidestep dodgy compilers.
5 Copyright (C) Tim Potter 1998
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.
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.
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.
24 /* Check for NULL pointer parameters in vfswrap_* functions */
26 #define VFS_CHECK_NULL
28 /* We don't want to have NULL function pointers lying around. Someone
29 is sure to try and execute them. These stubs are used to prevent
32 int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service,
35 return 0; /* Return >= 0 for success */
38 void vfswrap_dummy_disconnect(void)
44 SMB_BIG_UINT vfswrap_disk_free(char *path, BOOL small_query, SMB_BIG_UINT *bsize,
45 SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
50 if ((path == NULL) || (bsize == NULL) || (dfree == NULL) ||
53 smb_panic("NULL pointer passed to vfswrap_disk_free() function\n");
57 result = sys_disk_free(path, small_query, bsize, dfree, dsize);
61 /* Directory operations */
63 DIR *vfswrap_opendir(char *fname)
69 smb_panic("NULL pointer passed to vfswrap_opendir()\n");
73 result = opendir(fname);
77 struct dirent *vfswrap_readdir(DIR *dirp)
79 struct dirent *result;
83 smb_panic("NULL pointer passed to vfswrap_readdir()\n");
87 result = readdir(dirp);
91 int vfswrap_mkdir(char *path, mode_t mode)
97 smb_panic("NULL pointer passed to vfswrap_mkdir()\n");
101 result = mkdir(path, mode);
105 int vfswrap_rmdir(char *path)
109 #ifdef VFS_CHECK_NULL
111 smb_panic("NULL pointer passed to vfswrap_rmdir()\n");
115 result = rmdir(path);
119 int vfswrap_closedir(DIR *dirp)
123 #ifdef VFS_CHECK_NULL
125 smb_panic("NULL pointer passed to vfswrap_closedir()\n");
129 result = closedir(dirp);
133 /* File operations */
135 int vfswrap_open(char *fname, int flags, mode_t mode)
139 #ifdef VFS_CHECK_NULL
141 smb_panic("NULL pointer passed to vfswrap_open()\n");
145 result = sys_open(fname, flags, mode);
149 int vfswrap_close(int fd)
157 ssize_t vfswrap_read(int fd, char *data, size_t n)
161 #ifdef VFS_CHECK_NULL
163 smb_panic("NULL pointer passed to vfswrap_read()\n");
167 result = read(fd, data, n);
171 ssize_t vfswrap_write(int fd, char *data, size_t n)
175 #ifdef VFS_CHECK_NULL
177 smb_panic("NULL pointer passed to vfswrap_write()\n");
181 result = write(fd, data, n);
185 SMB_OFF_T vfswrap_lseek(int filedes, SMB_OFF_T offset, int whence)
189 result = sys_lseek(filedes, offset, whence);
193 int vfswrap_rename(char *old, char *new)
197 #ifdef VFS_CHECK_NULL
198 if ((old == NULL) || (new == NULL)) {
199 smb_panic("NULL pointer passed to vfswrap_rename()\n");
203 result = rename(old, new);
207 int vfswrap_fsync(int fd)
216 int vfswrap_stat(char *fname, SMB_STRUCT_STAT *sbuf)
220 #ifdef VFS_CHECK_NULL
221 if ((fname == NULL) || (sbuf == NULL)) {
222 smb_panic("NULL pointer passed to vfswrap_stat()\n");
226 result = sys_stat(fname, sbuf);
230 int vfswrap_fstat(int fd, SMB_STRUCT_STAT *sbuf)
234 #ifdef VFS_CHECK_NULL
236 smb_panic("NULL pointer passed to vfswrap_fstat()\n");
240 result = sys_fstat(fd, sbuf);
244 int vfswrap_lstat(char *path,
245 SMB_STRUCT_STAT *sbuf)
249 #ifdef VFS_CHECK_NULL
250 if ((path == NULL) || (sbuf == NULL)) {
251 smb_panic("NULL pointer passed to vfswrap_lstat()\n");
255 result = sys_lstat(path, sbuf);
259 int vfswrap_unlink(char *path)
263 #ifdef VFS_CHECK_NULL
265 smb_panic("NULL pointer passed to vfswrap_unlink()\n");
269 result = unlink(path);
273 int vfswrap_chmod(char *path, mode_t mode)
277 #ifdef VFS_CHECK_NULL
279 smb_panic("NULL pointer passed to vfswrap_chmod()\n");
283 result = chmod(path, mode);
287 int vfswrap_utime(char *path, struct utimbuf *times)
291 #ifdef VFS_CHECK_NULL
292 if ((path == NULL) || (times == NULL)) {
293 smb_panic("NULL pointer passed to vfswrap_utime()\n");
297 result = utime(path, times);
301 int vfswrap_ftruncate(int fd, SMB_OFF_T offset)
305 result = sys_ftruncate(fd, offset);
309 BOOL vfswrap_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
311 return fcntl_lock(fd, op, offset, count,type);