Coherent handling of different Samba versions. - susmb - mounting of SMB/CIFS s… | |
git clone git://git.codemadness.org/susmb | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit d3ac58484d569b375cf84a6dd03fcf0d48cf1725 | |
parent d1bc973ac1ce50729419cbd0e8cda236cb72bf46 | |
Author: Geoff Johnstone <[email protected]> | |
Date: Fri, 10 Apr 2009 19:08:11 +0100 | |
Coherent handling of different Samba versions. | |
Diffstat: | |
M Makefile.in | 10 +++++----- | |
M configure.ac | 18 ++++++++++++++++++ | |
D samba30-compat.h | 266 -----------------------------… | |
A samba30_compat.c | 28 ++++++++++++++++++++++++++++ | |
A samba32_compat.c | 43 ++++++++++++++++++++++++++++++ | |
A samba33_compat.c | 43 ++++++++++++++++++++++++++++++ | |
A samba3x-compat.h | 271 +++++++++++++++++++++++++++++… | |
M usmb.c | 24 +++--------------------- | |
M usmb.h | 1 + | |
M usmb_dir.c | 2 +- | |
M usmb_file.c | 2 +- | |
11 files changed, 414 insertions(+), 294 deletions(-) | |
--- | |
diff --git a/Makefile.in b/Makefile.in | |
@@ -30,10 +30,10 @@ CFLAGS += @LIBXML2_CFLAGS@ @GLIB_CFLAGS@ @FUSE_CFLAGS@ | |
LIBS += @LIBXML2_LIBS@ @GLIB_LIBS@ @FUSE_LIBS@ | |
SOURCES = conffile.c options.c password.c usmb.c usmb_dir.c usmb_file.c \ | |
- utils.c version.c xml.c | |
+ utils.c version.c xml.c samba@SAMBA_VERSION@_compat.c | |
OBJECTS = $(SOURCES:.c=.o) | |
-PROGRAM = usmb | |
+PROGRAM = @PACKAGE_NAME@ | |
all: $(PROGRAM) | |
@@ -98,9 +98,9 @@ conffile.o: conffile.c utils.h xml.h config.rng.h | |
options.o: options.c options.h utils.h version.h | |
password.o: password.c password.h utils.h | |
usmb.o: usmb.c conffile.h options.h usmb.h usmb_dir.h usmb_file.h utils.h \ | |
- password.h version.h samba30-compat.h | |
-usmb_dir.o: samba30-compat.h usmb_dir.c usmb_dir.h usmb.h utils.h | |
-usmb_file.o: samba30-compat.h usmb_file.c usmb_file.h usmb.h utils.h | |
+ password.h version.h samba3x-compat.h | |
+usmb_dir.o: samba3x-compat.h usmb_dir.c usmb_dir.h usmb.h utils.h | |
+usmb_file.o: samba3x-compat.h usmb_file.c usmb_file.h usmb.h utils.h | |
utils.o: utils.c utils.h | |
version.o: version.c version.h | |
xml.o: xml.c xml.h utils.h | |
diff --git a/configure.ac b/configure.ac | |
@@ -44,6 +44,24 @@ AC_DEFINE([MUSTCHECK], [MUSTCHECK_], | |
AC_CHECK_LIB([smbclient], [smbc_init], [], | |
[AC_MSG_ERROR(Cannot find libsmbclient.)]) | |
+AC_CHECK_LIB([smbclient], [smbc_getFunctionFtruncate], | |
+ [AC_DEFINE([HAVE_SAMBA33], [], | |
+ [Whether we have Samba 3.3 o… | |
+ SAMBA_VERSION=33]) | |
+ | |
+AC_CHECK_LIB([smbclient], [smbc_getFunctionOpen], | |
+ [AC_DEFINE([HAVE_SAMBA32], [], | |
+ [Whether we have Samba 3.2 o… | |
+ if test "$SAMBA_VERSION" = "… | |
+ SAMBA_VERSION=… | |
+ fi]) | |
+ | |
+if test "$SAMBA_VERSION" = '' ; then | |
+ SAMBA_VERSION=30 | |
+fi | |
+ | |
+AC_SUBST(SAMBA_VERSION,[$SAMBA_VERSION]) | |
+ | |
PKG_PROG_PKG_CONFIG | |
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0]) | |
PKG_CHECK_MODULES([GLIB], [glib-2.0]) | |
diff --git a/samba30-compat.h b/samba30-compat.h | |
@@ -1,266 +0,0 @@ | |
-/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
- * | |
- * Portions of this file are taken from Samba 3.2's libsmbclient.h: | |
- * Copyright (C) Andrew Tridgell 1998 | |
- * Copyright (C) Richard Sharpe 2000 | |
- * Copyright (C) John Terpsra 2000 | |
- * Copyright (C) Tom Jansen (Ninja ISD) 2002 | |
- * Copyright (C) Derrell Lipman 2003-2008 | |
- * | |
- * This program is free software; you can redistribute it and/or modify | |
- * it under the terms of the GNU General Public License as published by the | |
- * Free Software Foundation; either version 3 of the License, or (at your | |
- * option) any later version. | |
- * | |
- * This program is distributed in the hope that it will be useful, | |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
- * GNU General Public License for more details. | |
- * | |
- * You should have received a copy of the GNU General Public License | |
- * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
- */ | |
- | |
-#ifndef SAMBA_30_COMPAT_H | |
- #define SAMBA_30_COMPAT_H | |
- | |
- #include <libsmbclient.h> | |
- | |
- #ifndef DEPRECATED_SMBC_INTERFACE | |
- | |
- typedef int (*smbc_chmod_fn) (SMBCCTX *c, const char *fname, mode_t mode); | |
- | |
- static inline smbc_chmod_fn smbc_getFunctionChmod (SMBCCTX *c) | |
- { | |
- return c->chmod; | |
- } | |
- | |
- | |
- typedef int (*smbc_close_fn) (SMBCCTX *c, SMBCFILE *file); | |
- | |
- static inline smbc_close_fn smbc_getFunctionClose (SMBCCTX *c) | |
- { | |
- return c->close_fn; | |
- } | |
- | |
- | |
- typedef int (*smbc_closedir_fn) (SMBCCTX *c, SMBCFILE *dir); | |
- | |
- static inline smbc_closedir_fn smbc_getFunctionClosedir (SMBCCTX *c) | |
- { | |
- return c->closedir; | |
- } | |
- | |
- | |
- typedef SMBCFILE * (*smbc_creat_fn) (SMBCCTX *c, | |
- const char *path, | |
- mode_t mode); | |
- | |
- static inline smbc_creat_fn smbc_getFunctionCreat (SMBCCTX *c) | |
- { | |
- return c->creat; | |
- } | |
- | |
- | |
- typedef int (*smbc_fstat_fn) (SMBCCTX *c, SMBCFILE *file, struct stat *st); | |
- | |
- static inline smbc_fstat_fn smbc_getFunctionFstat (SMBCCTX *c) | |
- { | |
- return c->fstat; | |
- } | |
- | |
- | |
- typedef int (*smbc_getxattr_fn) (SMBCCTX *context, | |
- const char *fname, | |
- const char *name, | |
- const void *value, | |
- size_t size); | |
- | |
- static inline smbc_getxattr_fn smbc_getFunctionGetxattr (SMBCCTX *c) | |
- { | |
- return c->getxattr; | |
- } | |
- | |
- | |
- typedef int (*smbc_listxattr_fn) (SMBCCTX *context, | |
- const char *fname, | |
- char *list, | |
- size_t size); | |
- | |
- static inline smbc_listxattr_fn smbc_getFunctionListxattr (SMBCCTX *c) | |
- { | |
- return c->listxattr; | |
- } | |
- | |
- | |
- typedef off_t (*smbc_lseek_fn) (SMBCCTX *c, | |
- SMBCFILE *file, | |
- off_t offset, | |
- int whence); | |
- | |
- static inline smbc_lseek_fn smbc_getFunctionLseek (SMBCCTX *c) | |
- { | |
- return c->lseek; | |
- } | |
- | |
- | |
- typedef int (*smbc_mkdir_fn) (SMBCCTX *c, const char *fname, mode_t mode); | |
- | |
- static inline smbc_mkdir_fn smbc_getFunctionMkdir (SMBCCTX *c) | |
- { | |
- return c->mkdir; | |
- } | |
- | |
- | |
- typedef SMBCFILE * (*smbc_open_fn) (SMBCCTX *c, | |
- const char *fname, | |
- int flags, | |
- mode_t mode); | |
- | |
- static inline smbc_open_fn smbc_getFunctionOpen (SMBCCTX *c) | |
- { | |
- return c->open; | |
- } | |
- | |
- | |
- typedef SMBCFILE * (*smbc_opendir_fn) (SMBCCTX *c, const char *fname); | |
- | |
- static inline smbc_opendir_fn smbc_getFunctionOpendir (SMBCCTX *c) | |
- { | |
- return c->opendir; | |
- } | |
- | |
- | |
- typedef ssize_t (*smbc_read_fn) (SMBCCTX *c, | |
- SMBCFILE *file, | |
- void *buf, | |
- size_t count); | |
- | |
- static inline smbc_read_fn smbc_getFunctionRead (SMBCCTX *c) | |
- { | |
- return c->read; | |
- } | |
- | |
- | |
- typedef struct smbc_dirent * (*smbc_readdir_fn) (SMBCCTX *c, SMBCFILE *dir… | |
- | |
- static inline smbc_readdir_fn smbc_getFunctionReaddir (SMBCCTX *c) | |
- { | |
- return c->readdir; | |
- } | |
- | |
- | |
- typedef int (*smbc_removexattr_fn) (SMBCCTX *context, | |
- const char *fname, | |
- const char *name); | |
- | |
- static inline smbc_removexattr_fn smbc_getFunctionRemovexattr (SMBCCTX *c) | |
- { | |
- return c->removexattr; | |
- } | |
- | |
- | |
- typedef int (*smbc_rename_fn) (SMBCCTX *ocontext, | |
- const char *oname, | |
- SMBCCTX *ncontext, | |
- const char *nname); | |
- | |
- static inline smbc_rename_fn smbc_getFunctionRename (SMBCCTX *c) | |
- { | |
- return c->rename; | |
- } | |
- | |
- | |
- typedef int (*smbc_rmdir_fn) (SMBCCTX *c, const char *fname); | |
- | |
- static inline smbc_rmdir_fn smbc_getFunctionRmdir (SMBCCTX *c) | |
- { | |
- return c->rmdir; | |
- } | |
- | |
- | |
- typedef int (*smbc_setxattr_fn) (SMBCCTX *context, | |
- const char *fname, | |
- const char *name, | |
- const void *value, | |
- size_t size, | |
- int flags); | |
- | |
- static inline smbc_setxattr_fn smbc_getFunctionSetxattr (SMBCCTX *c) | |
- { | |
- return c->setxattr; | |
- } | |
- | |
- | |
- typedef int (*smbc_stat_fn) (SMBCCTX *c, const char *fname, struct stat *s… | |
- | |
- static inline smbc_stat_fn smbc_getFunctionStat (SMBCCTX *c) | |
- { | |
- return c->stat; | |
- } | |
- | |
- | |
- typedef int (*smbc_unlink_fn) (SMBCCTX *c, const char *fname); | |
- | |
- static inline smbc_unlink_fn smbc_getFunctionUnlink (SMBCCTX *c) | |
- { | |
- return c->unlink; | |
- } | |
- | |
- | |
- typedef int (*smbc_utimes_fn) (SMBCCTX *c, | |
- const char *fname, | |
- struct timeval *tbuf); | |
- | |
- static inline smbc_utimes_fn smbc_getFunctionUtimes (SMBCCTX *c) | |
- { | |
- return c->utimes; | |
- } | |
- | |
- | |
- typedef ssize_t (*smbc_write_fn) (SMBCCTX *c, | |
- SMBCFILE *file, | |
- void *buf, | |
- size_t count); | |
- | |
- static inline smbc_write_fn smbc_getFunctionWrite (SMBCCTX *c) | |
- { | |
- return c->write; | |
- } | |
- | |
- | |
- typedef void (*smbc_get_auth_fn) (const char *srv, | |
- const char *shr, | |
- char *wg, int wglen, | |
- char *un, int unlen, | |
- char *pw, int pwlen); | |
- | |
- static inline void smbc_setFunctionAuthData (SMBCCTX *c, | |
- smbc_get_auth_data_fn fn) | |
- { | |
- c->callbacks.auth_fn = fn; | |
- } | |
- | |
- | |
- static inline void smbc_setTimeout (SMBCCTX *c, int timeout) | |
- { | |
- c->timeout = timeout; | |
- } | |
- | |
- | |
- static inline void smbc_setUser (SMBCCTX *c, char *user) | |
- { | |
- c->user = user; | |
- } | |
- | |
- | |
- static inline void smbc_setWorkgroup (SMBCCTX *c, char *workgroup) | |
- { | |
- c->workgroup = workgroup; | |
- } | |
- | |
- #endif | |
- | |
-#endif | |
- | |
diff --git a/samba30_compat.c b/samba30_compat.c | |
@@ -0,0 +1,28 @@ | |
+/* usmb - mount SMB shares via FUSE and Samba | |
+ * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * | |
+ * This program is free software; you can redistribute it and/or modify | |
+ * it under the terms of the GNU General Public License version 3 as | |
+ * published by the Free Software Foundation. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
+ * GNU General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU General Public License | |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
+ */ | |
+ | |
+#include "config.h" | |
+#include "samba3x-compat.h" | |
+#include "usmb_file.h" | |
+ | |
+ | |
+int usmb_statfs (const char *path UNUSED, struct statvfs *vfs UNUSED) | |
+{ | |
+ (void)path; | |
+ (void)vfs; | |
+ return -ENOSYS; | |
+} | |
+ | |
diff --git a/samba32_compat.c b/samba32_compat.c | |
@@ -0,0 +1,43 @@ | |
+/* usmb - mount SMB shares via FUSE and Samba | |
+ * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * | |
+ * This program is free software; you can redistribute it and/or modify | |
+ * it under the terms of the GNU General Public License version 3 as | |
+ * published by the Free Software Foundation. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
+ * GNU General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU General Public License | |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
+ */ | |
+ | |
+#include "config.h" | |
+#include <errno.h> | |
+#include <stdio.h> | |
+#include <stdlib.h> | |
+#include <string.h> | |
+#include "samba3x-compat.h" | |
+#include "usmb.h" | |
+#include "utils.h" | |
+ | |
+ | |
+int usmb_statfs (const char *path, struct statvfs *vfs) | |
+{ | |
+ if ((NULL == path) || (NULL == vfs)) | |
+ return -EINVAL; | |
+ | |
+ char *url = make_url (path); | |
+ if (NULL == url) | |
+ return -ENOMEM; | |
+ | |
+ DEBUG (fprintf (stderr, "statfs (%s, %p)\n", url, (void *)vfs)); | |
+ memset (vfs, 0, sizeof (*vfs)); | |
+ | |
+ int ret = (0 > smbc_getFunctionStatVFS (ctx) (ctx, url, vfs)) ? -errno : 0; | |
+ free (url); | |
+ return ret; | |
+} | |
+ | |
diff --git a/samba33_compat.c b/samba33_compat.c | |
@@ -0,0 +1,43 @@ | |
+/* usmb - mount SMB shares via FUSE and Samba | |
+ * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * | |
+ * This program is free software; you can redistribute it and/or modify | |
+ * it under the terms of the GNU General Public License version 3 as | |
+ * published by the Free Software Foundation. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
+ * GNU General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU General Public License | |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
+ */ | |
+ | |
+#include "config.h" | |
+#include <errno.h> | |
+#include <stdio.h> | |
+#include <stdlib.h> | |
+#include <string.h> | |
+#include "samba3x-compat.h" | |
+#include "usmb.h" | |
+#include "utils.h" | |
+ | |
+ | |
+int usmb_statfs (const char *path, struct statvfs *vfs) | |
+{ | |
+ if ((NULL == path) || (NULL == vfs)) | |
+ return -EINVAL; | |
+ | |
+ char *url = make_url (path); | |
+ if (NULL == url) | |
+ return -ENOMEM; | |
+ | |
+ DEBUG (fprintf (stderr, "statfs (%s, %p)\n", url, (void *)vfs)); | |
+ memset (vfs, 0, sizeof (*vfs)); | |
+ | |
+ int ret = (0 > smbc_getFunctionStatVFS (ctx) (ctx, url, vfs)) ? -errno : 0; | |
+ free (url); | |
+ return ret; | |
+} | |
+ | |
diff --git a/samba3x-compat.h b/samba3x-compat.h | |
@@ -0,0 +1,271 @@ | |
+/* usmb - mount SMB shares via FUSE and Samba | |
+ * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * | |
+ * Portions of this file are taken from Samba 3.2's libsmbclient.h: | |
+ * Copyright (C) Andrew Tridgell 1998 | |
+ * Copyright (C) Richard Sharpe 2000 | |
+ * Copyright (C) John Terpsra 2000 | |
+ * Copyright (C) Tom Jansen (Ninja ISD) 2002 | |
+ * Copyright (C) Derrell Lipman 2003-2008 | |
+ * | |
+ * This program is free software; you can redistribute it and/or modify | |
+ * it under the terms of the GNU General Public License as published by the | |
+ * Free Software Foundation; either version 3 of the License, or (at your | |
+ * option) any later version. | |
+ * | |
+ * This program is distributed in the hope that it will be useful, | |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
+ * GNU General Public License for more details. | |
+ * | |
+ * You should have received a copy of the GNU General Public License | |
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
+ */ | |
+ | |
+#ifndef SAMBA_30_COMPAT_H | |
+ #define SAMBA_30_COMPAT_H | |
+ | |
+ #include "config.h" | |
+ #include <libsmbclient.h> | |
+ | |
+ | |
+ int usmb_statfs (const char *path UNUSED, struct statvfs *vfs UNUSED); | |
+ | |
+ | |
+ #ifndef HAVE_SAMBA32 | |
+ | |
+ typedef int (*smbc_chmod_fn) (SMBCCTX *c, const char *fname, mode_t mode); | |
+ | |
+ static inline smbc_chmod_fn smbc_getFunctionChmod (SMBCCTX *c) | |
+ { | |
+ return c->chmod; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_close_fn) (SMBCCTX *c, SMBCFILE *file); | |
+ | |
+ static inline smbc_close_fn smbc_getFunctionClose (SMBCCTX *c) | |
+ { | |
+ return c->close_fn; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_closedir_fn) (SMBCCTX *c, SMBCFILE *dir); | |
+ | |
+ static inline smbc_closedir_fn smbc_getFunctionClosedir (SMBCCTX *c) | |
+ { | |
+ return c->closedir; | |
+ } | |
+ | |
+ | |
+ typedef SMBCFILE * (*smbc_creat_fn) (SMBCCTX *c, | |
+ const char *path, | |
+ mode_t mode); | |
+ | |
+ static inline smbc_creat_fn smbc_getFunctionCreat (SMBCCTX *c) | |
+ { | |
+ return c->creat; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_fstat_fn) (SMBCCTX *c, SMBCFILE *file, struct stat *st); | |
+ | |
+ static inline smbc_fstat_fn smbc_getFunctionFstat (SMBCCTX *c) | |
+ { | |
+ return c->fstat; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_getxattr_fn) (SMBCCTX *context, | |
+ const char *fname, | |
+ const char *name, | |
+ const void *value, | |
+ size_t size); | |
+ | |
+ static inline smbc_getxattr_fn smbc_getFunctionGetxattr (SMBCCTX *c) | |
+ { | |
+ return c->getxattr; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_listxattr_fn) (SMBCCTX *context, | |
+ const char *fname, | |
+ char *list, | |
+ size_t size); | |
+ | |
+ static inline smbc_listxattr_fn smbc_getFunctionListxattr (SMBCCTX *c) | |
+ { | |
+ return c->listxattr; | |
+ } | |
+ | |
+ | |
+ typedef off_t (*smbc_lseek_fn) (SMBCCTX *c, | |
+ SMBCFILE *file, | |
+ off_t offset, | |
+ int whence); | |
+ | |
+ static inline smbc_lseek_fn smbc_getFunctionLseek (SMBCCTX *c) | |
+ { | |
+ return c->lseek; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_mkdir_fn) (SMBCCTX *c, const char *fname, mode_t mode); | |
+ | |
+ static inline smbc_mkdir_fn smbc_getFunctionMkdir (SMBCCTX *c) | |
+ { | |
+ return c->mkdir; | |
+ } | |
+ | |
+ | |
+ typedef SMBCFILE * (*smbc_open_fn) (SMBCCTX *c, | |
+ const char *fname, | |
+ int flags, | |
+ mode_t mode); | |
+ | |
+ static inline smbc_open_fn smbc_getFunctionOpen (SMBCCTX *c) | |
+ { | |
+ return c->open; | |
+ } | |
+ | |
+ | |
+ typedef SMBCFILE * (*smbc_opendir_fn) (SMBCCTX *c, const char *fname); | |
+ | |
+ static inline smbc_opendir_fn smbc_getFunctionOpendir (SMBCCTX *c) | |
+ { | |
+ return c->opendir; | |
+ } | |
+ | |
+ | |
+ typedef ssize_t (*smbc_read_fn) (SMBCCTX *c, | |
+ SMBCFILE *file, | |
+ void *buf, | |
+ size_t count); | |
+ | |
+ static inline smbc_read_fn smbc_getFunctionRead (SMBCCTX *c) | |
+ { | |
+ return c->read; | |
+ } | |
+ | |
+ | |
+ typedef struct smbc_dirent * (*smbc_readdir_fn) (SMBCCTX *c, SMBCFILE *dir… | |
+ | |
+ static inline smbc_readdir_fn smbc_getFunctionReaddir (SMBCCTX *c) | |
+ { | |
+ return c->readdir; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_removexattr_fn) (SMBCCTX *context, | |
+ const char *fname, | |
+ const char *name); | |
+ | |
+ static inline smbc_removexattr_fn smbc_getFunctionRemovexattr (SMBCCTX *c) | |
+ { | |
+ return c->removexattr; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_rename_fn) (SMBCCTX *ocontext, | |
+ const char *oname, | |
+ SMBCCTX *ncontext, | |
+ const char *nname); | |
+ | |
+ static inline smbc_rename_fn smbc_getFunctionRename (SMBCCTX *c) | |
+ { | |
+ return c->rename; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_rmdir_fn) (SMBCCTX *c, const char *fname); | |
+ | |
+ static inline smbc_rmdir_fn smbc_getFunctionRmdir (SMBCCTX *c) | |
+ { | |
+ return c->rmdir; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_setxattr_fn) (SMBCCTX *context, | |
+ const char *fname, | |
+ const char *name, | |
+ const void *value, | |
+ size_t size, | |
+ int flags); | |
+ | |
+ static inline smbc_setxattr_fn smbc_getFunctionSetxattr (SMBCCTX *c) | |
+ { | |
+ return c->setxattr; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_stat_fn) (SMBCCTX *c, const char *fname, struct stat *s… | |
+ | |
+ static inline smbc_stat_fn smbc_getFunctionStat (SMBCCTX *c) | |
+ { | |
+ return c->stat; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_unlink_fn) (SMBCCTX *c, const char *fname); | |
+ | |
+ static inline smbc_unlink_fn smbc_getFunctionUnlink (SMBCCTX *c) | |
+ { | |
+ return c->unlink; | |
+ } | |
+ | |
+ | |
+ typedef int (*smbc_utimes_fn) (SMBCCTX *c, | |
+ const char *fname, | |
+ struct timeval *tbuf); | |
+ | |
+ static inline smbc_utimes_fn smbc_getFunctionUtimes (SMBCCTX *c) | |
+ { | |
+ return c->utimes; | |
+ } | |
+ | |
+ | |
+ typedef ssize_t (*smbc_write_fn) (SMBCCTX *c, | |
+ SMBCFILE *file, | |
+ void *buf, | |
+ size_t count); | |
+ | |
+ static inline smbc_write_fn smbc_getFunctionWrite (SMBCCTX *c) | |
+ { | |
+ return c->write; | |
+ } | |
+ | |
+ | |
+ typedef void (*smbc_get_auth_fn) (const char *srv, | |
+ const char *shr, | |
+ char *wg, int wglen, | |
+ char *un, int unlen, | |
+ char *pw, int pwlen); | |
+ | |
+ static inline void smbc_setFunctionAuthData (SMBCCTX *c, | |
+ smbc_get_auth_data_fn fn) | |
+ { | |
+ c->callbacks.auth_fn = fn; | |
+ } | |
+ | |
+ | |
+ static inline void smbc_setTimeout (SMBCCTX *c, int timeout) | |
+ { | |
+ c->timeout = timeout; | |
+ } | |
+ | |
+ | |
+ static inline void smbc_setUser (SMBCCTX *c, char *user) | |
+ { | |
+ c->user = user; | |
+ } | |
+ | |
+ | |
+ static inline void smbc_setWorkgroup (SMBCCTX *c, char *workgroup) | |
+ { | |
+ c->workgroup = workgroup; | |
+ } | |
+ | |
+ #endif | |
+ | |
+#endif | |
+ | |
diff --git a/usmb.c b/usmb.c | |
@@ -18,7 +18,7 @@ | |
#include <sys/time.h> // struct timeval needed by libsmbclient.h | |
#include <unistd.h> | |
#include <libsmbclient.h> | |
-#include "samba30-compat.h" | |
+#include "samba3x-compat.h" | |
#include <fuse.h> | |
#include <assert.h> | |
#include <errno.h> | |
@@ -112,24 +112,6 @@ bool create_smb_context (SMBCCTX **pctx) | |
} | |
-#if 0 | |
-static int usmb_statfs (const char *path, struct statvfs *vfs) | |
-{ | |
- if ((NULL == path) || (NULL == vfs)) | |
- return -EINVAL; | |
- | |
- memset (vfs, 0, sizeof (*vfs)); | |
- | |
- vfs->f_bsize = 32768; | |
- vfs->f_blocks = 0x7FFFFFFFl; | |
- vfs->f_bfree = 0x7FFFFFFFl; | |
- vfs->f_bavail = 0x7FFFFFFFl; | |
- | |
- return 0; | |
-} | |
-#endif | |
- | |
- | |
static void * usmb_init (struct fuse_conn_info *conn UNUSED) | |
{ | |
DEBUG (fputs ("usmb_init()\n", stderr)); | |
@@ -144,7 +126,7 @@ static void usmb_destroy (void *unused UNUSED) | |
// probably won't (can't ?) implement these: | |
-// readlink mknod symlink flush fsync statfs | |
+// readlink mknod symlink flush fsync | |
// no easy way of implementing these: | |
// access ftruncate | |
@@ -172,7 +154,7 @@ static struct fuse_operations fuse_ops = { | |
SET_ELEMENT (.open, usmb_open), | |
SET_ELEMENT (.read, usmb_read), | |
SET_ELEMENT (.write, usmb_write), | |
- SET_ELEMENT (.statfs, NULL), | |
+ SET_ELEMENT (.statfs, usmb_statfs), | |
SET_ELEMENT (.flush, NULL), | |
SET_ELEMENT (.release, usmb_release), | |
SET_ELEMENT (.fsync, NULL), | |
diff --git a/usmb.h b/usmb.h | |
@@ -18,6 +18,7 @@ | |
#define USMB_H | |
#include <stdbool.h> | |
+ #include <stdint.h> | |
#include <libsmbclient.h> | |
extern SMBCCTX *ctx; | |
diff --git a/usmb_dir.c b/usmb_dir.c | |
@@ -17,7 +17,7 @@ | |
#include "config.h" | |
#include <sys/time.h> // struct timeval needed by libsmbclient.h | |
#include <libsmbclient.h> | |
-#include "samba30-compat.h" | |
+#include "samba3x-compat.h" | |
#include <fuse.h> | |
#include <dirent.h> | |
#include <errno.h> | |
diff --git a/usmb_file.c b/usmb_file.c | |
@@ -17,7 +17,7 @@ | |
#include "config.h" | |
#include <sys/time.h> // struct timeval needed by libsmbclient.h | |
#include <libsmbclient.h> | |
-#include "samba30-compat.h" | |
+#include "samba3x-compat.h" | |
#include <limits.h> | |
#include <assert.h> | |
#include <fuse.h> |