From: Al Viro <viro@zeniv.linux.org.uk>
To: Meng Tang <tangmeng@uniontech.com>
Cc: mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com,
ebiederm@xmission.com, willy@infradead.org,
nixiaoming@huawei.com, nizhen@uniontech.com,
zhanglianjie@uniontech.com, sujiaxun@uniontech.com,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v4 1/2] fs/proc: optimize exactly register one ctl_table
Date: Sat, 12 Mar 2022 03:24:18 +0000 [thread overview]
Message-ID: <YiwSYvuAkntr4A/V@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20220303070847.28684-1-tangmeng@uniontech.com>
On Thu, Mar 03, 2022 at 03:08:46PM +0800, Meng Tang wrote:
> +#define REGISTER_SINGLE_ONE (register_single_one ? true : false)
????
> +static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header,
> + bool register_single_one)
> + err = insert_links(header, REGISTER_SINGLE_ONE);
> + erase_header(header, REGISTER_SINGLE_ONE);
> + put_links(header, REGISTER_SINGLE_ONE);
> static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table *table,
> - struct ctl_table_root *link_root)
> + struct ctl_table_root *link_root, bool register_single_one)
> + init_header(links, dir->header.root, dir->header.set, node, link_table,
> + REGISTER_SINGLE_ONE);
> -static int insert_links(struct ctl_table_header *head)
> +static int insert_links(struct ctl_table_header *head, bool register_single_one)
> {
> struct ctl_table_set *root_set = &sysctl_table_root.default_set;
> struct ctl_dir *core_parent = NULL;
> @@ -1248,13 +1278,13 @@ static int insert_links(struct ctl_table_header *head)
> if (IS_ERR(core_parent))
> return 0;
>
> - if (get_links(core_parent, head->ctl_table, head->root))
> + if (get_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE))
> - links = new_links(core_parent, head->ctl_table, head->root);
> + links = new_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE);
> + if (get_links(core_parent, head->ctl_table, head->root, REGISTER_SINGLE_ONE)) {
> + err = insert_header(core_parent, links, REGISTER_SINGLE_ONE);
> -struct ctl_table_header *__register_sysctl_table(
> +struct ctl_table_header *__register_sysctl_tables(
> struct ctl_table_set *set,
> - const char *path, struct ctl_table *table)
> + const char *path, struct ctl_table *table, bool register_single_one)
> + init_header(header, root, set, node, table, REGISTER_SINGLE_ONE);
> + if (sysctl_check_table(path, table, REGISTER_SINGLE_ONE))
> + if (insert_header(dir, header, REGISTER_SINGLE_ONE))
> static int register_leaf_sysctl_tables(const char *path, char *pos,
> struct ctl_table_header ***subheader, struct ctl_table_set *set,
> - struct ctl_table *table)
> + struct ctl_table *table, bool register_single_one)
> + header = __register_sysctl_tables(set, path, files, REGISTER_SINGLE_ONE);
Could you explain what is that REGISTER_SINGLE_ONE macro for? Looks like
some very odd kind of cargo-culting... I might be missing something subtle
here, but I'm honestly at loss as to what could that possibly be. If nothing
else, why would one ever want boolean_expression ? true : false instead of
boolean_expression? Especially since in all cases you are passing that
as a bool argument...
prev parent reply other threads:[~2022-03-12 3:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 7:08 [PATCH v4 1/2] fs/proc: optimize exactly register one ctl_table Meng Tang
2022-03-03 7:08 ` [PATCH v4 2/2] fs/proc: sysctl: optimize register single " Meng Tang
2022-03-04 1:21 ` [PATCH v4 1/2] fs/proc: optimize exactly register " Xiaoming Ni
2022-03-12 6:14 ` Davidlohr Bueso
2022-03-12 3:24 ` Al Viro [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=YiwSYvuAkntr4A/V@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=ebiederm@xmission.com \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=nixiaoming@huawei.com \
--cc=nizhen@uniontech.com \
--cc=sujiaxun@uniontech.com \
--cc=tangmeng@uniontech.com \
--cc=willy@infradead.org \
--cc=yzaikin@google.com \
--cc=zhanglianjie@uniontech.com \
/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