[Click] [PATCH v2 5/5] ToUserDevice: use unlocked_ioctl if it's available
Beyers Cronje
bcronje at gmail.com
Tue Feb 1 13:26:49 EST 2011
Hi Eddie,
I tried my first pull request for a small patch yesterday, being a
git/github noob I'm not sure what the next step is. I presume you guys get
notified for a request?
Beyers
On Tue, Feb 1, 2011 at 5:08 PM, Eddie Kohler <kohler at cs.ucla.edu> wrote:
> Joonwoo,
>
> Please send a revised entire series of patches, or better, use github to
> prepare a pull request
>
> Thanks
> E
>
>
> On 1/31/11 11:20 PM, Joonwoo Park wrote:
> > Hi Eddie,
> >
> > Please find revised version of patch. This includes additional mutex as
> well as argument fix from previous patch.
> >
> > Thanks,
> > Joonwoo
> >
> > ---
> > elements/linuxmodule/touserdevice.cc | 20 ++++++++++++++++++++
> > elements/linuxmodule/touserdevice.hh | 7 +++++++
> > 2 files changed, 27 insertions(+), 0 deletions(-)
> >
> > diff --git a/elements/linuxmodule/touserdevice.cc
> b/elements/linuxmodule/touserdevice.cc
> > index fc0dc41..5285790 100644
> > --- a/elements/linuxmodule/touserdevice.cc
> > +++ b/elements/linuxmodule/touserdevice.cc
> > @@ -52,6 +52,7 @@ static int DEV_MINOR = 0;
> > static int DEV_NUM = 0;
> >
> > struct file_operations *ToUserDevice::dev_fops;
> > +static struct mutex ToUserDevice::_ioctl_mutex;
> >
> >
> > static volatile ToUserDevice *elem[20] = {0};
> > @@ -91,8 +92,16 @@ void ToUserDevice::static_initialize()
> > dev_fops->poll = dev_poll;
> > dev_fops->open = dev_open;
> > dev_fops->release = dev_release;
> > +#if HAVE_UNLOCKED_IOCTL
> > + dev_fops->unlocked_ioctl = dev_unlocked_ioctl;
> > +#else
> > dev_fops->ioctl = dev_ioctl;
> > +#endif
> > }
> > +
> > +#if HAVE_UNLOCKED_IOCTL
> > + mutex_init(&_ioctl_mutex);
> > +#endif
> > }
> >
> > void ToUserDevice::static_cleanup()
> > @@ -128,6 +137,17 @@ int ToUserDevice::dev_release(struct inode *inode,
> struct file *filp)
> > return 0;
> > }
> >
> > +#if HAVE_UNLOCKED_IOCTL
> > +long ToUserDevice::dev_unlocked_ioctl(struct file *filp, unsigned int
> command,
> > + unsigned long address)
> > +{
> > + mutex_lock(&_ioctl_mutex);
> > + long ret = dev_ioctl(NULL, filp, command, address);
> > + mutex_unlock(&_ioctl_mutex);
> > + return ret;
> > +}
> > +#endif
> > +
> > int ToUserDevice::dev_ioctl(struct inode *inode, struct file *filp,
> > unsigned command, unsigned long address)
> > {
> > diff --git a/elements/linuxmodule/touserdevice.hh
> b/elements/linuxmodule/touserdevice.hh
> > index b697ec8..80f3baa 100644
> > --- a/elements/linuxmodule/touserdevice.hh
> > +++ b/elements/linuxmodule/touserdevice.hh
> > @@ -131,6 +131,9 @@ private:
> > ulong _sleep_proc;
> >
> > static struct file_operations *dev_fops;
> > +#if HAVE_UNLOCKED_IOCTL
> > + static struct mutex _ioctl_mutex;
> > +#endif
> >
> > static ssize_t dev_read(struct file *file, char *buf, size_t count,
> loff_t *ppos);
> > static int dev_open(struct inode *inode, struct file *filp);
> > @@ -138,6 +141,10 @@ private:
> > static uint dev_poll(struct file *, struct poll_table_struct *);
> > static int dev_ioctl(struct inode *inode, struct file *filp,
> > unsigned command, unsigned long address);
> > +#if HAVE_UNLOCKED_IOCTL
> > + static long dev_unlocked_ioctl(struct file *filp, unsigned int
> command,
> > + unsigned long address);
> > +#endif
> > };
> >
> > #endif
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
More information about the click
mailing list