github / libprojfs

Linux projected filesystem library
GNU Lesser General Public License v2.1
93 stars 14 forks source link

use common xattr set function and text empty flag #56

Closed chrisd8088 closed 5 years ago

chrisd8088 commented 5 years ago

If we use the single character y instead of a binary 1 as the flag value of our user.projection.empty extended attribute, then the command-line getfattr(1) utility guesses the attribute value has a text encoding and prints a human-readable "y" instead of a Base64-encoded string.

This also aligns us with how overlayfs flags its opaque directories (i.e., with "trusted.overlay.opaque"="y").

We can also collect our various calls to fsetxattr(2) into a new common function, which then simplifies some of our error handling.

And, we can use XATTR_CREATE on all fsetxattr() calls, except for the top-level directory which we expect to exist at mount time and might have a leftover attribute from a previous projfs mount.

chrisd8088 commented 5 years ago

@kivikakk, I just realized I left XATTR_CREATE in there, and I meant to think more about that. Please don't merge quite yet; I may want to add a toggle so that the empty top-level dir can already have our xattr and we won't throw an error. Stay tuned.

chrisd8088 commented 5 years ago

OK, now that's what I meant to do. Sorry about that!