lkml.org 
[lkml]   [2021]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC v1 7/8] mshv: implement in-kernel device framework
On Fri, Jul 09, 2021 at 04:32:48PM +0100, Matthew Wilcox wrote:
> On Fri, Jul 09, 2021 at 01:50:13PM +0000, Wei Liu wrote:
> > On Fri, Jul 09, 2021 at 02:02:04PM +0100, Matthew Wilcox wrote:
> > > On Fri, Jul 09, 2021 at 11:43:38AM +0000, Wei Liu wrote:
> > > > +static long
> > > > +mshv_partition_ioctl_create_device(struct mshv_partition *partition,
> > > > + void __user *user_args)
> > > > +{
> > > [...]
> > > > + mshv_partition_get(partition);
> > > > + r = anon_inode_getfd(ops->name, &mshv_device_fops, dev, O_RDWR | O_CLOEXEC);
> > > > + if (r < 0) {
> > > > + mshv_partition_put_no_destroy(partition);
> > > > + list_del(&dev->partition_node);
> > > > + ops->destroy(dev);
> > > > + goto out;
> > > > + }
> > > > +
> > > > + cd->fd = r;
> > > > + r = 0;
> > >
> > > Why return the fd in memory instead of returning the fd as the return
> > > value from the ioctl?
> > >
> > > > + if (copy_to_user(user_args, &tmp, sizeof(tmp))) {
> > > > + r = -EFAULT;
> > > > + goto out;
> > > > + }
> > >
> > > ... this could then disappear.
> >
> > Thanks for your comment, Matthew.
> >
> > This is intentionally because I didn't want to deviate from KVM's API.
> > The fewer differences the better.
>
> Then don't define your own structure. Use theirs.

I specifically mentioned in the cover letter I didn't do it because I
was not sure if that would be acceptable. I guess I will find out.

Wei.

\
 
 \ /
  Last update: 2021-07-09 18:28    [W:0.425 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site