public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Takenori Nagano <t-nagano@ah.jp.nec.com>
Cc: linux-kernel@vger.kernel.org, vgoyal@in.ibm.com,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	k-miyoshi@cb.jp.nec.com, kexec@lists.infradead.org,
	Bernhard Walle <bwalle@suse.de>, Keith Owens <kaos@ocs.com.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	kdb@oss.sgi.com
Subject: Re: [PATCH 1/2] add tunable_notifier function
Date: Thu, 4 Oct 2007 09:11:57 -0700	[thread overview]
Message-ID: <20071004091157.c35f3513.randy.dunlap@oracle.com> (raw)
In-Reply-To: <4704D0BA.4090507@ah.jp.nec.com>

On Thu, 04 Oct 2007 20:38:34 +0900 Takenori Nagano wrote:

> This patch adds new notifier function tunable_notifier_chain. Its base is
> atomic_notifier_chain.
> 
> Thanks,
> 
> ---
> 
> Signed-off-by: Takenori Nagano <t-nagano@ah.jp.nec.com>
> 
> ---

> diff -uprN linux-2.6.23-rc9.orig/kernel/sys.c linux-2.6.23-rc9/kernel/sys.c
> --- linux-2.6.23-rc9.orig/kernel/sys.c	2007-10-02 12:24:52.000000000 +0900
> +++ linux-2.6.23-rc9/kernel/sys.c	2007-10-03 14:48:15.160000000 +0900
> @@ -38,6 +38,7 @@
>  #include <linux/syscalls.h>
>  #include <linux/kprobes.h>
>  #include <linux/user_namespace.h>
> +#include <linux/debugfs.h>
> 
>  #include <asm/uaccess.h>
>  #include <asm/io.h>
> @@ -393,6 +394,234 @@ int blocking_notifier_call_chain(struct

> +/**
> + *	tunable_notifier_chain_register - Add notifier to an tunable notifier chain
> + *	@nh: Pointer to head of the tunable notifier chain
> + *	@n: New entry in notifier chain
> + *	@name: Pointer to the name of this notifier chain

Is @name the name of a notifier chain or of the new notifier entry?


> + *	@desc: Pointer to the description of new entry
> + *
> + *	Adds a notifier to an tunable notifier chain and makes control dir.
> + *
> + *	Returns zero on success or %-ENODEV on failure.
> + */
> +
> +int tunable_notifier_chain_register(struct tunable_notifier_head *nh,
> +		struct tunable_notifier_block *n, char *name, char *desc)
> +{
> +	unsigned long flags;
> +	int ret = -EINVAL;
> +	struct dentry *nh_dir, *nb_dir, *pri_dentry, *desc_dentry = NULL;
> +
> +	if (!name)
> +		goto nb_fail;
> +
> +	ret = -ENOMEM;
> +	if (!nh->dir) {
> +		nh_dir = debugfs_create_dir(nh->name, NULL);
> +		if (!nh_dir)
> +			return ret;
> +		nh->dir = nh_dir;
> +	} else
> +		nh_dir = nh->dir;
> +
> +	nb_dir = debugfs_create_dir(name, nh_dir);
> +	if (!nb_dir)
> +		goto nb_fail;
> +	n->dir = nb_dir;
> +
> +	pri_dentry = debugfs_create_file("priority",0600, nb_dir, n, &pri_fops);
> +	if (!pri_dentry)
> +		goto pri_fail;
> +	n->pri_dentry = pri_dentry;
> +
> +	if (desc) {
> +		desc_dentry = debugfs_create_file("description", 0400, nb_dir,
> +							desc, &desc_fops);
> +		if (!desc_dentry)
> +			goto desc_fail;
> +		n->desc_dentry = desc_dentry;
> +	}
> +
> +	spin_lock_irqsave(&nh->lock, flags);
> +	ret = notifier_chain_register(&nh->head, n->nb);
> +	spin_unlock_irqrestore(&nh->lock, flags);
> +
> +	if (ret)
> +		goto reg_fail;
> +	
> +	n->head = nh;
> +
> +	return ret;
> +
> +reg_fail:
> +	debugfs_remove(desc_dentry);
> +desc_fail:
> +	debugfs_remove(pri_dentry);
> +pri_fail:
> +	debugfs_remove(nb_dir);
> +nb_fail:
> +	return ret;
> +}
> +
> +EXPORT_SYMBOL_GPL(tunable_notifier_chain_register);

---
~Randy

  reply	other threads:[~2007-10-04 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 11:38 [PATCH 1/2] add tunable_notifier function Takenori Nagano
2007-10-04 16:11 ` Randy Dunlap [this message]
2007-10-05  5:06   ` Takenori Nagano
2007-10-05  5:42 ` Vivek Goyal
2007-10-05  5:49   ` Takenori Nagano
2007-10-05 12:49 ` Eric W. Biederman

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=20071004091157.c35f3513.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=bwalle@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=k-miyoshi@cb.jp.nec.com \
    --cc=kaos@ocs.com.au \
    --cc=kdb@oss.sgi.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=t-nagano@ah.jp.nec.com \
    --cc=vgoyal@in.ibm.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