Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Ralph Boehme <slow@samba.org>
Cc: CIFS <linux-cifs@vger.kernel.org>,
	Steven French <Steven.French@microsoft.com>,
	Paulo Alcantara <pc@manguebit.com>,
	paalcant@redhat.com
Subject: Re: Using file type information from POSIX mode
Date: Fri, 15 Nov 2024 15:46:31 +0100	[thread overview]
Message-ID: <20241115144631.qkteeweaz44knr4c@pali> (raw)
In-Reply-To: <af3dab52-562c-439a-abca-b3d742d2716a@samba.org>

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@samba.org>
> To: Steven French <Steven.French@microsoft.com>, Paulo Alcantara
> <palcantara@samba.org>
> CC: cifs-protocol@lists.samba.org <cifs-protocol@lists.samba.org>
> 
> 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

  reply	other threads:[~2024-11-15 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7ef51654-5fa7-4333-8922-40bae24b18bc@samba.org>
2024-11-12  9:30 ` Fwd: Using file type information from POSIX mode Ralph Boehme
2024-11-15 14:46   ` Pali Rohár [this message]
2024-11-15 16:29     ` Ralph Boehme
2024-11-15 16:40       ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241115144631.qkteeweaz44knr4c@pali \
    --to=pali@kernel.org \
    --cc=Steven.French@microsoft.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=paalcant@redhat.com \
    --cc=pc@manguebit.com \
    --cc=slow@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox