public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, "Denis V. Lunev" <den@openvz.org>
Subject: [PATCH 20/29] ia64: use non-racy method for proc entries creation
Date: Tue,  8 Apr 2008 15:19:27 +0400	[thread overview]
Message-ID: <1207653576-12640-20-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1207653508.7171.18.camel@iris.sw.ru>

Use proc_create()/proc_create_data() to make sure that ->proc_fops and
->data be setup before gluing PDE to main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Tony Luck <tony.luck@intel.com>
CC: linux-ia64@vger.kernel.org
---
 arch/ia64/hp/common/sba_iommu.c      |    6 ++----
 arch/ia64/kernel/perfmon.c           |    6 +-----
 arch/ia64/kernel/salinfo.c           |   10 ++++------
 arch/ia64/sn/kernel/sn2/sn2_smp.c    |    5 +++--
 arch/ia64/sn/kernel/sn2/sn_proc_fs.c |   29 ++++++++++-------------------
 5 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 6ce729f..34421ae 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1932,15 +1932,13 @@ static const struct file_operations ioc_fops = {
 static void __init
 ioc_proc_init(void)
 {
-	struct proc_dir_entry *dir, *entry;
+	struct proc_dir_entry *dir;
 
 	dir = proc_mkdir("bus/mckinley", NULL);
 	if (!dir)
 		return;
 
-	entry = create_proc_entry(ioc_list->name, 0, dir);
-	if (entry)
-		entry->proc_fops = &ioc_fops;
+	proc_create(ioc_list->name, 0, dir, &ioc_fops);
 }
 #endif
 
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index a2aabfd..c66c588 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -6695,16 +6695,12 @@ pfm_init(void)
 	/*
 	 * create /proc/perfmon (mostly for debugging purposes)
 	 */
- 	perfmon_dir = create_proc_entry("perfmon", S_IRUGO, NULL);
+	perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops);
 	if (perfmon_dir == NULL) {
 		printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
 		pmu_conf = NULL;
 		return -1;
 	}
-  	/*
- 	 * install customized file operations for /proc/perfmon entry
- 	 */
- 	perfmon_dir->proc_fops = &pfm_proc_fops;
 
 	/*
 	 * create /proc/sys/kernel/perfmon (for debugging purposes)
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index 779c3cc..012551f 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -648,18 +648,16 @@ salinfo_init(void)
 		if (!dir)
 			continue;
 
-		entry = create_proc_entry("event", S_IRUSR, dir);
+		entry = proc_create_data("event", S_IRUSR, dir,
+					 &salinfo_event_fops, data);
 		if (!entry)
 			continue;
-		entry->data = data;
-		entry->proc_fops = &salinfo_event_fops;
 		*sdir++ = entry;
 
-		entry = create_proc_entry("data", S_IRUSR | S_IWUSR, dir);
+		entry = proc_create_data("data", S_IRUSR | S_IWUSR, dir,
+					 &salinfo_data_fops, data);
 		if (!entry)
 			continue;
-		entry->data = data;
-		entry->proc_fops = &salinfo_data_fops;
 		*sdir++ = entry;
 
 		/* we missed any events before now */
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index dfc6bf1..49d3120 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -550,11 +550,12 @@ static int __init sn2_ptc_init(void)
 	if (!ia64_platform_is("sn2"))
 		return 0;
 
