Re: [PATCH] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_PIPE

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

 



On Sun, Jul 3, 2011 at 8:44 PM, Sasha Levin <levinsasha928@xxxxxxxxx> wrote:
>> > +static ssize_t kernel_write(struct file *file, const char *buf, size_t count,
>> > +                       loff_t pos)
>> > +{
>> > +   mm_segment_t old_fs;
>> > +   ssize_t res;
>> > +
>> > +   old_fs = get_fs();
>> > +   set_fs(get_ds());
>> > +   /* The cast to a user pointer is valid due to the set_fs() */
>> > +   res = vfs_write(file, (const char __user *)buf, count,&pos);
>> > +   set_fs(old_fs);
>> > +
>> > +   return res;
>> > +}
>> > +
>>
>> Is there no generic helper for this?  Should there be?
>>
>
> I couldn't find one, I took the code above from fs/splice.c.
>
> There should probably be a generic version of it as this snippet repeats
> itself in several locations throughout the kernel.

But not all of them do just vfs_write() after set_fs(). I don't think
a generic kernel_wrapper() is worth it to be honest.

                              Pekka
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux