Re: Using file type information from POSIX mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I would like to point out about one comment which I already discussed
with Ralph privately.

Mode as defined in that spec in section "2.1.1 posix mode" is _not_
compatible/same as the UNIX mode used by the Linux, BSD and other UNIX
systems.

The reason is that S_IFREG / S_IFDIR / S_IFLNK / S_IFCHR / S_IFBLK /
S_IFIFO / S_IFSOCK constants does not match with the values defined in
that SMB extension "2.1.1 posix mode".

This SMB extension defines type mask in 32-bit mode via bits 12-14 as:

0 - S_IFREG - regular file
1 - S_IFDIR - directory
2 - S_IFLNK - symlink
3 - S_IFCHR - character device
4 - S_IFBLK - block device
5 - S_IFIFO - FIFO
6 - S_IFSOCK - socket

And UNIX systems including Linux and BSD defines type mask in mode via
bits 12-16 as:

1  - S_IFIFO - FIFO
2  - S_IFCHR - character device
4  - S_IFDIR - directory
6  - S_IFBLK - block device
8  - S_IFREG - regular file
10 - S_IFLNK - symlink
12 - S_IFSOCK - socket

BSD additionally supports also:

14 - S_IFWHT - whiteout

Linux represents whiteout file as char device with both major and minor
numbers set to zero (and so this can be created by non-root user too).

Why where are "holes" in these ranges? This is because other UNIX V7
systems support also other file types. Whole list can be found for
example in extended Ubuntu xenial stat manpage, in section CONFORMING TO
in part "Other systems", which is available online at:
https://manpages.ubuntu.com/manpages/xenial/en/man2/stat.2.html

For completeness those types are:
0  - SCO out-of-service
3  - S_IFMPC - multiplexed character special
5  - S_IFNAM - XENIX named special file
7  - S_IFMPB - multiplexed block special
9  - S_IFCMP / S_IFNWK - VxFS compressed OR network special
11 - S_IFSHAD - Solaris shadow inode for ACL
13 - S_IFDOOR - Solaris door

I just wanted to highlight also for other developers that this SMB POSIX
spec that is not compatible with file type bits used in existing UNIX
systems. So if you are going to implement it, beware of it.

For me it looks very pity if a new spec is saying that is for POSIX
systems but is not compatible with existing UNIX / POSIX systems. But
well, I quite understand that Ralph wanted to do cleanup and remove
something which is not used anymore (like SCO or XENIX stuff; but I'm
not sure about Solaris, this is still used, also there is illumos).

Pali

On Tuesday 12 November 2024 10:30:21 Ralph Boehme wrote:
> ...resending to the right cifs list...
> 
> Folks?
> 
> -------- Forwarded Message --------
> Subject: Using file type information from POSIX mode
> Date: Sat, 9 Nov 2024 10:51:47 +0100
> From: Ralph Boehme <slow@xxxxxxxxx>
> To: Steven French <Steven.French@xxxxxxxxxxxxx>, Paulo Alcantara
> <palcantara@xxxxxxxxx>
> CC: cifs-protocol@xxxxxxxxxxxxxxx <cifs-protocol@xxxxxxxxxxxxxxx>
> 
> Steve, Paulo,
> 
> it seems kernel client doesn't yet implement using file type information
> from the updated POSIX mode as discussed at SDC:
> 
> <https://www.samba.org/~slow/SMB3_POSIX/fscc_posix_extensions.html#posix-file-type-definition>
> 
> Any plans? Samba already implements this.
> 
> Thanks!
> -slow




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux