Streams support in Linux

Steve French smfrench at gmail.com
Tue Aug 28 19:43:12 UTC 2018


On Tue, Aug 28, 2018 at 1:41 PM Jeremy Allison <jra at samba.org> wrote:
>
> On Tue, Aug 28, 2018 at 01:32:39PM -0500, Steve French wrote:
> > On Tue, Aug 28, 2018 at 1:12 PM Jeremy Allison <jra at samba.org> wrote:
> > >
> > > On Mon, Aug 27, 2018 at 08:07:35PM -0500, Steve French wrote:
> > > >
> > > > Given that streams need to be read to backup Macs and Windows
> > > > (and for a few features of these servers mentioned earlier)
> > > > and would be exposed in ntfs (and SMB3 remotely) locally on Linux,
> > > > seems useful to me to have some consistent way to open and read
> > > > them on Linux even if we don't want to generalize it to other local fs.
> > > > The protocol supports it fine (just a file with a reserved character
> > > > ':' in it) but a little tricky to avoid name conflict with posix ':'
> > > > in filenames
> > >
> > > This sounds like a case for a couple of ioctls. One to enumerate
> > > the streams on an open fd, one to open a given stream name on an
> > > open fd.
> >
> > We already have a (cifs.ko) ioctl to enumerate streams, but I was
> > less comfortable with how to structure an ioctl to read/write a
> > stream (other than $DATA of course).  Ideas on what a "read stream"
> > ioctl might look like?
>
> You shouldn't need a read stream ioctl. You only need 3 I think.
>
> struct open_stream {
>         const char *stream_name;
>         int open_flags,
>         int stream_fd;
> };
>
> struct open_stream os = {
>                 "MyStreamName",
>                 O_CREAT,
>                 -1
> };
>
> 1). ioctl(file_or_dir_fd, FIO_OPEN_STREAM, &os);
>
> Now read/write the os->stream_fd for the created
> stream as desired. Use O_RDONLY|O_WRONLY|O_RDWR
> in the flags field as needed.
>
> 2). ioctl(file_or_dir_fd, FIO_ENUM_STREAMS_DIR, &new_fd);
>
> Now use readdir() to get the list.
>
> 3). ioctl(stream_fd, FIO_DELETE_STREAM, 0);
>
> Delete the stream opened on stream_fd.
>
> Doesn't that cover everything ?

This would be trickier to code than you might think.

In particular I think the reaadir to list streams is going to be
harder than the ioctl
I had coded for it.   I also had code at one point to convert streams
to xattrs etc.

-- 
Thanks,

Steve



More information about the samba-technical mailing list