Introduction
Introduction Statistics Contact Development Disclaimer Help
Ported to fuse 2.6. Added extended attributes support. Minor fixes for Sun Stud…
git clone git://git.codemadness.org/susmb
Log
Files
Refs
README
LICENSE
---
commit 31588ef340d16f7780956fc317c35793c9c86b0c
parent 020a5e9c64b9834132498218e64a93e91bd386d9
Author: geoff <devnull@localhost>
Date: Mon, 23 Apr 2007 22:07:48 +0000
Ported to fuse 2.6.
Added extended attributes support.
Minor fixes for Sun Studio 12 lint.
Diffstat:
M COPYING | 16 ++++++++--------
M Makefile | 2 +-
M conffile.c | 3 ++-
M usmb.c | 85 +++++++++++++++++------------…
M usmb_dir.c | 55 +++++++++++++++++++++++++++++…
M usmb_dir.h | 6 ++++++
M usmb_file.c | 16 ++++++++++++++++
M utils.c | 2 ++
M version.h | 2 +-
M xml.c | 22 ++++++++++++++++------
10 files changed, 153 insertions(+), 56 deletions(-)
---
diff --git a/COPYING b/COPYING
@@ -1,12 +1,12 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licens…
The precise terms and conditions for copying, distribution and
modification follow.
- GNU GENERAL PUBLIC LICENSE
+ GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by t…
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE…
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
- How to Apply These Terms to Your New Programs
+ How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice…
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 …
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U…
Also add information on how to contact you by electronic and paper mail.
diff --git a/Makefile b/Makefile
@@ -24,7 +24,7 @@ PREFIX = /usr/local
BINDIR = $(PREFIX)/bin
CFLAGS = -Wall -W -Werror -std=c99 -pedantic -O \
- -I$(SAMBA)/include -D_BSD_SOURCE -DFUSE_USE_VERSION=25 \
+ -I$(SAMBA)/include -D_BSD_SOURCE -DFUSE_USE_VERSION=26 \
-DHAVE_UTIME_H
LDLIBS = -lsmbclient
diff --git a/conffile.c b/conffile.c
@@ -106,7 +106,8 @@ bool conffile_get_mount (const char *filename, const char *…
xmlFreeDoc (doc);
return true;
- } while (false);
+ /*NOTREACHED*/
+ } while (false /*CONSTCOND*/);
fputs ("Invalid configuration.\n", stderr);
diff --git a/usmb.c b/usmb.c
@@ -105,9 +105,10 @@ static bool create_smb_context (char *domain, char *userna…
}
-static void * usmb_init (void)
+static void * usmb_init (struct fuse_conn_info *conn)
{
DEBUG (fputs ("usmb_init()\n", stderr));
+ (void)conn;
return NULL;
}
@@ -128,44 +129,50 @@ static void usmb_destroy (void *unused)
// no easy way of implementing these.
// access ftruncate
-static struct fuse_operations fuse_ops = {
- .getattr = usmb_getattr,
- .readlink = NULL,
- .getdir = NULL,
- .mknod = NULL,
- .mkdir = usmb_mkdir,
- .unlink = usmb_unlink,
- .rmdir = usmb_rmdir,
- .symlink = NULL,
- .rename = usmb_rename,
- .link = NULL,
- .chmod = usmb_chmod,
- .chown = NULL, // usmb_chown, --not implemented in libsmbclient
- .truncate = usmb_truncate,
- .utime = usmb_utime,
- .open = usmb_open,
- .read = usmb_read,
- .write = usmb_write,
- .statfs = NULL,
- .flush = NULL,
- .release = usmb_release,
- .fsync = NULL,
-#ifdef SETXATTR
- .setxattr = usmb_setxattr,
- .getxattr = usmb_getxattr,
- .listxattr = usmb_listxattr,
- .removexattr = usmb_removexattr,
+#ifdef __lint
+#define SET_ELEMENT(name,value) value
+#else
+#define SET_ELEMENT(name,value) name = value
#endif
- .opendir = usmb_opendir,
- .readdir = usmb_readdir,
- .releasedir = usmb_releasedir,
- .fsyncdir = NULL,
- .init = usmb_init,
- .destroy = usmb_destroy,
- .access = NULL,
- .create = usmb_create,
- .ftruncate = NULL,
- .fgetattr = usmb_fgetattr
+static struct fuse_operations fuse_ops = {
+ SET_ELEMENT (.getattr, usmb_getattr),
+ SET_ELEMENT (.readlink, NULL),
+ SET_ELEMENT (.getdir, NULL),
+ SET_ELEMENT (.mknod, NULL),
+ SET_ELEMENT (.mkdir, usmb_mkdir),
+ SET_ELEMENT (.unlink, usmb_unlink),
+ SET_ELEMENT (.rmdir, usmb_rmdir),
+ SET_ELEMENT (.symlink, NULL),
+ SET_ELEMENT (.rename, usmb_rename),
+ SET_ELEMENT (.link, NULL),
+ SET_ELEMENT (.chmod, usmb_chmod),
+ SET_ELEMENT (.chown, NULL), // usmb_chown, --not implemented in libsmbclient
+ SET_ELEMENT (.truncate, usmb_truncate),
+ SET_ELEMENT (.utime, usmb_utime),
+ SET_ELEMENT (.open, usmb_open),
+ SET_ELEMENT (.read, usmb_read),
+ SET_ELEMENT (.write, usmb_write),
+ SET_ELEMENT (.statfs, NULL),
+ SET_ELEMENT (.flush, NULL),
+ SET_ELEMENT (.release, usmb_release),
+ SET_ELEMENT (.fsync, NULL),
+ SET_ELEMENT (.setxattr, usmb_setxattr),
+ SET_ELEMENT (.getxattr, usmb_getxattr),
+ SET_ELEMENT (.listxattr, usmb_listxattr),
+ SET_ELEMENT (.removexattr, usmb_removexattr),
+ SET_ELEMENT (.opendir, usmb_opendir),
+ SET_ELEMENT (.readdir, usmb_readdir),
+ SET_ELEMENT (.releasedir, usmb_releasedir),
+ SET_ELEMENT (.fsyncdir, NULL),
+ SET_ELEMENT (.init, usmb_init),
+ SET_ELEMENT (.destroy, usmb_destroy),
+ SET_ELEMENT (.access, NULL),
+ SET_ELEMENT (.create, usmb_create),
+ SET_ELEMENT (.ftruncate, NULL),
+ SET_ELEMENT (.fgetattr, usmb_fgetattr),
+ SET_ELEMENT (.lock, NULL), // TODO: implement
+ SET_ELEMENT (.utimens, NULL), // TODO: implement
+ SET_ELEMENT (.bmap, NULL), // TODO: implement
};
@@ -265,7 +272,7 @@ int main (int argc, char **argv)
int fuse_argc;
char **fuse_argv;
build_fuse_args (options, mountpoint, &fuse_argc, &fuse_argv);
- int ret = fuse_main (fuse_argc, fuse_argv, &fuse_ops);
+ int ret = fuse_main (fuse_argc, fuse_argv, &fuse_ops, NULL);
smbc_free_context (ctx, 1);
free_strings (sharename);
diff --git a/usmb_dir.c b/usmb_dir.c
@@ -126,3 +126,58 @@ int usmb_releasedir (const char *path, struct fuse_file_in…
return (ctx->closedir (ctx, file) < 0) ? -errno : 0;
}
+
+int usmb_setxattr (const char *path, const char *name, const char *value,
+ size_t size, int flags)
+{
+ char *url = make_url (path);
+ if (NULL == url)
+ return -ENOMEM;
+
+ DEBUG (fprintf (stderr, "setxattr (%s, %s, %p, %u, %x)\n",
+ path, url, value, size, flags));
+ int ret = ctx->setxattr (ctx, url, name, value, size, flags) ? -errno : 0;
+ free (url);
+ return ret;
+}
+
+
+int usmb_getxattr (const char *path, const char *name, char *value, size_t siz…
+{
+ char *url = make_url (path);
+ if (NULL == url)
+ return -ENOMEM;
+
+ DEBUG (fprintf (stderr, "getxattr (%s, %s, %p, %u)\n",
+ path, url, value, size));
+ int ret = ctx->getxattr (ctx, url, name, value, size) ? -errno : 0;
+ free (url);
+ return ret;
+}
+
+
+int usmb_listxattr (const char *path, char *list, size_t size)
+{
+ char *url = make_url (path);
+ if (NULL == url)
+ return -ENOMEM;
+
+ DEBUG (fprintf (stderr, "listxattr (%s, %p, %u)\n", url, list, size));
+ int ret = ctx->listxattr (ctx, url, list, size) ? -errno : 0;
+ free (url);
+ return ret;
+}
+
+
+int usmb_removexattr (const char *path, const char *name)
+{
+ char *url = make_url (path);
+ if (NULL == url)
+ return -ENOMEM;
+
+ DEBUG (fprintf (stderr, "removexattr (%s, %s)\n", url, name));
+ int ret = ctx->removexattr (ctx, url, name) ? -errno : 0;
+ free (url);
+ return ret;
+}
+
diff --git a/usmb_dir.h b/usmb_dir.h
@@ -28,5 +28,11 @@
int usmb_readdir (const char *path, void *h, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi);
int usmb_releasedir (const char *path, struct fuse_file_info *fi);
+ int usmb_setxattr (const char *path, const char *name, const char *value,
+ size_t size, int flags);
+ int usmb_getxattr (const char *path, const char *name, char *value,
+ size_t size);
+ int usmb_listxattr (const char *path, char *list, size_t size);
+ int usmb_removexattr (const char *path, const char *name);
#endif
diff --git a/usmb_file.c b/usmb_file.c
@@ -213,6 +213,22 @@ int usmb_utime (const char *filename, struct utimbuf *utb)
}
+#if 0
+Samab 3.0.34 defines utimes as taking struct timevals rather than timespecs.
+int usmb_utimes (const char *filename, const struct timespec ts[2])
+{
+ char *url = make_url (filename);
+ if (NULL == url)
+ return -ENOMEM;
+
+ DEBUG (fprintf (stderr, "utimes (%s)\n", url));
+ int ret = (ctx->utimes (ctx, url, ts) < 0) ? -errno : 0;
+ free (url);
+ return ret;
+}
+#endif
+
+
int usmb_truncate (const char *filename, off_t newsize)
{
DEBUG (fprintf (stderr, "truncate (%s, %llu)\n", filename, newsize));
diff --git a/utils.c b/utils.c
@@ -46,6 +46,7 @@ char * concat_strings (int num, ...)
assert (NULL != next);
size_t next_len = strlen (next);
+ /*LINTED*/
size_t required = (out - base) + next_len + 1;
if (buff_size < required)
@@ -62,6 +63,7 @@ char * concat_strings (int num, ...)
buff_size = dbl_len;
}
+ /*LINTED*/
ptrdiff_t diff = out - base;
char *newbase = realloc (base, buff_size);
diff --git a/version.h b/version.h
@@ -21,7 +21,7 @@
#include <stdio.h>
- #define USMB_VERSION 0x20070126
+ #define USMB_VERSION 0x20070423
// a - alpha, b - beta, p - pre-release, s - stable
#define USMB_VERSION_STATUS 'a'
diff --git a/xml.c b/xml.c
@@ -17,12 +17,22 @@ bool xml_validate_relaxng (xmlDocPtr doc, const char *schem…
assert (NULL != doc);
- if ((rngpcptr = xmlRelaxNGNewMemParserCtxt (schema, strlen (schema))) &&
- ((rngptr = xmlRelaxNGParse (rngpcptr))) &&
- ((rngvptr = xmlRelaxNGNewValidCtxt (rngptr))))
+ do
{
+ rngpcptr = xmlRelaxNGNewMemParserCtxt (schema, strlen (schema));
+ if (NULL == rngpcptr)
+ break;
+
+ rngptr = xmlRelaxNGParse (rngpcptr);
+ if (NULL == rngptr)
+ break;
+
+ rngvptr = xmlRelaxNGNewValidCtxt (rngptr);
+ if (NULL == rngvptr)
+ break;
+
ret = (0 == xmlRelaxNGValidateDoc (rngvptr, doc));
- }
+ } while (false) /*CONSTCOND*/;
if (NULL != rngvptr)
xmlRelaxNGFreeValidCtxt (rngvptr);
@@ -89,7 +99,7 @@ bool xml_xpath_attr_value (xmlXPathContextPtr ctx,
xmlXPathFreeObject (obj);
return true;
/*NOTREACHED*/
- } while (false);
+ } while (false /*CONSTCOND*/);
*out = NULL;
xmlXPathFreeObject (obj);
@@ -149,7 +159,7 @@ bool xml_xpath_text (xmlXPathContextPtr ctx, char *xpath, c…
xmlXPathFreeObject (obj);
return true;
/*NOTREACHED*/
- } while (false);
+ } while (false /*CONSTCOND*/);
*out = NULL;
xmlXPathFreeObject (obj);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.