1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
8 #include <linux/blkdev.h>
9 #include <linux/buffer_head.h>
11 #include <linux/nls.h>
12 #include <linux/posix_acl.h>
13 #include <linux/posix_acl_xattr.h>
14 #include <linux/xattr.h>
21 #define SYSTEM_DOS_ATTRIB "system.dos_attrib"
22 #define SYSTEM_NTFS_ATTRIB "system.ntfs_attrib"
23 #define SYSTEM_NTFS_SECURITY "system.ntfs_security"
26 static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
28 return ea->size ? le32_to_cpu(ea->size)
29 : ALIGN(struct_size(ea, name,
31 le16_to_cpu(ea->elength)),
35 static inline size_t packed_ea_size(const struct EA_FULL *ea)
37 return struct_size(ea, name,
38 1 + ea->name_len + le16_to_cpu(ea->elength)) -
39 offsetof(struct EA_FULL, flags);
45 * Assume there is at least one xattr in the list.
47 static inline bool find_ea(const struct EA_FULL *ea_all, u32 bytes,
48 const char *name, u8 name_len, u32 *off)
52 if (!ea_all || !bytes)
56 const struct EA_FULL *ea = Add2Ptr(ea_all, *off);
57 u32 next_off = *off + unpacked_ea_size(ea);
62 if (ea->name_len == name_len &&
63 !memcmp(ea->name, name, name_len))
67 if (next_off >= bytes)
73 * ntfs_read_ea - Read all extended attributes.
74 * @ea: New allocated memory.
75 * @info: Pointer into resident data.
77 static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
78 size_t add_bytes, const struct EA_INFO **info)
81 struct ATTR_LIST_ENTRY *le = NULL;
82 struct ATTRIB *attr_info, *attr_ea;
86 static_assert(le32_to_cpu(ATTR_EA_INFO) < le32_to_cpu(ATTR_EA));
92 ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, NULL);
94 ni_find_attr(ni, attr_info, &le, ATTR_EA, NULL, 0, NULL, NULL);
96 if (!attr_ea || !attr_info)
99 *info = resident_data_ex(attr_info, sizeof(struct EA_INFO));
103 /* Check Ea limit. */
104 size = le32_to_cpu((*info)->size);
105 if (size > ni->mi.sbi->ea_max_size)
108 if (attr_size(attr_ea) > ni->mi.sbi->ea_max_size)
111 /* Allocate memory for packed Ea. */
112 ea_p = kmalloc(size + add_bytes, GFP_NOFS);
116 if (attr_ea->non_res) {
117 struct runs_tree run;
121 err = attr_load_runs(attr_ea, ni, &run, NULL);
123 err = ntfs_read_run_nb(ni->mi.sbi, &run, 0, ea_p, size,
130 void *p = resident_data_ex(attr_ea, size);
136 memcpy(ea_p, p, size);
139 memset(Add2Ptr(ea_p, size), 0, add_bytes);
152 * Copy a list of xattrs names into the buffer
153 * provided, or compute the buffer size required.
156 * * Number of bytes used / required on
157 * * -ERRNO - on failure
159 static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
160 size_t bytes_per_buffer)
162 const struct EA_INFO *info;
163 struct EA_FULL *ea_all = NULL;
164 const struct EA_FULL *ea;
169 err = ntfs_read_ea(ni, &ea_all, 0, &info);
173 if (!info || !ea_all)
176 size = le32_to_cpu(info->size);
178 /* Enumerate all xattrs. */
179 for (ret = 0, off = 0; off < size; off += unpacked_ea_size(ea)) {
180 ea = Add2Ptr(ea_all, off);
183 if (ret + ea->name_len + 1 > bytes_per_buffer) {
188 memcpy(buffer + ret, ea->name, ea->name_len);
189 buffer[ret + ea->name_len] = 0;
192 ret += ea->name_len + 1;
197 return err ? err : ret;
200 static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len,
201 void *buffer, size_t size, size_t *required)
203 struct ntfs_inode *ni = ntfs_i(inode);
204 const struct EA_INFO *info;
205 struct EA_FULL *ea_all = NULL;
206 const struct EA_FULL *ea;
210 if (!(ni->ni_flags & NI_FLAG_EA))
218 if (name_len > 255) {
223 err = ntfs_read_ea(ni, &ea_all, 0, &info);
230 /* Enumerate all xattrs. */
231 if (!find_ea(ea_all, le32_to_cpu(info->size), name, name_len, &off)) {
235 ea = Add2Ptr(ea_all, off);
237 len = le16_to_cpu(ea->elength);
250 memcpy(buffer, ea->name + ea->name_len + 1, len);
258 return err ? err : len;
261 static noinline int ntfs_set_ea(struct inode *inode, const char *name,
262 size_t name_len, const void *value,
263 size_t val_size, int flags, int locked)
265 struct ntfs_inode *ni = ntfs_i(inode);
266 struct ntfs_sb_info *sbi = ni->mi.sbi;
268 struct EA_INFO ea_info;
269 const struct EA_INFO *info;
270 struct EA_FULL *new_ea;
271 struct EA_FULL *ea_all = NULL;
272 size_t add, new_pack;
276 struct ATTR_LIST_ENTRY *le;
277 struct mft_inode *mi;
278 struct runs_tree ea_run;
287 if (name_len > 255) {
292 add = ALIGN(struct_size(ea_all, name, 1 + name_len + val_size), 4);
294 err = ntfs_read_ea(ni, &ea_all, add, &info);
299 memset(&ea_info, 0, sizeof(ea_info));
303 memcpy(&ea_info, info, sizeof(ea_info));
304 size = le32_to_cpu(ea_info.size);
305 size_pack = ea_info.size_pack;
308 if (info && find_ea(ea_all, size, name, name_len, &off)) {
312 if (flags & XATTR_CREATE) {
317 ea = Add2Ptr(ea_all, off);
320 * Check simple case when we try to insert xattr with the same value
321 * e.g. ntfs_save_wsl_perm
323 if (val_size && le16_to_cpu(ea->elength) == val_size &&
324 !memcmp(ea->name + ea->name_len + 1, value, val_size)) {
325 /* xattr already contains the required value. */
329 /* Remove current xattr. */
330 if (ea->flags & FILE_NEED_EA)
331 le16_add_cpu(&ea_info.count, -1);
333 ea_sz = unpacked_ea_size(ea);
335 le16_add_cpu(&ea_info.size_pack, 0 - packed_ea_size(ea));
337 memmove(ea, Add2Ptr(ea, ea_sz), size - off - ea_sz);
340 memset(Add2Ptr(ea_all, size), 0, ea_sz);
342 ea_info.size = cpu_to_le32(size);
344 if ((flags & XATTR_REPLACE) && !val_size) {
349 if (flags & XATTR_REPLACE) {
355 ea_all = kzalloc(add, GFP_NOFS);
363 /* Append new xattr. */
364 new_ea = Add2Ptr(ea_all, size);
365 new_ea->size = cpu_to_le32(add);
367 new_ea->name_len = name_len;
368 new_ea->elength = cpu_to_le16(val_size);
369 memcpy(new_ea->name, name, name_len);
370 new_ea->name[name_len] = 0;
371 memcpy(new_ea->name + name_len + 1, value, val_size);
372 new_pack = le16_to_cpu(ea_info.size_pack) + packed_ea_size(new_ea);
374 /* Should fit into 16 bits. */
375 if (new_pack > 0xffff) {
376 err = -EFBIG; // -EINVAL?
379 ea_info.size_pack = cpu_to_le16(new_pack);
381 /* New size of ATTR_EA. */
383 if (size > sbi->ea_max_size) {
384 err = -EFBIG; // -EINVAL?
387 ea_info.size = cpu_to_le32(size);
398 err = ni_insert_resident(ni, sizeof(struct EA_INFO),
399 ATTR_EA_INFO, NULL, 0, NULL, NULL,
404 err = ni_insert_resident(ni, 0, ATTR_EA, NULL, 0, NULL, NULL,
411 err = attr_set_size(ni, ATTR_EA, NULL, 0, &ea_run, new_sz, &new_sz,
417 attr = ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, &mi);
424 /* Delete xattr, ATTR_EA_INFO */
425 ni_remove_attr_le(ni, attr, mi, le);
427 p = resident_data_ex(attr, sizeof(struct EA_INFO));
432 memcpy(p, &ea_info, sizeof(struct EA_INFO));
437 attr = ni_find_attr(ni, NULL, &le, ATTR_EA, NULL, 0, NULL, &mi);
444 /* Delete xattr, ATTR_EA */
445 ni_remove_attr_le(ni, attr, mi, le);
446 } else if (attr->non_res) {
447 err = ntfs_sb_write_run(sbi, &ea_run, 0, ea_all, size);
451 p = resident_data_ex(attr, size);
456 memcpy(p, ea_all, size);
460 /* Check if we delete the last xattr. */
462 ni->ni_flags |= NI_FLAG_EA;
464 ni->ni_flags &= ~NI_FLAG_EA;
466 if (ea_info.size_pack != size_pack)
467 ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
468 mark_inode_dirty(&ni->vfs_inode);
480 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
481 static inline void ntfs_posix_acl_release(struct posix_acl *acl)
483 if (acl && refcount_dec_and_test(&acl->a_refcount))
487 static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
488 struct inode *inode, int type,
491 struct ntfs_inode *ni = ntfs_i(inode);
494 struct posix_acl *acl;
499 /* Allocate PATH_MAX bytes. */
502 return ERR_PTR(-ENOMEM);
504 /* Possible values of 'type' was already checked above. */
505 if (type == ACL_TYPE_ACCESS) {
506 name = XATTR_NAME_POSIX_ACL_ACCESS;
507 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
509 name = XATTR_NAME_POSIX_ACL_DEFAULT;
510 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
516 err = ntfs_get_ea(inode, name, name_len, buf, PATH_MAX, &req);
521 /* Translate extended attribute to acl. */
523 acl = posix_acl_from_xattr(mnt_userns, buf, err);
525 set_cached_acl(inode, type, acl);
527 acl = err == -ENODATA ? NULL : ERR_PTR(err);
536 * ntfs_get_acl - inode_operations::get_acl
538 struct posix_acl *ntfs_get_acl(struct inode *inode, int type)
540 /* TODO: init_user_ns? */
541 return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
544 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
545 struct inode *inode, struct posix_acl *acl,
546 int type, int locked)
549 size_t size, name_len;
553 if (S_ISLNK(inode->i_mode))
557 case ACL_TYPE_ACCESS:
559 umode_t mode = inode->i_mode;
561 err = posix_acl_equiv_mode(acl, &mode);
565 if (inode->i_mode != mode) {
566 inode->i_mode = mode;
567 mark_inode_dirty(inode);
572 * ACL can be exactly represented in the
573 * traditional file mode permission bits.
578 name = XATTR_NAME_POSIX_ACL_ACCESS;
579 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
582 case ACL_TYPE_DEFAULT:
583 if (!S_ISDIR(inode->i_mode))
584 return acl ? -EACCES : 0;
585 name = XATTR_NAME_POSIX_ACL_DEFAULT;
586 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
597 size = posix_acl_xattr_size(acl->a_count);
598 value = kmalloc(size, GFP_NOFS);
602 err = posix_acl_to_xattr(mnt_userns, acl, value, size);
607 err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
609 set_cached_acl(inode, type, acl);
618 * ntfs_set_acl - inode_operations::set_acl
620 int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
621 struct posix_acl *acl, int type)
623 return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
626 static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
627 struct inode *inode, int type, void *buffer,
630 struct posix_acl *acl;
633 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
634 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
638 acl = ntfs_get_acl(inode, type);
645 err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
646 ntfs_posix_acl_release(acl);
651 static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
652 struct inode *inode, int type, const void *value,
655 struct posix_acl *acl;
658 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
659 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
663 if (!inode_owner_or_capable(mnt_userns, inode))
669 acl = posix_acl_from_xattr(mnt_userns, value, size);
674 err = posix_acl_valid(mnt_userns, acl);
676 goto release_and_out;
680 err = ntfs_set_acl(mnt_userns, inode, acl, type);
683 ntfs_posix_acl_release(acl);
688 * ntfs_init_acl - Initialize the ACLs of a new inode.
690 * Called from ntfs_create_inode().
692 int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
695 struct posix_acl *default_acl, *acl;
699 * TODO: Refactoring lock.
700 * ni_lock(dir) ... -> posix_acl_create(dir,...) -> ntfs_get_acl -> ni_lock(dir)
702 inode->i_default_acl = NULL;
704 default_acl = ntfs_get_acl_ex(mnt_userns, dir, ACL_TYPE_DEFAULT, 1);
706 if (!default_acl || default_acl == ERR_PTR(-EOPNOTSUPP)) {
707 inode->i_mode &= ~current_umask();
712 if (IS_ERR(default_acl)) {
713 err = PTR_ERR(default_acl);
718 err = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
722 posix_acl_release(acl);
726 if (!S_ISDIR(inode->i_mode)) {
727 posix_acl_release(default_acl);
732 err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
733 ACL_TYPE_DEFAULT, 1);
738 err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS,
741 posix_acl_release(acl);
743 posix_acl_release(default_acl);
751 * ntfs_acl_chmod - Helper for ntfs3_setattr().
753 int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
755 struct super_block *sb = inode->i_sb;
757 if (!(sb->s_flags & SB_POSIXACL))
760 if (S_ISLNK(inode->i_mode))
763 return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
767 * ntfs_permission - inode_operations::permission
769 int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
772 if (ntfs_sb(inode->i_sb)->options.no_acs_rules) {
773 /* "No access rules" mode - Allow all changes. */
777 return generic_permission(mnt_userns, inode, mask);
781 * ntfs_listxattr - inode_operations::listxattr
783 ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
785 struct inode *inode = d_inode(dentry);
786 struct ntfs_inode *ni = ntfs_i(inode);
789 if (!(ni->ni_flags & NI_FLAG_EA)) {
790 /* no xattr in file */
796 ret = ntfs_list_ea(ni, buffer, size);
803 static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
804 struct inode *inode, const char *name, void *buffer,
808 struct ntfs_inode *ni = ntfs_i(inode);
809 size_t name_len = strlen(name);
811 /* Dispatch request. */
812 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
813 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
814 /* system.dos_attrib */
817 } else if (size < sizeof(u8)) {
821 *(u8 *)buffer = le32_to_cpu(ni->std_fa);
826 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
827 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
828 /* system.ntfs_attrib */
831 } else if (size < sizeof(u32)) {
835 *(u32 *)buffer = le32_to_cpu(ni->std_fa);
840 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
841 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
842 /* system.ntfs_security*/
843 struct SECURITY_DESCRIPTOR_RELATIVE *sd = NULL;
846 if (!is_ntfs3(ni->mi.sbi)) {
847 /* We should get nt4 security. */
850 } else if (le32_to_cpu(ni->std_security_id) <
856 err = ntfs_get_security_by_id(ni->mi.sbi, ni->std_security_id,
861 if (!is_sd_valid(sd, sd_size)) {
864 "looks like you get incorrect security descriptor id=%u",
865 ni->std_security_id);
870 } else if (size < sd_size) {
874 memcpy(buffer, sd, sd_size);
880 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
881 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
882 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
883 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
884 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
885 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
886 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
887 /* TODO: init_user_ns? */
888 err = ntfs_xattr_get_acl(
889 &init_user_ns, inode,
890 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
897 /* Deal with NTFS extended attribute. */
898 err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
905 * ntfs_setxattr - inode_operations::setxattr
907 static noinline int ntfs_setxattr(const struct xattr_handler *handler,
908 struct user_namespace *mnt_userns,
909 struct dentry *de, struct inode *inode,
910 const char *name, const void *value,
911 size_t size, int flags)
914 struct ntfs_inode *ni = ntfs_i(inode);
915 size_t name_len = strlen(name);
916 enum FILE_ATTRIBUTE new_fa;
918 /* Dispatch request. */
919 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
920 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
921 if (sizeof(u8) != size)
923 new_fa = cpu_to_le32(*(u8 *)value);
927 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
928 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
929 if (size != sizeof(u32))
931 new_fa = cpu_to_le32(*(u32 *)value);
933 if (S_ISREG(inode->i_mode)) {
934 /* Process compressed/sparsed in special way. */
936 err = ni_new_attr_flags(ni, new_fa);
943 * Thanks Mark Harmstone:
944 * Keep directory bit consistency.
946 if (S_ISDIR(inode->i_mode))
947 new_fa |= FILE_ATTRIBUTE_DIRECTORY;
949 new_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
951 if (ni->std_fa != new_fa) {
953 if (new_fa & FILE_ATTRIBUTE_READONLY)
954 inode->i_mode &= ~0222;
956 inode->i_mode |= 0222;
957 /* Std attribute always in primary record. */
959 mark_inode_dirty(inode);
966 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
967 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
968 /* system.ntfs_security*/
971 struct ATTR_STD_INFO5 *std;
973 if (!is_ntfs3(ni->mi.sbi)) {
975 * We should replace ATTR_SECURE.
976 * Skip this way cause it is nt4 feature.
982 if (!is_sd_valid(value, size)) {
986 "you try to set invalid security descriptor");
990 err = ntfs_insert_security(ni->mi.sbi, value, size,
991 &security_id, &inserted);
999 } else if (std->security_id != security_id) {
1000 std->security_id = ni->std_security_id = security_id;
1001 /* Std attribute always in primary record. */
1002 ni->mi.dirty = true;
1003 mark_inode_dirty(&ni->vfs_inode);
1009 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
1010 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
1011 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
1012 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
1013 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
1014 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
1015 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
1016 err = ntfs_xattr_set_acl(
1018 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
1025 /* Deal with NTFS extended attribute. */
1026 err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
1033 * ntfs_save_wsl_perm
1035 * save uid/gid/mode in xattr
1037 int ntfs_save_wsl_perm(struct inode *inode)
1042 value = cpu_to_le32(i_uid_read(inode));
1043 err = ntfs_set_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value,
1044 sizeof(value), 0, 0);
1048 value = cpu_to_le32(i_gid_read(inode));
1049 err = ntfs_set_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value,
1050 sizeof(value), 0, 0);
1054 value = cpu_to_le32(inode->i_mode);
1055 err = ntfs_set_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value,
1056 sizeof(value), 0, 0);
1060 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
1061 value = cpu_to_le32(inode->i_rdev);
1062 err = ntfs_set_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &value,
1063 sizeof(value), 0, 0);
1069 /* In case of error should we delete all WSL xattr? */
1076 * get uid/gid/mode from xattr
1077 * it is called from ntfs_iget5->ntfs_read_mft
1079 void ntfs_get_wsl_perm(struct inode *inode)
1084 if (ntfs_get_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value[0],
1085 sizeof(value[0]), &sz) == sizeof(value[0]) &&
1086 ntfs_get_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value[1],
1087 sizeof(value[1]), &sz) == sizeof(value[1]) &&
1088 ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value[2],
1089 sizeof(value[2]), &sz) == sizeof(value[2])) {
1090 i_uid_write(inode, (uid_t)le32_to_cpu(value[0]));
1091 i_gid_write(inode, (gid_t)le32_to_cpu(value[1]));
1092 inode->i_mode = le32_to_cpu(value[2]);
1094 if (ntfs_get_ea(inode, "$LXDEV", sizeof("$$LXDEV") - 1,
1095 &value[0], sizeof(value),
1096 &sz) == sizeof(value[0])) {
1097 inode->i_rdev = le32_to_cpu(value[0]);
1102 static bool ntfs_xattr_user_list(struct dentry *dentry)
1108 static const struct xattr_handler ntfs_xattr_handler = {
1110 .get = ntfs_getxattr,
1111 .set = ntfs_setxattr,
1112 .list = ntfs_xattr_user_list,
1115 const struct xattr_handler *ntfs_xattr_handlers[] = {
1116 &ntfs_xattr_handler,