From: Theodore Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [RESEND] libext2fs: Provide functions to safely access name_len and file_type
Date: Mon, 10 Jun 2013 08:39:56 -0400 [thread overview]
Message-ID: <20130610123956.GA23226@thunk.org> (raw)
In-Reply-To: <1369773935-16889-1-git-send-email-jack@suse.cz>
On Tue, May 28, 2013 at 10:45:35AM -0000, Jan Kara wrote:
> Accessing name_len (and file_type) in ext4_dir_entry structure is somewhat
> problematic because on big endian architecture we need to now whether we
> are really dealing with ext4_dir_entry (which has u16 name_len which
> needs byte swapping) or ext4_dir_entry_2 (which has u8 name_len which
> must not be byte swapped).
>
> Currently the code is somewhat surprising and name_len is always treated
> as u16 and byte swapped (flag EXT2_DIRBLOCK_V2_STRUCT isn't ever used)
> and then masking of name_len is used to access real name_len or
> file_type. Doing things this way in applications using libext2fs is
> unexpected to say the least (more natural is to type struct
> ext4_dir_entry * to struct ext4_dir_entry_2 * but that gives wrong
> results on big endian architectures. So provide helper functions that
> give endian-safe access to these fields. Also convert users in e2fsprogs
> to use these functions.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
Applied, thanks.
- Ted
prev parent reply other threads:[~2013-06-10 12:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 20:45 [PATCH RESEND] libext2fs: Provide functions to safely access name_len and file_type Jan Kara
2013-06-10 12:39 ` Theodore Ts'o [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=20130610123956.GA23226@thunk.org \
--to=tytso@mit.edu \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
/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).