* [RFC] Passing stream to userspace
@ 2011-08-12 15:30 Jan Schmidt
2011-08-16 2:49 ` Anand Jain
0 siblings, 1 reply; 2+ messages in thread
From: Jan Schmidt @ 2011-08-12 15:30 UTC (permalink / raw)
To: Al Viro, Christoph Hellwig
Cc: Chris Mason, Matthew Wilcox, linux-btrfs, linux-fsdevel
Hi there,
I was promised you (viro, hch) have a decided opinion on this topic. The
original mail ("Getting a lot of fs-generated information to user
space") contains a lot of background and is way too long. Point is: I
want to get a bunch of data generated by the kernel (btrfs) to userland
(really).
Matthew Wilcox suggested to use an ioctl changing f_ops.read. Userland
would be like:
> int fd = open("/mnt/btrfs");
> ioctl(fd, BTRFS_IOC_STREAM);
> while (...) {
> read(fd, buf, 4096);
> ...
> }
> close(fd);
To avoid doing buffering myself, I suggested passing a fd to the kernel
where it is expected to dump the generated information, like:
> int fd;
> int pipefd[2];
> struct io_args io_args;
>
> fd = open("/mnt/btrfs");
> pipe(pipefd);
> io_agrs.dest = pipefd[0];
>
> /* thread 1 */
> ioctl(fd, BTRFS_IOC_STREAM, &io_args);
> /* thread 2 */
> while (...) {
> read(pipefd[1], buf, 4096);
> ...
> }
Any opinions on those or different suggestions? Thanks,
-Jan
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] Passing stream to userspace
2011-08-12 15:30 [RFC] Passing stream to userspace Jan Schmidt
@ 2011-08-16 2:49 ` Anand Jain
0 siblings, 0 replies; 2+ messages in thread
From: Anand Jain @ 2011-08-16 2:49 UTC (permalink / raw)
To: Jan Schmidt
Cc: Al Viro, Christoph Hellwig, Chris Mason, Matthew Wilcox,
linux-btrfs, linux-fsdevel
Jan,
I personally like the way we interact with the kernel using the
/sys or /proc that's a cool way, mainly because no C code is required.
A generic interface like that (or btrfs-control with more commands
supported) will enhance troubleshooting and debugging, application
interface.
or did I miss anything ?
Cheers, Anand
On 08/12/2011 11:30 PM, Jan Schmidt wrote:
> Hi there,
>
> I was promised you (viro, hch) have a decided opinion on this topic. The
> original mail ("Getting a lot of fs-generated information to user
> space") contains a lot of background and is way too long. Point is: I
> want to get a bunch of data generated by the kernel (btrfs) to userland
> (really).
>
> Matthew Wilcox suggested to use an ioctl changing f_ops.read. Userland
> would be like:
>
>> int fd = open("/mnt/btrfs");
>> ioctl(fd, BTRFS_IOC_STREAM);
>> while (...) {
>> read(fd, buf, 4096);
>> ...
>> }
>> close(fd);
>
> To avoid doing buffering myself, I suggested passing a fd to the kernel
> where it is expected to dump the generated information, like:
>
>> int fd;
>> int pipefd[2];
>> struct io_args io_args;
>>
>> fd = open("/mnt/btrfs");
>> pipe(pipefd);
>> io_agrs.dest = pipefd[0];
>>
>> /* thread 1 */
>> ioctl(fd, BTRFS_IOC_STREAM,&io_args);
>> /* thread 2 */
>> while (...) {
>> read(pipefd[1], buf, 4096);
>> ...
>> }
>
> Any opinions on those or different suggestions? Thanks,
> -Jan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-16 2:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 15:30 [RFC] Passing stream to userspace Jan Schmidt
2011-08-16 2:49 ` Anand Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).