| 1 | /*
|
|---|
| 2 | * Skeleton VFS module. Implements passthrough operation of all VFS
|
|---|
| 3 | * calls to disk functions.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (C) Tim Potter, 1999-2000
|
|---|
| 6 | * Copyright (C) Alexander Bokovoy, 2002
|
|---|
| 7 | * Copyright (C) Stefan (metze) Metzmacher, 2003
|
|---|
| 8 | *
|
|---|
| 9 | * This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | * it under the terms of the GNU General Public License as published by
|
|---|
| 11 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | * (at your option) any later version.
|
|---|
| 13 | *
|
|---|
| 14 | * This program is distributed in the hope that it will be useful,
|
|---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | * GNU General Public License for more details.
|
|---|
| 18 | *
|
|---|
| 19 | * You should have received a copy of the GNU General Public License
|
|---|
| 20 | * along with this program; if not, write to the Free Software
|
|---|
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | #include "includes.h"
|
|---|
| 26 |
|
|---|
| 27 | /* PLEASE,PLEASE READ THE VFS MODULES CHAPTER OF THE
|
|---|
| 28 | SAMBA DEVELOPERS GUIDE!!!!!!
|
|---|
| 29 | */
|
|---|
| 30 |
|
|---|
| 31 | /* If you take this file as template for your module
|
|---|
| 32 | * please make sure that you remove all functions you didn't
|
|---|
| 33 | * want to implement!!
|
|---|
| 34 | *
|
|---|
| 35 | * This passthrough operations are useless in reall vfs modules!
|
|---|
| 36 | *
|
|---|
| 37 | * --metze
|
|---|
| 38 | */
|
|---|
| 39 |
|
|---|
| 40 | static int skel_connect(vfs_handle_struct *handle, const char *service, const char *user)
|
|---|
| 41 | {
|
|---|
| 42 | return SMB_VFS_NEXT_CONNECT(handle, service, user);
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | static void skel_disconnect(vfs_handle_struct *handle)
|
|---|
| 46 | {
|
|---|
| 47 | SMB_VFS_NEXT_DISCONNECT(handle);
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | static SMB_BIG_UINT skel_disk_free(vfs_handle_struct *handle, const char *path,
|
|---|
| 51 | BOOL small_query, SMB_BIG_UINT *bsize,
|
|---|
| 52 | SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
|
|---|
| 53 | {
|
|---|
| 54 | return SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
|
|---|
| 55 | dfree, dsize);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
|
|---|
| 59 | {
|
|---|
| 60 | return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
|
|---|
| 64 | {
|
|---|
| 65 | return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | static int skel_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, BOOL labels)
|
|---|
| 69 | {
|
|---|
| 70 | return SMB_VFS_NEXT_GET_SHADOW_COPY_DATA(handle, fsp, shadow_copy_data, labels);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | static int skel_statvfs(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf)
|
|---|
| 74 | {
|
|---|
| 75 | return SMB_VFS_NEXT_STATVFS(handle, path, statbuf);
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr)
|
|---|
| 79 | {
|
|---|
| 80 | return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
|---|
| 84 | {
|
|---|
| 85 | return SMB_VFS_NEXT_READDIR(handle, dirp);
|
|---|
| 86 | }
|
|---|
| 87 |
|
|---|
| 88 | static void skel_seekdir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset)
|
|---|
| 89 | {
|
|---|
| 90 | return SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
|
|---|
| 91 | }
|
|---|
| 92 |
|
|---|
| 93 | static long skel_telldir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
|---|
| 94 | {
|
|---|
| 95 | return SMB_VFS_NEXT_TELLDIR(handle, dirp);
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | static void skel_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
|
|---|
| 99 | {
|
|---|
| 100 | return SMB_VFS_NEXT_REWINDDIR(handle, dirp);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | static int skel_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode)
|
|---|
| 104 | {
|
|---|
| 105 | return SMB_VFS_NEXT_MKDIR(handle, path, mode);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | static int skel_rmdir(vfs_handle_struct *handle, const char *path)
|
|---|
| 109 | {
|
|---|
| 110 | return SMB_VFS_NEXT_RMDIR(handle, path);
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | static int skel_closedir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dir)
|
|---|
| 114 | {
|
|---|
| 115 | return SMB_VFS_NEXT_CLOSEDIR(handle, dir);
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | static int skel_open(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode)
|
|---|
| 119 | {
|
|---|
| 120 | return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | static int skel_close(vfs_handle_struct *handle, files_struct *fsp, int fd)
|
|---|
| 124 | {
|
|---|
| 125 | return SMB_VFS_NEXT_CLOSE(handle, fsp, fd);
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | static ssize_t skel_read(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n)
|
|---|
| 129 | {
|
|---|
| 130 | return SMB_VFS_NEXT_READ(handle, fsp, fd, data, n);
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| 133 | static ssize_t skel_pread(vfs_handle_struct *handle, files_struct *fsp, int fd, void *data, size_t n, SMB_OFF_T offset)
|
|---|
| 134 | {
|
|---|
| 135 | return SMB_VFS_NEXT_PREAD(handle, fsp, fd, data, n, offset);
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | static ssize_t skel_write(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n)
|
|---|
| 139 | {
|
|---|
| 140 | return SMB_VFS_NEXT_WRITE(handle, fsp, fd, data, n);
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | static ssize_t skel_pwrite(vfs_handle_struct *handle, files_struct *fsp, int fd, const void *data, size_t n, SMB_OFF_T offset)
|
|---|
| 144 | {
|
|---|
| 145 | return SMB_VFS_NEXT_PWRITE(handle, fsp, fd, data, n, offset);
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | static SMB_OFF_T skel_lseek(vfs_handle_struct *handle, files_struct *fsp, int filedes, SMB_OFF_T offset, int whence)
|
|---|
| 149 | {
|
|---|
| 150 | return SMB_VFS_NEXT_LSEEK(handle, fsp, filedes, offset, whence);
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | static int skel_rename(vfs_handle_struct *handle, const char *oldname, const char *newname)
|
|---|
| 154 | {
|
|---|
| 155 | return SMB_VFS_NEXT_RENAME(handle, oldname, newname);
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp, int fd)
|
|---|
| 159 | {
|
|---|
| 160 | return SMB_VFS_NEXT_FSYNC(handle, fsp, fd);
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | static int skel_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf)
|
|---|
| 164 | {
|
|---|
| 165 | return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_STRUCT_STAT *sbuf)
|
|---|
| 169 | {
|
|---|
| 170 | return SMB_VFS_NEXT_FSTAT(handle, fsp, fd, sbuf);
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | static int skel_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
|
|---|
| 174 | {
|
|---|
| 175 | return SMB_VFS_NEXT_LSTAT(handle, path, sbuf);
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | static int skel_unlink(vfs_handle_struct *handle, const char *path)
|
|---|
| 179 | {
|
|---|
| 180 | return SMB_VFS_NEXT_UNLINK(handle, path);
|
|---|
| 181 | }
|
|---|
| 182 |
|
|---|
| 183 | static int skel_chmod(vfs_handle_struct *handle, const char *path, mode_t mode)
|
|---|
| 184 | {
|
|---|
| 185 | return SMB_VFS_NEXT_CHMOD(handle, path, mode);
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | static int skel_fchmod(vfs_handle_struct *handle, files_struct *fsp, int fd, mode_t mode)
|
|---|
| 189 | {
|
|---|
| 190 | return SMB_VFS_NEXT_FCHMOD(handle, fsp, fd, mode);
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | static int skel_chown(vfs_handle_struct *handle, const char *path, uid_t uid, gid_t gid)
|
|---|
| 194 | {
|
|---|
| 195 | return SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | static int skel_fchown(vfs_handle_struct *handle, files_struct *fsp, int fd, uid_t uid, gid_t gid)
|
|---|
| 199 | {
|
|---|
| 200 | return SMB_VFS_NEXT_FCHOWN(handle, fsp, fd, uid, gid);
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | static int skel_chdir(vfs_handle_struct *handle, const char *path)
|
|---|
| 204 | {
|
|---|
| 205 | return SMB_VFS_NEXT_CHDIR(handle, path);
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 | static char *skel_getwd(vfs_handle_struct *handle, char *buf)
|
|---|
| 209 | {
|
|---|
| 210 | return SMB_VFS_NEXT_GETWD(handle, buf);
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 | static int skel_ntimes(vfs_handle_struct *handle, const char *path, const struct timespec ts[2])
|
|---|
| 214 | {
|
|---|
| 215 | return SMB_VFS_NEXT_NTIMES(handle, path, ts);
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | static int skel_ftruncate(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T offset)
|
|---|
| 219 | {
|
|---|
| 220 | return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, fd, offset);
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | static BOOL skel_lock(vfs_handle_struct *handle, files_struct *fsp, int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
|
|---|
| 224 | {
|
|---|
| 225 | return SMB_VFS_NEXT_LOCK(handle, fsp, fd, op, offset, count, type);
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | static BOOL skel_getlock(vfs_handle_struct *handle, files_struct *fsp, int fd, SMB_OFF_T *poffset, SMB_OFF_T *pcount, int *ptype, pid_t *ppid)
|
|---|
|
|---|