[linux-cifs-client] Re: POSIX Create/Mkdir and mode

Steve French smfrench at austin.rr.com
Fri Mar 9 16:01:25 GMT 2007


James Peach wrote:
>
> On 08/03/2007, at 12:30 PM, Jeremy Allison wrote:
>
>> On Thu, Mar 08, 2007 at 02:02:35PM -0600, Steve French wrote:
>>> Jeremy Allison wrote:
>>>> On Thu, Mar 08, 2007 at 12:20:16AM -0600, Steve French wrote:
>>>>
>>>>> Just notice in coding up PosixMkDir that mode in the UNIX_INFO_BASIC
>>>>> (original CIFS Unix Extensions) is 64 bit - not 32 bit as we have
>>>>> defined it in the new Posix Create/Mkdir call.
>>>>>
>>>>> This is probably harmless but wanted to see if anyone else is 
>>>>> bothered
>>>>> by this.
>>>>>
>>>>
>>>> Hmmm. Yep, you're right. If you want to change it now
>>>> is the last chance....
>>>>
>>>>
>>> For Linux it looks like kernel_mode_t can't be bigger than 32 bits on
>>> any arch, but what about for MacOS or Solaris or other Unix etc.
>>
>> James, George - Eric (if you're on this list). Please let
>> me know ASAP if you need this changing in the server code.
>
> 64 bits is fine by me, as long as no-one expects the upper 4 bytes to 
> do anything useful :)
>
> -- 
> James Peach | jpeach at samba.org
>
>
I have mixed feelings about this - 64 bits is clearly safest and easiest 
to explain otherwise having a mismatched size with the Unix Info call 
could lead people to do dumb/incompatible things and make implementation 
errors.  64 bits should not hurt performance but my scan shows typical 
mode_t is unsigned short or int and I don't see any platforms that are 
over 32 bits.

In the definition of the original cifs unix extensions this field was 
not called "mode" but "unix file permissions?"

By the way ... what is the "mode" returned by query file info level 
0x3f8 (it is 32 bits)?

My recommendation is:
change the field name in posix open to "permissions" (it really isn't 
the whole mode anyway) and make 64 bit for consistency (upper 52 bits 
are reserved)

Still expected to only contain 12 bits (little endian):
       S_ISUID    0004000   set UID bit
       S_ISGID    0002000   set-group-ID bit (see below)
       S_ISVTX    0001000   sticky bit (see below)
       S_IRUSR    00400     owner has read permission
       S_IWUSR    00200     owner has write permission
       S_IXUSR    00100     owner has execute permission
       S_IRGRP    00040     group has read permission
       S_IWGRP    00020     group has write permission
       S_IXGRP    00010     group has execute permission
       S_IROTH    00004     others have read permission
       S_IWOTH    00002     others have write permission
       S_IXOTH    00001     others have execute permission


File type is still the same enumeration (little endian) as:
#define UNIX_FILE      0
#define UNIX_DIR       1
#define UNIX_SYMLINK   2
#define UNIX_CHARDEV   3
#define UNIX_BLOCKDEV  4
#define UNIX_FIFO      5
#define UNIX_SOCKET    6

If no objections - I will update the wiki later today.

(if we ever expand this we could define one of these as "stream" some 
day in the sense of NTFS stream, and perhaps add one for junction and 
some of the other reparse point types as well but can wait until POSIX 
catches up).






More information about the linux-cifs-client mailing list