Re: [PATCH 07/14] VFS: Add a sample program for fsopen/fsmount [ver #6]
From: David Howells
Date: Thu Oct 26 2017 - 18:40:32 EST
Jeff Layton <jlayton@xxxxxxxxxx> wrote:
> So to make sure I understand....
>
> Suppose I want to do a bind mount with the new API. Would I do something
> like this?
>
> mfd = fsopen("???");
> write(mfd, "s /path/to/old/mount");
You would have to use something other than "s" as that indicates the medium
source, but there are plenty of other options. Alternatively, something like:
mfd = mntopen("/path/to/old/mount", ...);
You would need some way to retrieve the fs type, though. Maybe the first
read() you do will return it:
char fstype[256];
read(mfd, fstype, 256);
ends up with:
"fs <type>"
in the buffer, though I think I'd prefer it to be manually elicited.
> write(mfd, "o bind");
This is unnecessary as you can just do:
> fsmount(mfd, ...);
at this point to achieve the effect.
> That seems a bit klunkier than before as I now need to pay attention to
> the fstype. I guess I'd have to scrape /proc/mounts for that info?
I haven't worked out this interface yet. I'm not sure it's actually necessary
at this point, though it'd be nice to have.
David