[systemd-devel] [PATCH] path-util: Fix path_is_mount_point for files

Lennart Poettering lennart at poettering.net
Fri May 29 02:33:23 PDT 2015

On Thu, 28.05.15 21:03, Martin Pitt (martin.pitt at ubuntu.com) wrote:

> Hello Lennart,
> Lennart Poettering [2015-05-28 19:44 +0200]:
> > On Wed, 27.05.15 10:07, Martin Pitt (martin.pitt at ubuntu.com) wrote:
> > 
> > > -int fd_is_mount_point(int fd) {
> > > +int fd_is_mount_point(int fd, const char *parent) {
> > 
> > Hmm, now I am confused? Why "parent"?
> > 
> > I really think this should work as close as the usual *at() calls
> > work. i.e. take a dir fd as first argument, and a filename
> > *within*that*directory* to check. Maybe even give it the _at() suffix:
> > 
> > int fd_is_mount_point_at(int fd, const char *filename, int flags);
> > int path_is_mount_point(const char *path, int flags);
> > 
> > path_is_mount_point() simply seperates the last part of the path,
> > opens its parent directory, and then invokes fd_is_mount_point_at()
>             ^^^^^^
> > with the parent dir and the last component...
>            ^^^^^^
> Exactly, that's why I called it "parent"; but I'm not fussed about the
> name, "dir" or "containing_dir" would work as well. I'd just not call
> it "filename" as that would be confusing -- this is *not* the file
> name of fd, but the directory it lives in (i. e. fd's "parent" if you
> will).

Now even more confused.

I say: the fd parameter should refer to the directory, and the string
parameter to the file name in that directory.

But I really don't grok what you think it should refer to: what does
the fd param refer to? the file itself, and the string parameter the
path to the directory this is in? That'd be very weird, no?

I am completely puzzled...


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list