1 /* usmb - mount SMB shares via FUSE and Samba
2 * Copyright (C) 2006-2009 Geoff Johnstone
4 * Portions of this file are taken from Samba 3.2's libsmbclient.h:
5 * Copyright (C) Andrew Tridgell 1998
6 * Copyright (C) Richard Sharpe 2000
7 * Copyright (C) John Terpsra 2000
8 * Copyright (C) Tom Jansen (Ninja ISD) 2002
9 * Copyright (C) Derrell Lipman 2003-2008
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 3 of the License, or (at your
14 * option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #ifndef SAMBA_30_COMPAT_H
26 #define SAMBA_30_COMPAT_H
29 #include <libsmbclient.h>
30 #include <sys/statvfs.h>
33 int usmb_statfs (const char *path UNUSED
, struct statvfs
*vfs UNUSED
);
34 int compat_truncate (const char *path
, SMBCFILE
*file
, off_t size
);
39 typedef int (*smbc_chmod_fn
) (SMBCCTX
*c
, const char *fname
, mode_t mode
);
41 static inline smbc_chmod_fn
smbc_getFunctionChmod (SMBCCTX
*c
)
47 typedef int (*smbc_close_fn
) (SMBCCTX
*c
, SMBCFILE
*file
);
49 static inline smbc_close_fn
smbc_getFunctionClose (SMBCCTX
*c
)
55 typedef int (*smbc_closedir_fn
) (SMBCCTX
*c
, SMBCFILE
*dir
);
57 static inline smbc_closedir_fn
smbc_getFunctionClosedir (SMBCCTX
*c
)
63 typedef SMBCFILE
* (*smbc_creat_fn
) (SMBCCTX
*c
,
67 static inline smbc_creat_fn
smbc_getFunctionCreat (SMBCCTX
*c
)
73 typedef int (*smbc_fstat_fn
) (SMBCCTX
*c
, SMBCFILE
*file
, struct stat
*st
);
75 static inline smbc_fstat_fn
smbc_getFunctionFstat (SMBCCTX
*c
)
81 typedef int (*smbc_getxattr_fn
) (SMBCCTX
*context
,
87 static inline smbc_getxattr_fn
smbc_getFunctionGetxattr (SMBCCTX
*c
)
93 typedef int (*smbc_listxattr_fn
) (SMBCCTX
*context
,
98 static inline smbc_listxattr_fn
smbc_getFunctionListxattr (SMBCCTX
*c
)
104 typedef off_t (*smbc_lseek_fn
) (SMBCCTX
*c
,
109 static inline smbc_lseek_fn
smbc_getFunctionLseek (SMBCCTX
*c
)
115 typedef int (*smbc_mkdir_fn
) (SMBCCTX
*c
, const char *fname
, mode_t mode
);
117 static inline smbc_mkdir_fn
smbc_getFunctionMkdir (SMBCCTX
*c
)
123 typedef SMBCFILE
* (*smbc_open_fn
) (SMBCCTX
*c
,
128 static inline smbc_open_fn
smbc_getFunctionOpen (SMBCCTX
*c
)
134 typedef SMBCFILE
* (*smbc_opendir_fn
) (SMBCCTX
*c
, const char *fname
);
136 static inline smbc_opendir_fn
smbc_getFunctionOpendir (SMBCCTX
*c
)
142 typedef ssize_t (*smbc_read_fn
) (SMBCCTX
*c
,
147 static inline smbc_read_fn
smbc_getFunctionRead (SMBCCTX
*c
)
153 typedef struct smbc_dirent
* (*smbc_readdir_fn
) (SMBCCTX
*c
, SMBCFILE
*dir
);
155 static inline smbc_readdir_fn
smbc_getFunctionReaddir (SMBCCTX
*c
)
161 typedef int (*smbc_removexattr_fn
) (SMBCCTX
*context
,
165 static inline smbc_removexattr_fn
smbc_getFunctionRemovexattr (SMBCCTX
*c
)
167 return c
->removexattr
;
171 typedef int (*smbc_rename_fn
) (SMBCCTX
*ocontext
,
176 static inline smbc_rename_fn
smbc_getFunctionRename (SMBCCTX
*c
)
182 typedef int (*smbc_rmdir_fn
) (SMBCCTX
*c
, const char *fname
);
184 static inline smbc_rmdir_fn
smbc_getFunctionRmdir (SMBCCTX
*c
)
190 typedef int (*smbc_lseekdir_fn
)(SMBCCTX
*c
,
194 static inline smbc_lseekdir_fn
smbc_getFunctionLseekdir (SMBCCTX
*c
)
200 typedef int (*smbc_setxattr_fn
) (SMBCCTX
*context
,
207 static inline smbc_setxattr_fn
smbc_getFunctionSetxattr (SMBCCTX
*c
)
213 typedef int (*smbc_stat_fn
) (SMBCCTX
*c
, const char *fname
, struct stat
*s
);
215 static inline smbc_stat_fn
smbc_getFunctionStat (SMBCCTX
*c
)
221 typedef int (*smbc_unlink_fn
) (SMBCCTX
*c
, const char *fname
);
223 static inline smbc_unlink_fn
smbc_getFunctionUnlink (SMBCCTX
*c
)
229 typedef int (*smbc_utimes_fn
) (SMBCCTX
*c
,
231 struct timeval
*tbuf
);
233 static inline smbc_utimes_fn
smbc_getFunctionUtimes (SMBCCTX
*c
)
239 typedef ssize_t (*smbc_write_fn
) (SMBCCTX
*c
,
244 static inline smbc_write_fn
smbc_getFunctionWrite (SMBCCTX
*c
)
250 typedef void (*smbc_get_auth_fn
) (const char *srv
,
254 char *pw
, int pwlen
);
256 static inline void smbc_setFunctionAuthData (SMBCCTX
*c
,
257 smbc_get_auth_data_fn fn
)
259 c
->callbacks
.auth_fn
= fn
;
263 static inline void smbc_setTimeout (SMBCCTX
*c
, int timeout
)
265 c
->timeout
= timeout
;
269 static inline void smbc_setUser (SMBCCTX
*c
, char *user
)
275 static inline void smbc_setWorkgroup (SMBCCTX
*c
, char *workgroup
)
277 c
->workgroup
= workgroup
;