lkml.org 
[lkml]   [2015]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [for-next][PATCH 7/7] tracing: Have mkdir and rmdir be part of tracefs
On Mon, 9 Feb 2015 15:07:22 +0900
Namhyung Kim <namhyung@kernel.org> wrote:

> On Wed, Feb 04, 2015 at 09:34:27AM -0500, Steven Rostedt wrote:
> > +static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umode_t mode)
> > +{
> > + char *name;
> > + int ret;
> > +
> > + name = get_dname(dentry);
> > + if (!name)
> > + return -ENOMEM;
> > +
> > + /*
> > + * The mkdir call can call the generic functions that create
>
> The mkdir can call ... ?

Actually, that wasn't a typo. "mkdir call" is the subject.

>
>
> > + * the files within the tracefs system. It is up to the individual
> > + * mkdir routine to handle races.
> > + */
> > + mutex_unlock(&inode->i_mutex);
> > + ret = tracefs_ops.mkdir(name);
> > + mutex_lock(&inode->i_mutex);
> > +
> > + kfree(name);
> > +
> > + return ret;
> > +}
> > +
> > +static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry)
> > +{
> > + char *name;
> > + int ret;
> > +
> > + name = get_dname(dentry);
> > + if (!name)
> > + return -ENOMEM;
> > +
> > + /*
> > + * The rmdir call can call the generic functions that create
>
> Ditto.
>

"rmdir call" is also the subject.

>
> > + * the files within the tracefs system. It is up to the individual
> > + * rmdir routine to handle races.
> > + * This time we need to unlock not only the parent (inode) but
> > + * also the directory that is being deleted.
> > + */
> > + mutex_unlock(&inode->i_mutex);
> > + mutex_unlock(&dentry->d_inode->i_mutex);
> > +
> > + ret = tracefs_ops.rmdir(name);
> > +
> > + mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT);
> > + mutex_lock(&dentry->d_inode->i_mutex);
> > +
> > + kfree(name);
> > +
> > + return ret;
> > +}
> > +
>
> [SNIP]
> > +/**
> > + * tracefs_create_instance_dir - create the tracing instances directory
> > + * @name: The name of the instances directory to create
> > + * @parent: The parent directory that the instances directory will exist
> > + * @mkdir: The function to call when a mkdir is performed.
> > + * @rmdir: The function to call when a rmdir is performed.
> > + *
> > + * Only one instances directory is allowed.
> > + *
> > + * The instances directory is special as it allows for mkdir and rmdir to
> > + * to be done by userspace. When a mkdir or rmdir is performed, the inode
> > + * locks are released and the methhods passed in (@mkdir and @rmdir) are
>
> s/methhods/methods/

I must have been on meth ;-)

Thanks.

-- Steve


\
 
 \ /
  Last update: 2015-02-09 16:21    [W:0.046 / U:6.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site