#define P_(singular, plural, n) ((n) == 1 ? (singular) : (plural))
#endif
+#ifndef XATTR_NAME_POSIX_ACL_DEFAULT
+#define XATTR_NAME_POSIX_ACL_DEFAULT "posix_acl_default"
+#endif
+#ifndef XATTR_SECURITY_PREFIX
+#define XATTR_SECURITY_PREFIX "security."
+#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
+#endif
+
static ext2_filsys global_fs; /* Try not to use this directly */
#define dbg_printf(fuse2fs, format, ...) \
struct fuse2fs *ff = (struct fuse2fs *)ctxt->private_data;
ext2_filsys fs;
struct ext2_xattr_handle *h;
+ void *buf;
+ size_t buflen;
ext2_ino_t ino;
errcode_t err;
int ret = 0;
goto out2;
}
+ err = ext2fs_xattr_get(h, key, &buf, &buflen);
+ switch (err) {
+ case EXT2_ET_EA_KEY_NOT_FOUND:
+ /*
+ * ACLs are special snowflakes that require a 0 return when
+ * the ACL never existed in the first place.
+ */
+ if (!strncmp(XATTR_SECURITY_PREFIX, key,
+ XATTR_SECURITY_PREFIX_LEN))
+ ret = 0;
+ else
+ ret = -ENODATA;
+ goto out2;
+ case 0:
+ ext2fs_free_mem(&buf);
+ break;
+ default:
+ ret = translate_error(fs, ino, err);
+ goto out2;
+ }
+
err = ext2fs_xattr_remove(h, key);
if (err) {
ret = translate_error(fs, ino, err);