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, bool rcu)
541 return ERR_PTR(-ECHILD);
543 /* TODO: init_user_ns? */
544 return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
547 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
548 struct inode *inode, struct posix_acl *acl,
549 int type, int locked)
552 size_t size, name_len;
556 if (S_ISLNK(inode->i_mode))
560 case ACL_TYPE_ACCESS:
562 umode_t mode = inode->i_mode;
564 err = posix_acl_equiv_mode(acl, &mode);
568 if (inode->i_mode != mode) {
569 inode->i_mode = mode;
570 mark_inode_dirty(inode);
575 * ACL can be exactly represented in the
576 * traditional file mode permission bits.
581 name = XATTR_NAME_POSIX_ACL_ACCESS;
582 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
585 case ACL_TYPE_DEFAULT:
586 if (!S_ISDIR(inode->i_mode))
587 return acl ? -EACCES : 0;
588 name = XATTR_NAME_POSIX_ACL_DEFAULT;
589 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
600 size = posix_acl_xattr_size(acl->a_count);
601 value = kmalloc(size, GFP_NOFS);
605 err = posix_acl_to_xattr(mnt_userns, acl, value, size);
610 err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
612 set_cached_acl(inode, type, acl);
621 * ntfs_set_acl - inode_operations::set_acl
623 int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
624 struct posix_acl *acl, int type)
626 return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
629 static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
630 struct inode *inode, int type, void *buffer,
633 struct posix_acl *acl;
636 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
637 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
641 acl = ntfs_get_acl(inode, type, false);
648 err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
649 ntfs_posix_acl_release(acl);
654 static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
655 struct inode *inode, int type, const void *value,
658 struct posix_acl *acl;
661 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
662 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
666 if (!inode_owner_or_capable(mnt_userns, inode))
672 acl = posix_acl_from_xattr(mnt_userns, value, size);
677 err = posix_acl_valid(mnt_userns, acl);
679 goto release_and_out;
683 err = ntfs_set_acl(mnt_userns, inode, acl, type);
686 ntfs_posix_acl_release(acl);
691 * ntfs_init_acl - Initialize the ACLs of a new inode.
693 * Called from ntfs_create_inode().
695 int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
698 struct posix_acl *default_acl, *acl;
702 * TODO: Refactoring lock.
703 * ni_lock(dir) ... -> posix_acl_create(dir,...) -> ntfs_get_acl -> ni_lock(dir)
705 inode->i_default_acl = NULL;
707 default_acl = ntfs_get_acl_ex(mnt_userns, dir, ACL_TYPE_DEFAULT, 1);
709 if (!default_acl || default_acl == ERR_PTR(-EOPNOTSUPP)) {
710 inode->i_mode &= ~current_umask();
715 if (IS_ERR(default_acl)) {
716 err = PTR_ERR(default_acl);
721 err = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
725 posix_acl_release(acl);
729 if (!S_ISDIR(inode->i_mode)) {
730 posix_acl_release(default_acl);
735 err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
736 ACL_TYPE_DEFAULT, 1);
741 err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS,
744 posix_acl_release(acl);
746 posix_acl_release(default_acl);
754 * ntfs_acl_chmod - Helper for ntfs3_setattr().
756 int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
758 struct super_block *sb = inode->i_sb;
760 if (!(sb->s_flags & SB_POSIXACL))
763 if (S_ISLNK(inode->i_mode))
766 return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
770 * ntfs_permission - inode_operations::permission
772 int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
775 if (ntfs_sb(inode->i_sb)->options.no_acs_rules) {
776 /* "No access rules" mode - Allow all changes. */
780 return generic_permission(mnt_userns, inode, mask);
784 * ntfs_listxattr - inode_operations::listxattr
786 ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
788 struct inode *inode = d_inode(dentry);
789 struct ntfs_inode *ni = ntfs_i(inode);
792 if (!(ni->ni_flags & NI_FLAG_EA)) {
793 /* no xattr in file */
799 ret = ntfs_list_ea(ni, buffer, size);
806 static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
807 struct inode *inode, const char *name, void *buffer,
811 struct ntfs_inode *ni = ntfs_i(inode);
812 size_t name_len = strlen(name);
814 /* Dispatch request. */
815 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
816 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
817 /* system.dos_attrib */
820 } else if (size < sizeof(u8)) {
824 *(u8 *)buffer = le32_to_cpu(ni->std_fa);
829 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
830 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
831 /* system.ntfs_attrib */
834 } else if (size < sizeof(u32)) {
838 *(u32 *)buffer = le32_to_cpu(ni->std_fa);
843 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
844 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
845 /* system.ntfs_security*/
846 struct SECURITY_DESCRIPTOR_RELATIVE *sd = NULL;
849 if (!is_ntfs3(ni->mi.sbi)) {
850 /* We should get nt4 security. */
853 } else if (le32_to_cpu(ni->std_security_id) <
859 err = ntfs_get_security_by_id(ni->mi.sbi, ni->std_security_id,
864 if (!is_sd_valid(sd, sd_size)) {
867 "looks like you get incorrect security descriptor id=%u",
868 ni->std_security_id);
873 } else if (size < sd_size) {
877 memcpy(buffer, sd, sd_size);
883 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
884 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
885 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
886 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
887 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
888 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
889 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
890 /* TODO: init_user_ns? */
891 err = ntfs_xattr_get_acl(
892 &init_user_ns, inode,
893 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
900 /* Deal with NTFS extended attribute. */
901 err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
908 * ntfs_setxattr - inode_operations::setxattr
910 static noinline int ntfs_setxattr(const struct xattr_handler *handler,
911 struct user_namespace *mnt_userns,
912 struct dentry *de, struct inode *inode,
913 const char *name, const void *value,
914 size_t size, int flags)
917 struct ntfs_inode *ni = ntfs_i(inode);
918 size_t name_len = strlen(name);
919 enum FILE_ATTRIBUTE new_fa;
921 /* Dispatch request. */
922 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
923 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
924 if (sizeof(u8) != size)
926 new_fa = cpu_to_le32(*(u8 *)value);
930 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
931 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
932 if (size != sizeof(u32))
934 new_fa = cpu_to_le32(*(u32 *)value);
936 if (S_ISREG(inode->i_mode)) {
937 /* Process compressed/sparsed in special way. */
939 err = ni_new_attr_flags(ni, new_fa);
946 * Thanks Mark Harmstone:
947 * Keep directory bit consistency.
949 if (S_ISDIR(inode->i_mode))
950 new_fa |= FILE_ATTRIBUTE_DIRECTORY;
952 new_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
954 if (ni->std_fa != new_fa) {
956 if (new_fa & FILE_ATTRIBUTE_READONLY)
957 inode->i_mode &= ~0222;
959 inode->i_mode |= 0222;
960 /* Std attribute always in primary record. */
962 mark_inode_dirty(inode);
969 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
970 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
971 /* system.ntfs_security*/
974 struct ATTR_STD_INFO5 *std;
976 if (!is_ntfs3(ni->mi.sbi)) {
978 * We should replace ATTR_SECURE.
979 * Skip this way cause it is nt4 feature.
985 if (!is_sd_valid(value, size)) {
989 "you try to set invalid security descriptor");
993 err = ntfs_insert_security(ni->mi.sbi, value, size,
994 &security_id, &inserted);
1002 } else if (std->security_id != security_id) {
1003 std->security_id = ni->std_security_id = security_id;
1004 /* Std attribute always in primary record. */
1005 ni->mi.dirty = true;
1006 mark_inode_dirty(&ni->vfs_inode);
1012 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
1013 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
1014 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
1015 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
1016 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
1017 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
1018 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
1019 err = ntfs_xattr_set_acl(
1021 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
1028 /* Deal with NTFS extended attribute. */
1029 err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
1036 * ntfs_save_wsl_perm
1038 * save uid/gid/mode in xattr
1040 int ntfs_save_wsl_perm(struct inode *inode)
1045 value = cpu_to_le32(i_uid_read(inode));
1046 err = ntfs_set_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value,
1047 sizeof(value), 0, 0);
1051 value = cpu_to_le32(i_gid_read(inode));
1052 err = ntfs_set_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value,
1053 sizeof(value), 0, 0);
1057 value = cpu_to_le32(inode->i_mode);
1058 err = ntfs_set_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value,
1059 sizeof(value), 0, 0);
1063 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
1064 value = cpu_to_le32(inode->i_rdev);
1065 err = ntfs_set_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &value,
1066 sizeof(value), 0, 0);
1072 /* In case of error should we delete all WSL xattr? */
1079 * get uid/gid/mode from xattr
1080 * it is called from ntfs_iget5->ntfs_read_mft
1082 void ntfs_get_wsl_perm(struct inode *inode)
1087 if (ntfs_get_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value[0],
1088 sizeof(value[0]), &sz) == sizeof(value[0]) &&
1089 ntfs_get_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value[1],
1090 sizeof(value[1]), &sz) == sizeof(value[1]) &&
1091 ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value[2],
1092 sizeof(value[2]), &sz) == sizeof(value[2])) {
1093 i_uid_write(inode, (uid_t)le32_to_cpu(value[0]));
1094 i_gid_write(inode, (gid_t)le32_to_cpu(value[1]));
1095 inode->i_mode = le32_to_cpu(value[2]);
1097 if (ntfs_get_ea(inode, "$LXDEV", sizeof("$$LXDEV") - 1,
1098 &value[0], sizeof(value),
1099 &sz) == sizeof(value[0])) {
1100 inode->i_rdev = le32_to_cpu(value[0]);
1105 static bool ntfs_xattr_user_list(struct dentry *dentry)
1111 static const struct xattr_handler ntfs_xattr_handler = {
1113 .get = ntfs_getxattr,
1114 .set = ntfs_setxattr,
1115 .list = ntfs_xattr_user_list,
1118 const struct xattr_handler *ntfs_xattr_handlers[] = {
1119 &ntfs_xattr_handler,