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...