t9pfuse: allow O_APPEND in open and create (Roman Shaposhnik) - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e465991ea6c7d2b9f52cabf398b9b087a0b25427
(DIR) parent 0ac670585c5eac5a6348aeb0e7b018659b2dbc09
(HTM) Author: Russ Cox <rsc@swtch.com>
Date: Tue, 30 Dec 2008 14:27:30 -0800
9pfuse: allow O_APPEND in open and create (Roman Shaposhnik)
Diffstat:
M src/cmd/9pfuse/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
t@@ -577,6 +577,13 @@ _fuseopen(FuseMsg *m, int isdir)
openmode = flags&3;
flags &= ~3;
flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC);
+ /*
+ * Discarding O_APPEND here is not completely wrong,
+ * because the host kernel will rewrite the offsets
+ * of write system calls for us. That's the best we
+ * can do on Unix anyway.
+ */
+ flags &= ~O_APPEND;
if(flags & O_TRUNC){
openmode |= OTRUNC;
flags &= ~O_TRUNC;
t@@ -585,7 +592,6 @@ _fuseopen(FuseMsg *m, int isdir)
* Could translate but not standard 9P:
* O_DIRECT -> ODIRECT
* O_NONBLOCK -> ONONBLOCK
- * O_APPEND -> OAPPEND
*/
if(flags){
fprint(2, "unexpected open flags %#uo", (uint)in->flags);
t@@ -702,6 +708,7 @@ fusecreate(FuseMsg *m)
openmode = in->flags&3;
flags &= ~3;
flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE);
+ flags &= ~O_APPEND; /* see comment in _fuseopen */
flags &= ~(O_CREAT|O_TRUNC); /* huh? */
if(flags){
fprint(2, "bad mode %#uo\n", in->flags);