freebsd-dev/sys/fs
Dmitry Chagin 77d3337c9f Implement proper Linux /dev/fd and /proc/self/fd behavior by adding
Linux specific things to the native fdescfs file system.

Unlike FreeBSD, the Linux fdescfs is a directory containing a symbolic
links to the actual files, which the process has open.
A readlink(2) call on this file returns a full path in case of regular file
or a string in a special format (type:[inode], anon_inode:<file-type>, etc..).
As well as in a FreeBSD, opening the file in the Linux fdescfs directory is
equivalent to duplicating the corresponding file descriptor.

Here we have mutually exclusive requirements:
- in case of readlink(2) call fdescfs lookup() method should return VLNK
vnode otherwise our kern_readlink() fail with EINVAL error;
- in the other calls fdescfs lookup() method should return non VLNK vnode.

For what new vnode v_flag VV_READLINK was added, which is set if fdescfs has beed
mounted with linrdlnk option an modified kern_readlinkat() to properly handle it.

For now For Linux ABI compatibility mount fdescfs volume with linrdlnk option:

    mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd

Reviewed by:	kib@
MFC after:	1 week
Relnotes:	yes
2017-08-01 03:40:19 +00:00
..
autofs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
cd9660 Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
cuse Minor code optimisation. 2017-05-31 21:05:24 +00:00
deadfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
devfs Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
ext2fs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fdescfs Implement proper Linux /dev/fd and /proc/self/fd behavior by adding 2017-08-01 03:40:19 +00:00
fifofs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
fuse Complete support for IO_APPEND flag in fuse 2017-06-28 13:56:15 +00:00
msdosfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nandfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
nfs Add kernel support for the NFS client forced dismount "umount -N" option. 2017-07-29 19:52:47 +00:00
nfsclient Add kernel support for the NFS client forced dismount "umount -N" option. 2017-07-29 19:52:47 +00:00
nfsserver Improve FHA locality control for NFS read/write requests. 2017-07-31 15:23:19 +00:00
nullfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
procfs remove procfs ctl interface 2017-03-05 03:05:24 +00:00
pseudofs Fix LINT, broken by a -Wformat warning in r320329 with PFS_DELEN being 2017-06-27 17:01:46 +00:00
smbfs Mark pages after EOF as clean after pageout. 2017-07-26 20:07:05 +00:00
tmpfs Consistently use vop_stdpathconf() for default pathconf values. 2017-07-11 21:55:20 +00:00
udf On error, bread(9) zeroes buffer pointer, do not dereference it. 2016-11-22 13:24:57 +00:00
unionfs Renumber copyright clause 4 2017-02-28 23:42:47 +00:00