Re: [PATCH v2] remove no longer use of pdflush interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/06/2012 01:28 AM, Andrew Morton wrote:

> On Tue,  5 Jun 2012 17:26:11 +0800
> Wanpeng Li <liwp.linux@xxxxxxxxx> wrote:
> 
> So perhaps the solution is to give up on the generic proc_obsolete()
> idea, and just add a handler specifically for nr_pdflush_threads, whcih
> uses printk_once().
> 


If there are many users than a self made print once is worth it
we can use the ctl_table->data pointer for this, some thing like:

int nr_pdflush_was_printed;

@@ -1095,11 +1095,9 @@ static struct ctl_table vm_table[] = {
 		.extra1		= &zero,
 	},
 	{
-		.procname	= "nr_pdflush_threads",
-		.data		= &nr_pdflush_threads,
-		.maxlen		= sizeof nr_pdflush_threads,
-		.mode		= 0444 /* read-only*/,
-		.proc_handler	= proc_dointvec,
+		.data		= &nr_pdflush_was_printed,
+		.procname       = "nr_pdflush_threads",
+		.mode           = 0444 /* read-only */,
+		.proc_handler   = proc_obsolete,
 	},


+/* notice associated proc deprecated */
+int proc_deprecated(struct ctl_table *table, int write,
+		    void __user *buffer, size_t *lenp, loff_t *ppos, )
+{
+	if (*ctl_table->data) {
+		printk(KERN_WARNING "%s exported in /proc is deprecated\n",
+			table->procname);
+		*ctl_table->data = 0;
+	}
+	return -ENOSYS;
+}
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux