diff options
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/diskfs.h | 6 | ||||
-rw-r--r-- | libdiskfs/io-pathconf.c | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h index 65452c60..e8974a11 100644 --- a/libdiskfs/diskfs.h +++ b/libdiskfs/diskfs.h @@ -201,6 +201,12 @@ extern size_t diskfs_dirstat_size; reimplement dir_rename yourself. */ extern int diskfs_link_max; +/* The user must define this variable; it is the maximum length of + a single pathname component (i.e. file name within directory). + The filesystem code does not use this for anything, but it is + returned to user queries for _PC_NAME_MAX. */ +extern int diskfs_name_max; + /* The user must define this variable; it is the maximum number of symlinks to be traversed within a single call to dir_pathtrans. If this is exceeded, dir_pathtrans will return ELOOP. */ diff --git a/libdiskfs/io-pathconf.c b/libdiskfs/io-pathconf.c index 666e039a..ec13fd14 100644 --- a/libdiskfs/io-pathconf.c +++ b/libdiskfs/io-pathconf.c @@ -22,7 +22,7 @@ /* Implement io_pathconf as described in <hurd/io.defs>. */ kern_return_t diskfs_S_io_pathconf (struct protid *cred, - int name, + int name, int *value) { if (!cred) @@ -41,9 +41,10 @@ diskfs_S_io_pathconf (struct protid *cred, case _PC_SOCK_MAXBUF: *value = -1; break; - + case _PC_NAME_MAX: - *value = 1024; /* see <hurd/hurd_types.defs> string_t */ + /* <hurd/hurd_types.defs> string_t constrains the upper bound. */ + *value = diskfs_name_max > 1024 ? 1024 : diskfs_name_max; break; case _PC_CHOWN_RESTRICTED: @@ -52,7 +53,7 @@ diskfs_S_io_pathconf (struct protid *cred, case _PC_ASYNC_IO: *value = 1; break; - + case _PC_PRIO_IO: *value = 0; break; @@ -64,6 +65,6 @@ diskfs_S_io_pathconf (struct protid *cred, default: return EINVAL; } - + return 0; } |