Defining PATH_MAX for a filesystem?

前端 未结 6 1647
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 02:09

I\'m presently writing a filesystem. The statvfs (and even the statfs) structs contain a field specifying the maximum length of a name in that path. As PATH_M

6条回答
  •  情深已故
    2021-02-04 02:41

    PATH_MAX mostly behaves as a property of the file system function call interface, so I don't think it makes much sense to have it vary across directories.

    For example, renaming or moving a directory with large directory trees in it may make the longest absolute pathname longer and it would be complicated and inefficient to limit that.

    Instead, PATH_MAX serves to allow the kernel to copy passed pathnames to temporary unpaged memory, which can then be processed without needing to allow for a page fault at each access. Allocating huge amounts of such memory may block most other things the kernel is doing or even cause kernel panics.

提交回复
热议问题