Re: Getting a lot of fs-generated information to user space

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

 



On Fri, Aug 12, 2011 at 02:14:15PM +0200, Jan Schmidt wrote:
> (1) Normally, requests to the file system go through ioctls (on the fd
> of the mountpoint) and the result is small enough to be returned when
> the ioctl finishes. That said, I thought of passing a user land fd along
> with this ioctl to the kernel and make it dump the generated bits there.
> Only, I don't see how to turn a fd into a struct file pointer. And I
> don't know if that would be considered really ugly by a lot of people.

struct file *filp = fget(fd);
...
fput(filp);

That said, why not have the ioctl mutate the existing fd?
ie in userspace:

int fd = open("/mnt/btrfs");
ioctl(fd, BTRFS_IOC_STREAM);
while (...) {
	read(fd, buf, 4096);
	...
}
close(fd);

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux