From: Eric Sandeen <sandeen@redhat.com>
To: Theodore Tso <tytso@mit.edu>
Cc: Andreas Dilger <adilger@sun.com>,
ext4 development <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] e2fsprogs: remove misleading argument from ext2fs_bg_flags_clear
Date: Wed, 02 Sep 2009 22:00:14 -0500 [thread overview]
Message-ID: <4A9F313E.8030605@redhat.com> (raw)
In-Reply-To: <20090902234243.GC30497@mit.edu>
Theodore Tso wrote:
> On Wed, Sep 02, 2009 at 05:28:11PM -0600, Andreas Dilger wrote:
>> On Sep 02, 2009 16:43 -0500, Eric Sandeen wrote:
>>> ext2fs_bg_flags_clear shouldn't take an unused bg_flags argument
>>> if its purpose is to clear -all- flags. That just makes people
>>> like me call it for the wrong purpose ;)
>> I'd pointed this out when the code was originally submitted.
>> That said, I'd prefer a function which allows clearing
>> individual flags, rather than all of them. It is possible to
>> call it with ~0 to clear all of the flags.
ext2fs_bg_flag_clear(fs, group, flag) does just that...
TBH "ext2fs_bg_clear_flags(fs, group, ~0)" seems a bit tortured to me.
> Agreed; if we want to have a function which clears all of the flags,
> it should be named something like ext2fs_bg_flags_zap(), or some such.
> It would be confusing for ext2fs_bg_flags_clear() and
> ext2fs_bg_flags_set() not to be symmetric.
>
> - Ted
But they are symmetric; just a bit odd in usage, esp. since the argument
is ignored.
Ok should have looked closer; we have these which overwrite bg_flags:
void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);
(_set sets exactly bg_flags; _clear clears all and ignores bg_flags)
and these, which can twiddle individual bits in bg_flags:
void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
hrmph. Ok, not the most obvious. I still don't think that an unused
variable to "ext2fs_bg_flags_clear" is helpful, regardless of the name.
Oh, and ext2fs_bg_flags_set is unused it seems.
What about perhaps just these 3:
ext2fs_bg_flags_zero(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */
and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.
-Eric
next prev parent reply other threads:[~2009-09-03 3:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-02 21:43 [PATCH] e2fsprogs: remove misleading argument from ext2fs_bg_flags_clear Eric Sandeen
2009-09-02 23:28 ` Andreas Dilger
2009-09-02 23:42 ` Theodore Tso
2009-09-03 3:00 ` Eric Sandeen [this message]
2009-09-03 5:12 ` Andreas Dilger
2009-09-03 5:13 ` Eric Sandeen
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=4A9F313E.8030605@redhat.com \
--to=sandeen@redhat.com \
--cc=adilger@sun.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.