9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: sqweek <sqweek@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net>
Cc: 9fans@cse.psu.edu
Subject: Re: [9fans] 9pfuse adventure
Date: Thu, 27 Mar 2008 11:48:33 +0900	[thread overview]
Message-ID: <140e7ec30803261948k48f9b790o42539f64f82e5a01@mail.gmail.com> (raw)
In-Reply-To: <20080321110804.111605c6@h4x>

[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]

 Right. On 64-bit arches, linux forces the O_LARGEFILE (0x8000) flag
in sys_open(). FUSE passes the flags along in fuse_send_open(), which
makes its way to 9pfuse's _fuseopen(). _fuseopen() _tries_ to ignore
the O_LARGEFILE flag, but on 64-bit arches, the userspace fcntl header
<bits/fcntl.h> defines O_LARGEFILE as 0... even though the kernel
still treats it as 0x8000.
 Friggin mess. Patch attached.
-sqweek

On Fri, Mar 21, 2008 at 7:08 PM, John Soros <sorosj@gmail.com> wrote:
> Hi!
>  well, i have been having this error for quite a while with 9pfuse. on amd64 linux (archlinux), i couldn't even ls a mounted directory, now that i have a 32 bit system, ls works, but cp doesn't (i have no idea if it hasanything to do with the arch, though).
>  this is how i mount sources with p9p:
>  $ 9fs sources
>  $ 9 mount `namespace`/sources /tmp/sources
>  then ls in a directory in /tmp/sources works, but when i try to copy, attached is the output.
>  I'm open to testing whatever fixes you might suggest.
>  regs
>  John

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 9pfuse.LARGEFILE.diff --]
[-- Type: text/x-patch; name=9pfuse.LARGEFILE.diff, Size: 924 bytes --]

Index: main.c
===================================================================
RCS file: /cvs/plan9/src/cmd/9pfuse/main.c,v
retrieving revision 1.14
diff -u -r1.14 main.c
--- main.c	23 Nov 2007 21:28:33 -0000	1.14
+++ main.c	27 Mar 2008 02:47:39 -0000
@@ -24,11 +24,19 @@
 #endif
 
 #ifndef O_LARGEFILE
-#  if defined(__linux__)
-#    define O_LARGEFILE 0100000  /* Sigh */
-#  else
-#    define O_LARGEFILE 0
-#  endif
+#  define O_LARGEFILE 0
+#endif
+
+/* Work around glibc's broken <bits/fcntl.h> which defines
+ * O_LARGEFILE to 0 on 64 bit architectures.  But, on those same
+ * architectures, linux _forces_ O_LARGEFILE (which is always
+ * 0100000 in the kernel) at each file open. FUSE is all too
+ * happy to pass the flag onto us, where we'd have no idea what
+ * to do with it if we trusted glibc.
+ */
+#if defined(__linux__)
+#  undef O_LARGEFILE
+#  define O_LARGEFILE 0100000
 #endif
 
 #ifndef O_CLOEXEC

      reply	other threads:[~2008-03-27  2:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07  7:52 sqweek
2008-02-08 19:25 ` Russ Cox
2008-02-11  9:31   ` [9fans] Can't find CD-ROM Chris Saunders
2008-02-11 11:10     ` Pietro Gagliardi
2008-02-11 14:54       ` Chris Saunders
2008-02-11 13:34     ` Eris Discordia
2008-02-11 14:54       ` Chris Saunders
2008-02-11 15:15         ` Eris Discordia
2008-02-12  9:26           ` Chris Saunders
2008-02-13  5:48             ` Lee Duhem
2008-02-13  9:52             ` Chris Saunders
2008-02-13 16:52               ` Eris Discordia
     [not found]                 ` <op.t6g2x6t1c6yvfe@computer>
2008-02-13 17:03                   ` Fwd: " Eris Discordia
2008-02-11 14:37     ` ISHWAR RATTAN
2008-02-11 15:25     ` Alf
2008-02-12 19:40   ` [9fans] 9pfuse adventure sqweek
2008-03-21 10:08     ` John Soros
2008-03-27  2:48       ` sqweek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=140e7ec30803261948k48f9b790o42539f64f82e5a01@mail.gmail.com \
    --to=sqweek@gmail.com \
    --cc=9fans@9fans.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).