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

Martin Pitt martin.pitt at ubuntu.com
Thu May 28 12:03:26 PDT 2015

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

I'll look into making these more like open*_at() tomorrow.


Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

More information about the systemd-devel mailing list