From: Nikolaus Rath <Nikolaus@rath.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel <fuse-devel@lists.sourceforge.net>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [fuse-devel] Handling of 32/64 bit off_t by getdents64()
Date: Wed, 27 Nov 2019 20:52:18 +0000 [thread overview]
Message-ID: <87muchyrct.fsf@vostro.rath.org> (raw)
In-Reply-To: <CAJfpegtOf6mV4m3W1v2N8eOD-ep=tFOhKDCFk+-M3=tzc7wVig@mail.gmail.com> (Miklos Szeredi's message of "Wed, 27 Nov 2019 15:30:30 +0100")
On Nov 27 2019, Miklos Szeredi <miklos@szeredi.hu> wrote:
>> Is there a way for a 64 bit process (in this case the FUSE daemon) to
>> ask for 32 bit d_off values from getdents64()?
>
> Looking at ext4 d_off encoding, it looks like the simple workaround is
> to use the *high* 32 bits of the offset.
>
> Just tried, and this works. The lower bits are the "minor" number of
> the offset, and no issue with zeroing those bits out, other than
> increasing the chance of hash collision from practically zero to very
> close to zero.
>
>> Would it be feasible to extend the FUSE protocol to include information
>> about the available bits in d_off?
>
> Yes.
>
> The relevant bits from ext4 are:
>
> static inline int is_32bit_api(void)
> {
> #ifdef CONFIG_COMPAT
> return in_compat_syscall();
> #else
> return (BITS_PER_LONG == 32);
> #endif
> }
Thanks for the quick response!
Is there a way to do the same without relying on ext4 internals, i.e. by
manually calling getdents64() in such a way that in_compat_syscall()
gives true even if the caller is 64 bit?
Best,
-Nikolaus
--
GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F
»Time flies like an arrow, fruit flies like a Banana.«
next prev parent reply other threads:[~2019-11-27 20:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 9:33 Handling of 32/64 bit off_t by getdents64() Nikolaus Rath
2019-11-27 14:30 ` Miklos Szeredi
2019-11-27 20:52 ` Nikolaus Rath [this message]
2019-11-28 7:42 ` [fuse-devel] " Miklos Szeredi
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=87muchyrct.fsf@vostro.rath.org \
--to=nikolaus@rath.org \
--cc=fuse-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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).