Module Name:    src
Committed By:   manu
Date:           Mon Oct  4 03:56:24 UTC 2010

Modified Files:
        src/lib/libperfuse: ops.c

Log Message:
- delete an obsoelte comment about inactive
- remove a test for getattr return field that was never filled
- correctly send filehandle and filehandle flags for getaattr


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libperfuse/ops.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.19 src/lib/libperfuse/ops.c:1.20
--- src/lib/libperfuse/ops.c:1.19	Sun Oct  3 05:46:47 2010
+++ src/lib/libperfuse/ops.c	Mon Oct  4 03:56:24 2010
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.19 2010/10/03 05:46:47 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.20 2010/10/04 03:56:24 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -1192,10 +1192,7 @@
 
 	/*
 	 * Do not open twice, and do not reopen for reading
-	 * if we already have write handle. Just ask for
-	 * inactive, in case the node was open by a create
-	 * operation (we are not allowed to call puffs_setback
-	 * at create time, puffs interface forbids it)
+	 * if we already have write handle.
 	 */
 	if (((mode & FREAD) && (pnd->pnd_flags & PND_RFH)) ||
 	    ((mode & FREAD) && (pnd->pnd_flags & PND_WFH)) ||
@@ -1319,7 +1316,12 @@
 		fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
 		fgi->getattr_flags = 0; 
 		fgi->dummy = 0;
-		fgi->fh = perfuse_get_fh(opc, FREAD);
+		fgi->fh = 0;
+
+		if (PERFUSE_NODE_DATA(opc)->pnd_flags & PND_OPEN) {
+			fgi->fh = perfuse_get_fh(opc, FREAD);
+			fgi->getattr_flags |= FUSE_GETATTR_FH; 
+		}
 
 #ifdef PERFUSE_DEBUG
 		if (perfuse_diagflags & PDF_FH)
@@ -1335,12 +1337,6 @@
 
 		fao = GET_OUTPAYLOAD(ps, pm, fuse_attr_out);
 
-#ifdef PERFUSE_DEBUG
-		if (!(fao->attr_valid & (FUSE_FATTR_SIZE|FUSE_FATTR_MODE|
-					 FUSE_FATTR_UID|FUSE_FATTR_GID)))
-			DERRX(EX_SOFTWARE, "%s: fao->attr_valid = 0x%"PRId64"",
-			      __func__, fao->attr_valid);
-#endif
 		error = puffs_access(VREG, fao->attr.mode, fao->attr.uid,
 				     fao->attr.gid, (mode_t)mode, pcr); 
 
@@ -1392,10 +1388,12 @@
 	fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
 	fgi->getattr_flags = 0; 
 	fgi->dummy = 0;
-	fgi->fh = perfuse_get_fh(opc, FREAD);
+	fgi->fh = 0;
 
-	if (PERFUSE_NODE_DATA(opc)->pnd_flags & PND_OPEN)
+	if (PERFUSE_NODE_DATA(opc)->pnd_flags & PND_OPEN) {
+		fgi->fh = perfuse_get_fh(opc, FREAD);
 		fgi->getattr_flags |= FUSE_GETATTR_FH;
+	}
 
 	if ((error = xchg_msg(pu, opc, pm, sizeof(*fao), wait_reply)) != 0)
 		goto out;
@@ -2760,7 +2758,7 @@
 			pm = ps->ps_new_msg(pu, opc, FUSE_GETATTR, 
 					    sizeof(*fgi), NULL);
 			fgi = GET_INPAYLOAD(ps, pm, fuse_getattr_in);
-			fgi->getattr_flags = 0; 
+			fgi->getattr_flags = FUSE_GETATTR_FH; 
 			fgi->dummy = 0;
 			fgi->fh = perfuse_get_fh(opc, FWRITE);
 

Reply via email to