4 * Copyright (C) Tim Potter, 1999-2000
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.
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.
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.
20 * $Id: skel.c,v 1.2 2000/02/04 05:08:16 tpot Exp $
41 /* Function prototypes */
43 int skel_connect(struct vfs_connection_struct
*conn
, char *svc
, char *user
);
44 void skel_disconnect(void);
45 SMB_BIG_UINT
skel_disk_free(char *path
, BOOL smallquery
, SMB_BIG_UINT
*bsize
,
46 SMB_BIG_UINT
*dfree
, SMB_BIG_UINT
*dsize
);
48 DIR *skel_opendir(char *fname
);
49 struct dirent
*skel_readdir(DIR *dirp
);
50 int skel_mkdir(char *path
, mode_t mode
);
51 int skel_rmdir(char *path
);
52 int skel_closedir(DIR *dir
);
54 int skel_open(char *fname
, int flags
, mode_t mode
);
55 int skel_close(int fd
);
56 ssize_t
skel_read(int fd
, char *data
, size_t n
);
57 ssize_t
skel_write(int fd
, char *data
, size_t n
);
58 SMB_OFF_T
skel_lseek(int filedes
, SMB_OFF_T offset
, int whence
);
59 int skel_rename(char *old
, char *new);
60 void skel_fsync(int fd
);
61 int skel_stat(char *fname
, SMB_STRUCT_STAT
*sbuf
);
62 int skel_fstat(int fd
, SMB_STRUCT_STAT
*sbuf
);
63 int skel_lstat(char *path
, SMB_STRUCT_STAT
*sbuf
);
64 int skel_unlink(char *path
);
65 int skel_chmod(char *path
, mode_t mode
);
66 int skel_utime(char *path
, struct utimbuf
*times
);
68 /* VFS operations structure */
70 struct vfs_ops skel_ops
= {
78 /* Directory operations */
103 /* VFS initialisation - return vfs_ops function pointer structure */
105 struct vfs_ops
*vfs_init(void)
110 /* Implementation of VFS functions. Insert your useful stuff here */
112 extern struct vfs_ops default_vfs_ops
; /* For passthrough operation */
114 int skel_connect(struct vfs_connection_struct
*conn
, char *svc
, char *user
)
116 return default_vfs_ops
.connect(conn
, svc
, user
);
119 void skel_disconnect(void)
121 default_vfs_ops
.disconnect();
124 SMB_BIG_UINT
skel_disk_free(char *path
, BOOL small_query
, SMB_BIG_UINT
*bsize
,
125 SMB_BIG_UINT
*dfree
, SMB_BIG_UINT
*dsize
)
127 return default_vfs_ops
.disk_free(path
, small_query
, bsize
, dfree
, dsize
);
130 DIR *skel_opendir(char *fname
)
132 return default_vfs_ops
.opendir(fname
);
135 struct dirent
*skel_readdir(DIR *dirp
)
137 return default_vfs_ops
.readdir(dirp
);
140 int skel_mkdir(char *path
, mode_t mode
)
142 return default_vfs_ops
.mkdir(path
, mode
);
145 int skel_rmdir(char *path
)
147 return default_vfs_ops
.rmdir(path
);
150 int skel_closedir(DIR *dir
)
152 return default_vfs_ops
.closedir(dir
);
155 int skel_open(char *fname
, int flags
, mode_t mode
)
157 return default_vfs_ops
.open(fname
, flags
, mode
);
160 int skel_close(int fd
)
162 return default_vfs_ops
.close(fd
);
165 ssize_t
skel_read(int fd
, char *data
, size_t n
)
167 return default_vfs_ops
.read(fd
, data
, n
);
170 ssize_t
skel_write(int fd
, char *data
, size_t n
)
172 return default_vfs_ops
.write(fd
, data
, n
);
175 SMB_OFF_T
skel_lseek(int filedes
, SMB_OFF_T offset
, int whence
)
177 return default_vfs_ops
.lseek(filedes
, offset
, whence
);
180 int skel_rename(char *old
, char *new)
182 return default_vfs_ops
.rename(old
, new);
185 void skel_fsync(int fd
)
187 default_vfs_ops
.fsync(fd
);
190 int skel_stat(char *fname
, SMB_STRUCT_STAT
*sbuf
)
192 return default_vfs_ops
.stat(fname
, sbuf
);
195 int skel_fstat(int fd
, SMB_STRUCT_STAT
*sbuf
)
197 return default_vfs_ops
.fstat(fd
, sbuf
);
200 int skel_lstat(char *path
, SMB_STRUCT_STAT
*sbuf
)
202 return default_vfs_ops
.lstat(path
, sbuf
);
205 int skel_unlink(char *path
)
207 return default_vfs_ops
.unlink(path
);
210 int skel_chmod(char *path
, mode_t mode
)
212 return default_vfs_ops
.chmod(path
, mode
);
215 int skel_utime(char *path
, struct utimbuf
*times
)
217 return default_vfs_ops
.utime(path
, times
);