-	if (!(proc_sn2_ptc = create_proc_entry(PTC_BASENAME, 0444, NULL))) {
+	proc_sn2_ptc = proc_create(PTC_BASENAME, 0444,
+				   NULL, &proc_sn2_ptc_operations);
+	if (!&proc_sn2_ptc_operations) {
 		printk(KERN_ERR "unable to create %s proc entry", PTC_BASENAME);
 		return -EINVAL;
 	}
-	proc_sn2_ptc->proc_fops = &proc_sn2_ptc_operations;
 	spin_lock_init(&sn2_global_ptc_lock);
 	return 0;
 }
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index 62b3e9a..2526e5c 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -139,30 +139,21 @@ static const struct file_operations proc_sn_topo_fops = {
 void register_sn_procfs(void)
 {
 	static struct proc_dir_entry *sgi_proc_dir = NULL;
-	struct proc_dir_entry *pde;
 
 	BUG_ON(sgi_proc_dir != NULL);
 	if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
 		return;
 
-	pde = create_proc_entry("partition_id", 0444, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_partition_id_fops;
-	pde = create_proc_entry("system_serial_number", 0444, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_system_sn_fops;
-	pde = create_proc_entry("licenseID", 0444, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_license_id_fops;
-	pde = create_proc_entry("sn_force_interrupt", 0644, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_sn_force_intr_fops;
-	pde = create_proc_entry("coherence_id", 0444, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_coherence_id_fops;
-	pde = create_proc_entry("sn_topology", 0444, sgi_proc_dir);
-	if (pde)
-		pde->proc_fops = &proc_sn_topo_fops;
+	proc_create("partition_id", 0444, sgi_proc_dir,
+		    &proc_partition_id_fops);
+	proc_create("system_serial_number", 0444, sgi_proc_dir,
+		    &proc_system_sn_fops);
+	proc_create("licenseID", 0444, sgi_proc_dir, &proc_license_id_fops);
+	proc_create("sn_force_interrupt", 0644, sgi_proc_dir,
+		    &proc_sn_force_intr_fops);
+	proc_create("coherence_id", 0444, sgi_proc_dir,
+		    &proc_coherence_id_fops);
+	proc_create("sn_topology", 0444, sgi_proc_dir, &proc_sn_topo_fops);
 }
 
 #endif /* CONFIG_PROC_FS */
-- 
1.5.3.rc5


  parent reply	other threads:[~2008-04-08 11:26 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-08 11:18 [PATCH 0/29] proc entries creation race Denis V. Lunev
2008-04-08 11:19 ` [PATCH 1/29] proc: introduce proc_create_data to setup de->data Denis V. Lunev
2008-04-08 11:19 ` [PATCH 2/29] nfsd: use proc_create to setup de->proc_fops Denis V. Lunev
2008-04-08 11:19 ` [PATCH 3/29] nfs: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 4/29] afs: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 5/29] ext4: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 6/29] reiserfs: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 7/29] jbd2: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 8/29] proc: use non-racy method for /proc/page_owner creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 9/29] sysvipc: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 10/29] mm: use non-racy method for /proc/swaps creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 11/29] sound: use non-racy method for /proc/driver/snd-page-alloc creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 12/29] zorro: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 13/29] samples: use non-racy method for /proc/marker-example creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 14/29] scsi: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 15/29] usb: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 16/29] s390: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 17/29] arm: use non-racy method for /proc/davinci_clocks creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 18/29] avr32: proc: use non-racy method for /proc/tlb creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 19/29] cris: use non-racy method for /proc/system_profile creation Denis V. Lunev
2008-04-08 11:19 ` Denis V. Lunev [this message]
2008-04-08 11:19 ` [PATCH 21/29] parisc: use non-racy method for /proc/pcxl_dma creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 22/29] powerpc: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 23/29] acpi: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 24/29] net: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 25/29] isdn: " Denis V. Lunev
2008-04-30 17:57   ` [patch, -git] isdn: hysdn_procconf.c build fix Ingo Molnar
2008-04-30 18:10     ` Andrew Morton
2008-04-30 18:30       ` Ingo Molnar
2008-04-30 18:47         ` Andrew Morton
2008-04-30 19:03           ` Denis V. Lunev
2008-04-30 19:14             ` Andrew Morton
2008-04-30 19:24               ` Harvey Harrison
2008-04-30 21:21                 ` Alexey Dobriyan
2008-04-08 11:19 ` [PATCH 26/29] kernel: use non-racy method for proc entries creation Denis V. Lunev
2008-04-08 11:19 ` [PATCH 27/29] parisc: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 28/29] drivers: " Denis V. Lunev
2008-04-08 11:19 ` [PATCH 29/29] " Denis V. Lunev
2008-04-17 17:13   ` Dmitry Torokhov

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=1207653576-12640-20-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@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