CVS commit: [netbsd-5] src/lib/librefuse

2013-01-13 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jan 13 17:57:48 UTC 2013

Modified Files:
src/lib/librefuse [netbsd-5]: refuse.c

Log Message:
Pull up following revision(s) (requested by tron in ticket #1836):
lib/librefuse/refuse.c: revision 1.96 via patch
FUSE seems to allow short writes without errors but PUFFS doesn't. Work
around this by returning ENOSPC in case of a short write to avoid protocol
errors. This change is based on problem analysis provided by Antti Kantee.
This fixes PR lib/45129 by myself.


To generate a diff of this commit:
cvs rdiff -u -r1.89.4.2 -r1.89.4.3 src/lib/librefuse/refuse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librefuse/refuse.c
diff -u src/lib/librefuse/refuse.c:1.89.4.2 src/lib/librefuse/refuse.c:1.89.4.3
--- src/lib/librefuse/refuse.c:1.89.4.2	Mon Aug  8 19:56:50 2011
+++ src/lib/librefuse/refuse.c	Sun Jan 13 17:57:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: refuse.c,v 1.89.4.2 2011/08/08 19:56:50 riz Exp $	*/
+/*	$NetBSD: refuse.c,v 1.89.4.3 2013/01/13 17:57:48 bouyer Exp $	*/
 
 /*
  * Copyright © 2007 Alistair Crooks.  All rights reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: refuse.c,v 1.89.4.2 2011/08/08 19:56:50 riz Exp $);
+__RCSID($NetBSD: refuse.c,v 1.89.4.3 2013/01/13 17:57:48 bouyer Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -1083,14 +1083,16 @@ puffs_fuse_node_write(struct puffs_userm
 	ret = (*fuse-op.write)(path, (char *)buf, *resid, offset,
 	rn-file_info);
 
-	if (ret  0) {
-		if (offset + ret  pn-pn_va.va_size)
+	if (ret = 0) {
+		if ((uint64_t)(offset + ret)  pn-pn_va.va_size)
 			pn-pn_va.va_size = offset + ret;
 		*resid -= ret;
-		ret = 0;
+		ret = (*resid == 0) ? 0 : ENOSPC;
+	} else {
+		ret = -ret;
 	}
 
-	return -ret;
+	return ret;
 }
 
 



CVS commit: [netbsd-5] src/lib/librefuse

2011-08-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug  8 19:53:29 UTC 2011

Modified Files:
src/lib/librefuse [netbsd-5]: refuse.c

Log Message:
Pull up following revision(s) (requested by tron in ticket #1648):
lib/librefuse/refuse.c: revision 1.93
Don't ignore userdata argument in fuse_main_real. This can crash
a FUSE file-system that passes a non-NULL argument here.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.4.1 src/lib/librefuse/refuse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librefuse/refuse.c
diff -u src/lib/librefuse/refuse.c:1.89 src/lib/librefuse/refuse.c:1.89.4.1
--- src/lib/librefuse/refuse.c:1.89	Fri Aug  1 15:54:09 2008
+++ src/lib/librefuse/refuse.c	Mon Aug  8 19:53:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: refuse.c,v 1.89 2008/08/01 15:54:09 dillo Exp $	*/
+/*	$NetBSD: refuse.c,v 1.89.4.1 2011/08/08 19:53:29 riz Exp $	*/
 
 /*
  * Copyright © 2007 Alistair Crooks.  All rights reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: refuse.c,v 1.89 2008/08/01 15:54:09 dillo Exp $);
+__RCSID($NetBSD: refuse.c,v 1.89.4.1 2011/08/08 19:53:29 riz Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -1221,8 +1221,8 @@
 	int		 multithreaded;
 	int		 fd;
 
-	fuse = fuse_setup(argc, argv, ops, size, mountpoint, multithreaded,
-			fd);
+	fuse = fuse_setup_real(argc, argv, ops, size, mountpoint,
+	multithreaded, fd, userdata);
 
 	return fuse_loop(fuse);
 }



CVS commit: [netbsd-5] src/lib/librefuse

2011-08-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug  8 19:55:27 UTC 2011

Modified Files:
src/lib/librefuse [netbsd-5]: fuse_opt.h

Log Message:
Pull up following revision(s) (requested by tron in ticket #1649):
lib/librefuse/fuse_opt.h: revision 1.5
PR/41250: David H. Gutteridge: librefuse fuse_opt.h header doesn't accommod=
ate
C++ compilation


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.18.1 src/lib/librefuse/fuse_opt.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librefuse/fuse_opt.h
diff -u src/lib/librefuse/fuse_opt.h:1.4 src/lib/librefuse/fuse_opt.h:1.4.18.1
--- src/lib/librefuse/fuse_opt.h:1.4	Thu May 17 01:55:43 2007
+++ src/lib/librefuse/fuse_opt.h	Mon Aug  8 19:55:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fuse_opt.h,v 1.4 2007/05/17 01:55:43 christos Exp $	*/
+/*	$NetBSD: fuse_opt.h,v 1.4.18.1 2011/08/08 19:55:27 riz Exp $	*/
 
 /*
  * Copyright (c) 2007 Alistair Crooks.  All rights reserved.
@@ -31,6 +31,10 @@
 #ifndef _FUSE_OPT_H_
 #define _FUSE_OPT_H_
 
+#ifdef __cplusplus
+extern C {
+#endif  
+
 enum {
 	FUSE_OPT_KEY_OPT = -1,
 	FUSE_OPT_KEY_NONOPT = -2,
@@ -59,4 +63,8 @@
 		   const struct fuse_opt *, fuse_opt_proc_t);
 int fuse_opt_match(const struct fuse_opt *, const char *);
 
+#ifdef __cplusplus
+}
+#endif 
+
 #endif /* _FUSE_OPT_H_ */



CVS commit: [netbsd-5] src/lib/librefuse

2011-08-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug  8 19:56:50 UTC 2011

Modified Files:
src/lib/librefuse [netbsd-5]: refuse.c

Log Message:
Pull up following revision(s) (requested by tron in ticket #1650):
lib/librefuse/refuse.c: revision 1.94
Call the FUSE init operation before we try to access the file-system.
This prevents a crash in fuse_ext2 which I previously worked around
with a patch.


To generate a diff of this commit:
cvs rdiff -u -r1.89.4.1 -r1.89.4.2 src/lib/librefuse/refuse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librefuse/refuse.c
diff -u src/lib/librefuse/refuse.c:1.89.4.1 src/lib/librefuse/refuse.c:1.89.4.2
--- src/lib/librefuse/refuse.c:1.89.4.1	Mon Aug  8 19:53:29 2011
+++ src/lib/librefuse/refuse.c	Mon Aug  8 19:56:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: refuse.c,v 1.89.4.1 2011/08/08 19:53:29 riz Exp $	*/
+/*	$NetBSD: refuse.c,v 1.89.4.2 2011/08/08 19:56:50 riz Exp $	*/
 
 /*
  * Copyright © 2007 Alistair Crooks.  All rights reserved.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if !defined(lint)
-__RCSID($NetBSD: refuse.c,v 1.89.4.1 2011/08/08 19:53:29 riz Exp $);
+__RCSID($NetBSD: refuse.c,v 1.89.4.2 2011/08/08 19:56:50 riz Exp $);
 #endif /* !lint */
 
 #include sys/types.h
@@ -1298,6 +1298,9 @@
 
 	fuse-fc = fc;
 
+	if (fuse-op.init != NULL)
+		fusectx-private_data = fuse-op.init(NULL); /* XXX */
+
 	/* initialise the puffs operations structure */
 PUFFSOP_INIT(pops);
 
@@ -1361,9 +1364,6 @@
 			puffs_stat2vattr(pn_root-pn_va, st);
 	assert(pn_root-pn_va.va_type == VDIR);
 
-	if (fuse-op.init)
-		fusectx-private_data = fuse-op.init(NULL); /* XXX */
-
 	puffs_set_prepost(pu, set_fuse_context_pid, NULL);
 
 	puffs_zerostatvfs(svfsb);



CVS commit: [netbsd-5] src/lib/librefuse

2011-03-20 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Mar 20 21:21:57 UTC 2011

Modified Files:
src/lib/librefuse [netbsd-5]: refuse_opt.c

Log Message:
Pull up following revision(s) (requested by soda in ticket #1568):
lib/librefuse/refuse_opt.c: revision 1.15
fuse_opt_parse() was using uninitialized struct fuse_opt_option::data,
this bug made fuse_opt_proc_t not work, if it used first ``data'' argument,
and might cause memory corruption even.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.12.1 src/lib/librefuse/refuse_opt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librefuse/refuse_opt.c
diff -u src/lib/librefuse/refuse_opt.c:1.13 src/lib/librefuse/refuse_opt.c:1.13.12.1
--- src/lib/librefuse/refuse_opt.c:1.13	Mon Nov  5 13:41:52 2007
+++ src/lib/librefuse/refuse_opt.c	Sun Mar 20 21:21:57 2011
@@ -1,4 +1,4 @@
-/* 	$NetBSD: refuse_opt.c,v 1.13 2007/11/05 13:41:52 pooka Exp $	*/
+/* 	$NetBSD: refuse_opt.c,v 1.13.12.1 2011/03/20 21:21:57 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -282,6 +282,7 @@
 	if (!args || !args-argv || !args-argc || !proc)
 		return 0;
 
+	foo.data = data;
 	if (args-argc == 1)
 		return proc(foo.data, *args-argv, FUSE_OPT_KEY_OPT, args);