From patchwork Fri Jan 27 04:51:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 138140 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2806E1007D2 for ; Fri, 27 Jan 2012 15:55:00 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755632Ab2A0Ey1 (ORCPT ); Thu, 26 Jan 2012 23:54:27 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:51978 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755399Ab2A0Etg (ORCPT ); Thu, 26 Jan 2012 23:49:36 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtp (Exim 4.71) (envelope-from ) id 1Rqdkl-0005DF-TP; Thu, 26 Jan 2012 21:49:35 -0700 Received: from c-98-207-153-68.hsd1.ca.comcast.net ([98.207.153.68] helo=x61.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Rqdkl-0004VU-NP; Thu, 26 Jan 2012 21:49:35 -0700 Received: from fess.ebiederm.org (fess.int.ebiederm.org [192.168.4.7]) by x61.ebiederm.org (Postfix) with ESMTP id AC41E39D8F; Thu, 26 Jan 2012 20:46:04 -0800 (PST) Received: by fess.ebiederm.org (Postfix, from userid 502) id 46766C08A2; Thu, 26 Jan 2012 20:52:08 -0800 (PST) From: "Eric W. Biederman" To: Cc: , , Lucian Adrian Grijincu , Damien Millescamps , "Eric W. Biederman" Subject: [PATCH 17/29] sysctl: Factor out insert_header and erase_header Date: Thu, 26 Jan 2012 20:51:53 -0800 Message-Id: <1327639925-12920-17-git-send-email-ebiederm@xmission.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-XM-SPF: eid=; ; ; mid=; ; ; hst=in01.mta.xmission.com; ; ; ip=98.207.153.68; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX19zjyU8U5Y1dEldUlqLO7/bjno37l/uCxA= X-SA-Exim-Connect-IP: 98.207.153.68 X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on in01.mta.xmission.com); SAEximRunCond expanded to false Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Eric W. Biederman --- fs/proc/proc_sysctl.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 4979925..7e96a26 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -57,6 +57,17 @@ static void init_header(struct ctl_table_header *head, head->parent = NULL; } +static void erase_header(struct ctl_table_header *head) +{ + list_del_init(&head->ctl_entry); +} + +static void insert_header(struct ctl_table_header *header) +{ + header->parent->count++; + list_add_tail(&header->ctl_entry, &header->set->list); +} + /* called under sysctl_lock */ static int use_table(struct ctl_table_header *p) { @@ -96,7 +107,7 @@ static void start_unregistering(struct ctl_table_header *p) * do not remove from the list until nobody holds it; walking the * list in do_sysctl() relies on that. */ - list_del_init(&p->ctl_entry); + erase_header(p); } static void sysctl_head_get(struct ctl_table_header *head) @@ -974,8 +985,7 @@ struct ctl_table_header *__register_sysctl_table( } if (sysctl_check_dups(namespaces, header, path, table)) goto fail_locked; - header->parent->count++; - list_add_tail(&header->ctl_entry, &header->set->list); + insert_header(header); spin_unlock(&sysctl_lock); return header;