--- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -553,6 +553,9 @@ DISKFS_READONLY true. */ error_t diskfs_node_reload (struct node *node); +/* The user may define this function. */ +error_t diskfs_pathconf (struct node *np, int name, int *value); + /* If this function is nonzero (and diskfs_shortcut_symlink is set) it is called to set a symlink. If it returns EINVAL or isn't set, then the normal method (writing the contents into the file data) is --- /dev/null +++ b/libdiskfs/pathconf.c @@ -0,0 +1,8 @@ +#include "priv.h" + +error_t +diskfs_pathconf (struct node *np, int name, int *value) +{ + return EINVAL; +} + --- a/libdiskfs/io-pathconf.c +++ b/libdiskfs/io-pathconf.c @@ -30,6 +30,10 @@ if (!cred) return EOPNOTSUPP; + error_t err = diskfs_pathconf (cred->po->np, name, value); + if (err != EINVAL) + return err; + switch (name) { case _PC_LINK_MAX: --- a/tmpfs/tmpfs.c +++ b/tmpfs/tmpfs.c @@ -98,6 +98,22 @@ return 0; } +error_t +diskfs_pathconf (struct node *np, int name, int *value) +{ + switch (name) + { + case _PC_2_SYMLINKS: + *value = 1; + break; + + default: + return EINVAL; + } + + return 0; +} + int diskfs_synchronous = 0; static const struct argp_option options[] = --- a/libdiskfs/Makefile +++ b/libdiskfs/Makefile @@ -51,7 +51,7 @@ remount.c console.c disk-pager.c \ name-cache.c direnter.c dirrewrite.c dirremove.c lookup.c dead-name.c \ validate-mode.c validate-group.c validate-author.c validate-flags.c \ - validate-rdev.c validate-owner.c extra-version.c + validate-rdev.c validate-owner.c extra-version.c pathconf.c SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS) installhdrs = diskfs.h diskfs-pager.h