-/* write a userspace buffer to disk.
- * NOTE: this returns 0 on success, not the number of bytes written. */
-static ssize_t
-filp_user_write(struct file *filp, const void *buf, size_t count,
- loff_t *offset)
-{
- mm_segment_t fs;
- ssize_t size = 0;
-
- fs = get_fs();
- set_fs(KERNEL_DS);
- while ((ssize_t)count > 0) {
- size = vfs_write(filp, (const void __user *)buf, count, offset);
- if (size < 0)
- break;
- count -= size;
- buf += size;
- size = 0;
- }
- set_fs(fs);
-
- return size;
-}
-