1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
9 #include <linux/posix_acl.h>
10 #include <linux/posix_acl_xattr.h>
11 #include <linux/xattr.h>
18 #define SYSTEM_DOS_ATTRIB "system.dos_attrib"
19 #define SYSTEM_NTFS_ATTRIB "system.ntfs_attrib"
20 #define SYSTEM_NTFS_SECURITY "system.ntfs_security"
23 static inline size_t unpacked_ea_size(const struct EA_FULL *ea)
25 return ea->size ? le32_to_cpu(ea->size)
26 : ALIGN(struct_size(ea, name,
28 le16_to_cpu(ea->elength)),
32 static inline size_t packed_ea_size(const struct EA_FULL *ea)
34 return struct_size(ea, name,
35 1 + ea->name_len + le16_to_cpu(ea->elength)) -
36 offsetof(struct EA_FULL, flags);
42 * Assume there is at least one xattr in the list.
44 static inline bool find_ea(const struct EA_FULL *ea_all, u32 bytes,
45 const char *name, u8 name_len, u32 *off)
49 if (!ea_all || !bytes)
53 const struct EA_FULL *ea = Add2Ptr(ea_all, *off);
54 u32 next_off = *off + unpacked_ea_size(ea);
59 if (ea->name_len == name_len &&
60 !memcmp(ea->name, name, name_len))
64 if (next_off >= bytes)
70 * ntfs_read_ea - Read all extended attributes.
71 * @ea: New allocated memory.
72 * @info: Pointer into resident data.
74 static int ntfs_read_ea(struct ntfs_inode *ni, struct EA_FULL **ea,
75 size_t add_bytes, const struct EA_INFO **info)
78 struct ATTR_LIST_ENTRY *le = NULL;
79 struct ATTRIB *attr_info, *attr_ea;
83 static_assert(le32_to_cpu(ATTR_EA_INFO) < le32_to_cpu(ATTR_EA));
89 ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, NULL);
91 ni_find_attr(ni, attr_info, &le, ATTR_EA, NULL, 0, NULL, NULL);
93 if (!attr_ea || !attr_info)
96 *info = resident_data_ex(attr_info, sizeof(struct EA_INFO));
100 /* Check Ea limit. */
101 size = le32_to_cpu((*info)->size);
102 if (size > ni->mi.sbi->ea_max_size)
105 if (attr_size(attr_ea) > ni->mi.sbi->ea_max_size)
108 /* Allocate memory for packed Ea. */
109 ea_p = kmalloc(size + add_bytes, GFP_NOFS);
113 if (attr_ea->non_res) {
114 struct runs_tree run;
118 err = attr_load_runs(attr_ea, ni, &run, NULL);
120 err = ntfs_read_run_nb(ni->mi.sbi, &run, 0, ea_p, size,
127 void *p = resident_data_ex(attr_ea, size);
133 memcpy(ea_p, p, size);
136 memset(Add2Ptr(ea_p, size), 0, add_bytes);
149 * Copy a list of xattrs names into the buffer
150 * provided, or compute the buffer size required.
153 * * Number of bytes used / required on
154 * * -ERRNO - on failure
156 static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
157 size_t bytes_per_buffer)
159 const struct EA_INFO *info;
160 struct EA_FULL *ea_all = NULL;
161 const struct EA_FULL *ea;
166 err = ntfs_read_ea(ni, &ea_all, 0, &info);
170 if (!info || !ea_all)
173 size = le32_to_cpu(info->size);
175 /* Enumerate all xattrs. */
176 for (ret = 0, off = 0; off < size; off += unpacked_ea_size(ea)) {
177 ea = Add2Ptr(ea_all, off);
180 if (ret + ea->name_len + 1 > bytes_per_buffer) {
185 memcpy(buffer + ret, ea->name, ea->name_len);
186 buffer[ret + ea->name_len] = 0;
189 ret += ea->name_len + 1;
194 return err ? err : ret;
197 static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len,
198 void *buffer, size_t size, size_t *required)
200 struct ntfs_inode *ni = ntfs_i(inode);
201 const struct EA_INFO *info;
202 struct EA_FULL *ea_all = NULL;
203 const struct EA_FULL *ea;
207 if (!(ni->ni_flags & NI_FLAG_EA))
215 if (name_len > 255) {
220 err = ntfs_read_ea(ni, &ea_all, 0, &info);
227 /* Enumerate all xattrs. */
228 if (!find_ea(ea_all, le32_to_cpu(info->size), name, name_len, &off)) {
232 ea = Add2Ptr(ea_all, off);
234 len = le16_to_cpu(ea->elength);
247 memcpy(buffer, ea->name + ea->name_len + 1, len);
255 return err ? err : len;
258 static noinline int ntfs_set_ea(struct inode *inode, const char *name,
259 size_t name_len, const void *value,
260 size_t val_size, int flags, int locked)
262 struct ntfs_inode *ni = ntfs_i(inode);
263 struct ntfs_sb_info *sbi = ni->mi.sbi;
265 struct EA_INFO ea_info;
266 const struct EA_INFO *info;
267 struct EA_FULL *new_ea;
268 struct EA_FULL *ea_all = NULL;
269 size_t add, new_pack;
273 struct ATTR_LIST_ENTRY *le;
274 struct mft_inode *mi;
275 struct runs_tree ea_run;
284 if (name_len > 255) {
289 add = ALIGN(struct_size(ea_all, name, 1 + name_len + val_size), 4);
291 err = ntfs_read_ea(ni, &ea_all, add, &info);
296 memset(&ea_info, 0, sizeof(ea_info));
300 memcpy(&ea_info, info, sizeof(ea_info));
301 size = le32_to_cpu(ea_info.size);
302 size_pack = ea_info.size_pack;
305 if (info && find_ea(ea_all, size, name, name_len, &off)) {
309 if (flags & XATTR_CREATE) {
314 ea = Add2Ptr(ea_all, off);
317 * Check simple case when we try to insert xattr with the same value
318 * e.g. ntfs_save_wsl_perm
320 if (val_size && le16_to_cpu(ea->elength) == val_size &&
321 !memcmp(ea->name + ea->name_len + 1, value, val_size)) {
322 /* xattr already contains the required value. */
326 /* Remove current xattr. */
327 if (ea->flags & FILE_NEED_EA)
328 le16_add_cpu(&ea_info.count, -1);
330 ea_sz = unpacked_ea_size(ea);
332 le16_add_cpu(&ea_info.size_pack, 0 - packed_ea_size(ea));
334 memmove(ea, Add2Ptr(ea, ea_sz), size - off - ea_sz);
337 memset(Add2Ptr(ea_all, size), 0, ea_sz);
339 ea_info.size = cpu_to_le32(size);
341 if ((flags & XATTR_REPLACE) && !val_size) {
346 if (flags & XATTR_REPLACE) {
352 ea_all = kzalloc(add, GFP_NOFS);
360 /* Append new xattr. */
361 new_ea = Add2Ptr(ea_all, size);
362 new_ea->size = cpu_to_le32(add);
364 new_ea->name_len = name_len;
365 new_ea->elength = cpu_to_le16(val_size);
366 memcpy(new_ea->name, name, name_len);
367 new_ea->name[name_len] = 0;
368 memcpy(new_ea->name + name_len + 1, value, val_size);
369 new_pack = le16_to_cpu(ea_info.size_pack) + packed_ea_size(new_ea);
371 /* Should fit into 16 bits. */
372 if (new_pack > 0xffff) {
373 err = -EFBIG; // -EINVAL?
376 ea_info.size_pack = cpu_to_le16(new_pack);
378 /* New size of ATTR_EA. */
380 if (size > sbi->ea_max_size) {
381 err = -EFBIG; // -EINVAL?
384 ea_info.size = cpu_to_le32(size);
395 err = ni_insert_resident(ni, sizeof(struct EA_INFO),
396 ATTR_EA_INFO, NULL, 0, NULL, NULL,
401 err = ni_insert_resident(ni, 0, ATTR_EA, NULL, 0, NULL, NULL,
408 err = attr_set_size(ni, ATTR_EA, NULL, 0, &ea_run, new_sz, &new_sz,
414 attr = ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, &mi);
421 /* Delete xattr, ATTR_EA_INFO */
422 ni_remove_attr_le(ni, attr, mi, le);
424 p = resident_data_ex(attr, sizeof(struct EA_INFO));
429 memcpy(p, &ea_info, sizeof(struct EA_INFO));
434 attr = ni_find_attr(ni, NULL, &le, ATTR_EA, NULL, 0, NULL, &mi);
441 /* Delete xattr, ATTR_EA */
442 ni_remove_attr_le(ni, attr, mi, le);
443 } else if (attr->non_res) {
444 err = ntfs_sb_write_run(sbi, &ea_run, 0, ea_all, size);
448 p = resident_data_ex(attr, size);
453 memcpy(p, ea_all, size);
457 /* Check if we delete the last xattr. */
459 ni->ni_flags |= NI_FLAG_EA;
461 ni->ni_flags &= ~NI_FLAG_EA;
463 if (ea_info.size_pack != size_pack)
464 ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
465 mark_inode_dirty(&ni->vfs_inode);
477 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
478 static inline void ntfs_posix_acl_release(struct posix_acl *acl)
480 if (acl && refcount_dec_and_test(&acl->a_refcount))
484 static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
485 struct inode *inode, int type,
488 struct ntfs_inode *ni = ntfs_i(inode);
491 struct posix_acl *acl;
496 /* Allocate PATH_MAX bytes. */
499 return ERR_PTR(-ENOMEM);
501 /* Possible values of 'type' was already checked above. */
502 if (type == ACL_TYPE_ACCESS) {
503 name = XATTR_NAME_POSIX_ACL_ACCESS;
504 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
506 name = XATTR_NAME_POSIX_ACL_DEFAULT;
507 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
513 err = ntfs_get_ea(inode, name, name_len, buf, PATH_MAX, &req);
518 /* Translate extended attribute to acl. */
520 acl = posix_acl_from_xattr(mnt_userns, buf, err);
522 set_cached_acl(inode, type, acl);
524 acl = err == -ENODATA ? NULL : ERR_PTR(err);
533 * ntfs_get_acl - inode_operations::get_acl
535 struct posix_acl *ntfs_get_acl(struct inode *inode, int type)
537 /* TODO: init_user_ns? */
538 return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
541 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
542 struct inode *inode, struct posix_acl *acl,
543 int type, int locked)
546 size_t size, name_len;
550 if (S_ISLNK(inode->i_mode))
554 case ACL_TYPE_ACCESS:
556 umode_t mode = inode->i_mode;
558 err = posix_acl_equiv_mode(acl, &mode);
562 if (inode->i_mode != mode) {
563 inode->i_mode = mode;
564 mark_inode_dirty(inode);
569 * ACL can be exactly represented in the
570 * traditional file mode permission bits.
575 name = XATTR_NAME_POSIX_ACL_ACCESS;
576 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
579 case ACL_TYPE_DEFAULT:
580 if (!S_ISDIR(inode->i_mode))
581 return acl ? -EACCES : 0;
582 name = XATTR_NAME_POSIX_ACL_DEFAULT;
583 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
594 size = posix_acl_xattr_size(acl->a_count);
595 value = kmalloc(size, GFP_NOFS);
599 err = posix_acl_to_xattr(mnt_userns, acl, value, size);
604 err = ntfs_set_ea(inode, name, name_len, value, size, 0, locked);
606 set_cached_acl(inode, type, acl);
615 * ntfs_set_acl - inode_operations::set_acl
617 int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
618 struct posix_acl *acl, int type)
620 return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
623 static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
624 struct inode *inode, int type, void *buffer,
627 struct posix_acl *acl;
630 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
631 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
635 acl = ntfs_get_acl(inode, type);
642 err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
643 ntfs_posix_acl_release(acl);
648 static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
649 struct inode *inode, int type, const void *value,
652 struct posix_acl *acl;
655 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
656 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
660 if (!inode_owner_or_capable(mnt_userns, inode))
666 acl = posix_acl_from_xattr(mnt_userns, value, size);
671 err = posix_acl_valid(mnt_userns, acl);
673 goto release_and_out;
677 err = ntfs_set_acl(mnt_userns, inode, acl, type);
680 ntfs_posix_acl_release(acl);
685 * ntfs_init_acl - Initialize the ACLs of a new inode.
687 * Called from ntfs_create_inode().
689 int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
692 struct posix_acl *default_acl, *acl;
696 * TODO: Refactoring lock.
697 * ni_lock(dir) ... -> posix_acl_create(dir,...) -> ntfs_get_acl -> ni_lock(dir)
699 inode->i_default_acl = NULL;
701 default_acl = ntfs_get_acl_ex(mnt_userns, dir, ACL_TYPE_DEFAULT, 1);
703 if (!default_acl || default_acl == ERR_PTR(-EOPNOTSUPP)) {
704 inode->i_mode &= ~current_umask();
709 if (IS_ERR(default_acl)) {
710 err = PTR_ERR(default_acl);
715 err = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode);
719 posix_acl_release(acl);
723 if (!S_ISDIR(inode->i_mode)) {
724 posix_acl_release(default_acl);
729 err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
730 ACL_TYPE_DEFAULT, 1);
735 err = ntfs_set_acl_ex(mnt_userns, inode, acl, ACL_TYPE_ACCESS,
738 posix_acl_release(acl);
740 posix_acl_release(default_acl);
748 * ntfs_acl_chmod - Helper for ntfs3_setattr().
750 int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
752 struct super_block *sb = inode->i_sb;
754 if (!(sb->s_flags & SB_POSIXACL))
757 if (S_ISLNK(inode->i_mode))
760 return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
764 * ntfs_permission - inode_operations::permission
766 int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
769 if (ntfs_sb(inode->i_sb)->options->noacsrules) {
770 /* "No access rules" mode - Allow all changes. */
774 return generic_permission(mnt_userns, inode, mask);
778 * ntfs_listxattr - inode_operations::listxattr
780 ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
782 struct inode *inode = d_inode(dentry);
783 struct ntfs_inode *ni = ntfs_i(inode);
786 if (!(ni->ni_flags & NI_FLAG_EA)) {
787 /* no xattr in file */
793 ret = ntfs_list_ea(ni, buffer, size);
800 static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
801 struct inode *inode, const char *name, void *buffer,
805 struct ntfs_inode *ni = ntfs_i(inode);
806 size_t name_len = strlen(name);
808 /* Dispatch request. */
809 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
810 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
811 /* system.dos_attrib */
814 } else if (size < sizeof(u8)) {
818 *(u8 *)buffer = le32_to_cpu(ni->std_fa);
823 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
824 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
825 /* system.ntfs_attrib */
828 } else if (size < sizeof(u32)) {
832 *(u32 *)buffer = le32_to_cpu(ni->std_fa);
837 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
838 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
839 /* system.ntfs_security*/
840 struct SECURITY_DESCRIPTOR_RELATIVE *sd = NULL;
843 if (!is_ntfs3(ni->mi.sbi)) {
844 /* We should get nt4 security. */
847 } else if (le32_to_cpu(ni->std_security_id) <
853 err = ntfs_get_security_by_id(ni->mi.sbi, ni->std_security_id,
858 if (!is_sd_valid(sd, sd_size)) {
861 "looks like you get incorrect security descriptor id=%u",
862 ni->std_security_id);
867 } else if (size < sd_size) {
871 memcpy(buffer, sd, sd_size);
877 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
878 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
879 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
880 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
881 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
882 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
883 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
884 /* TODO: init_user_ns? */
885 err = ntfs_xattr_get_acl(
886 &init_user_ns, inode,
887 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
894 /* Deal with NTFS extended attribute. */
895 err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
902 * ntfs_setxattr - inode_operations::setxattr
904 static noinline int ntfs_setxattr(const struct xattr_handler *handler,
905 struct user_namespace *mnt_userns,
906 struct dentry *de, struct inode *inode,
907 const char *name, const void *value,
908 size_t size, int flags)
911 struct ntfs_inode *ni = ntfs_i(inode);
912 size_t name_len = strlen(name);
913 enum FILE_ATTRIBUTE new_fa;
915 /* Dispatch request. */
916 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
917 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
918 if (sizeof(u8) != size)
920 new_fa = cpu_to_le32(*(u8 *)value);
924 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
925 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
926 if (size != sizeof(u32))
928 new_fa = cpu_to_le32(*(u32 *)value);
930 if (S_ISREG(inode->i_mode)) {
931 /* Process compressed/sparsed in special way. */
933 err = ni_new_attr_flags(ni, new_fa);
940 * Thanks Mark Harmstone:
941 * Keep directory bit consistency.
943 if (S_ISDIR(inode->i_mode))
944 new_fa |= FILE_ATTRIBUTE_DIRECTORY;
946 new_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
948 if (ni->std_fa != new_fa) {
950 if (new_fa & FILE_ATTRIBUTE_READONLY)
951 inode->i_mode &= ~0222;
953 inode->i_mode |= 0222;
954 /* Std attribute always in primary record. */
956 mark_inode_dirty(inode);
963 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
964 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
965 /* system.ntfs_security*/
968 struct ATTR_STD_INFO5 *std;
970 if (!is_ntfs3(ni->mi.sbi)) {
972 * We should replace ATTR_SECURE.
973 * Skip this way cause it is nt4 feature.
979 if (!is_sd_valid(value, size)) {
983 "you try to set invalid security descriptor");
987 err = ntfs_insert_security(ni->mi.sbi, value, size,
988 &security_id, &inserted);
996 } else if (std->security_id != security_id) {
997 std->security_id = ni->std_security_id = security_id;
998 /* Std attribute always in primary record. */
1000 mark_inode_dirty(&ni->vfs_inode);
1006 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
1007 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
1008 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
1009 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
1010 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
1011 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
1012 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
1013 err = ntfs_xattr_set_acl(
1015 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
1022 /* Deal with NTFS extended attribute. */
1023 err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
1030 * ntfs_save_wsl_perm
1032 * save uid/gid/mode in xattr
1034 int ntfs_save_wsl_perm(struct inode *inode)
1039 value = cpu_to_le32(i_uid_read(inode));
1040 err = ntfs_set_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value,
1041 sizeof(value), 0, 0);
1045 value = cpu_to_le32(i_gid_read(inode));
1046 err = ntfs_set_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value,
1047 sizeof(value), 0, 0);
1051 value = cpu_to_le32(inode->i_mode);
1052 err = ntfs_set_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value,
1053 sizeof(value), 0, 0);
1057 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
1058 value = cpu_to_le32(inode->i_rdev);
1059 err = ntfs_set_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &value,
1060 sizeof(value), 0, 0);
1066 /* In case of error should we delete all WSL xattr? */
1073 * get uid/gid/mode from xattr
1074 * it is called from ntfs_iget5->ntfs_read_mft
1076 void ntfs_get_wsl_perm(struct inode *inode)
1081 if (ntfs_get_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value[0],
1082 sizeof(value[0]), &sz) == sizeof(value[0]) &&
1083 ntfs_get_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value[1],
1084 sizeof(value[1]), &sz) == sizeof(value[1]) &&
1085 ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value[2],
1086 sizeof(value[2]), &sz) == sizeof(value[2])) {
1087 i_uid_write(inode, (uid_t)le32_to_cpu(value[0]));
1088 i_gid_write(inode, (gid_t)le32_to_cpu(value[1]));
1089 inode->i_mode = le32_to_cpu(value[2]);
1091 if (ntfs_get_ea(inode, "$LXDEV", sizeof("$$LXDEV") - 1,
1092 &value[0], sizeof(value),
1093 &sz) == sizeof(value[0])) {
1094 inode->i_rdev = le32_to_cpu(value[0]);
1099 static bool ntfs_xattr_user_list(struct dentry *dentry)
1105 static const struct xattr_handler ntfs_xattr_handler = {
1107 .get = ntfs_getxattr,
1108 .set = ntfs_setxattr,
1109 .list = ntfs_xattr_user_list,
1112 const struct xattr_handler *ntfs_xattr_handlers[] = {
1113 &ntfs_xattr_handler,