Ksmbd - create mask, directory mask

Why do these masks represent the "things you can do" in ksmbd?

I thought a mask ordinarily represented permissions being denied or taken away?

I am expecting answers along either of these lines. Thanks.

  1. Mask can mean either permissions being denied or granted. You have to find out which, for any particular usage.

  2. In ksmbd too masks deny permissions, in this special (subtle, complex) way. You just haven't caught on.

quick c&p from the docu:

- create mask (default: 0744)
		When a file is created, the necessary permissions are calculated
		according to the mapping from DOS modes to UNIX permissions, and
		the resulting UNIX mode is then bit-wise 'AND'ed with this
- directory mask (default: 0755)
		This parameter is the octal modes which are used when converting
		DOS modes to UNIX modes when creating UNIX directories.
1 Like

Thank you. I believe this is saying something like idea 1 from my question. The mask may "limit" but does not "take away."

So if the "resulting UNIX mode" is 770 and the create mask is 744, an "AND" operation would give us 740?

Because "AND" means permitting only what is permitted in both the "resulting UNIX mode" AND the create mask?

That's my totally random guess from the context. It's hard for me search for "AND" because it is such a common word.

Of course I also don't know how one comes up with the "result UNIX mode" because I don't know where one gets the "DOS modes," but that I can worry about later.