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 ntfs_sb_info *sbi = ni->mi.sbi;
79 struct ATTR_LIST_ENTRY *le = NULL;
80 struct ATTRIB *attr_info, *attr_ea;
84 static_assert(le32_to_cpu(ATTR_EA_INFO) < le32_to_cpu(ATTR_EA));
90 ni_find_attr(ni, NULL, &le, ATTR_EA_INFO, NULL, 0, NULL, NULL);
92 ni_find_attr(ni, attr_info, &le, ATTR_EA, NULL, 0, NULL, NULL);
94 if (!attr_ea || !attr_info)
97 *info = resident_data_ex(attr_info, sizeof(struct EA_INFO));
101 /* Check Ea limit. */
102 size = le32_to_cpu((*info)->size);
103 if (size > sbi->ea_max_size)
106 if (attr_size(attr_ea) > sbi->ea_max_size)
109 /* Allocate memory for packed Ea. */
110 ea_p = kmalloc(size + add_bytes, GFP_NOFS);
115 /* EA info persists, but xattr is empty. Looks like EA problem. */
116 } else if (attr_ea->non_res) {
117 struct runs_tree run;
121 err = attr_load_runs_range(ni, ATTR_EA, NULL, 0, &run, 0, size);
123 err = ntfs_read_run_nb(sbi, &run, 0, ea_p, size, NULL);
129 void *p = resident_data_ex(attr_ea, size);
135 memcpy(ea_p, p, size);
138 memset(Add2Ptr(ea_p, size), 0, add_bytes);
151 * Copy a list of xattrs names into the buffer
152 * provided, or compute the buffer size required.
155 * * Number of bytes used / required on
156 * * -ERRNO - on failure
158 static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer,
159 size_t bytes_per_buffer)
161 const struct EA_INFO *info;
162 struct EA_FULL *ea_all = NULL;
163 const struct EA_FULL *ea;
168 err = ntfs_read_ea(ni, &ea_all, 0, &info);
172 if (!info || !ea_all)
175 size = le32_to_cpu(info->size);
177 /* Enumerate all xattrs. */
178 for (ret = 0, off = 0; off < size; off += unpacked_ea_size(ea)) {
179 ea = Add2Ptr(ea_all, off);
182 if (ret + ea->name_len + 1 > bytes_per_buffer) {
187 memcpy(buffer + ret, ea->name, ea->name_len);
188 buffer[ret + ea->name_len] = 0;
191 ret += ea->name_len + 1;
196 return err ? err : ret;
199 static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len,
200 void *buffer, size_t size, size_t *required)
202 struct ntfs_inode *ni = ntfs_i(inode);
203 const struct EA_INFO *info;
204 struct EA_FULL *ea_all = NULL;
205 const struct EA_FULL *ea;
209 if (!(ni->ni_flags & NI_FLAG_EA))
217 if (name_len > 255) {
222 err = ntfs_read_ea(ni, &ea_all, 0, &info);
229 /* Enumerate all xattrs. */
230 if (!find_ea(ea_all, le32_to_cpu(info->size), name, name_len, &off)) {
234 ea = Add2Ptr(ea_all, off);
236 len = le16_to_cpu(ea->elength);
249 memcpy(buffer, ea->name + ea->name_len + 1, len);
257 return err ? err : len;
260 static noinline int ntfs_set_ea(struct inode *inode, const char *name,
261 size_t name_len, const void *value,
262 size_t val_size, int flags, bool locked)
264 struct ntfs_inode *ni = ntfs_i(inode);
265 struct ntfs_sb_info *sbi = ni->mi.sbi;
267 struct EA_INFO ea_info;
268 const struct EA_INFO *info;
269 struct EA_FULL *new_ea;
270 struct EA_FULL *ea_all = NULL;
271 size_t add, new_pack;
275 struct ATTR_LIST_ENTRY *le;
276 struct mft_inode *mi;
277 struct runs_tree ea_run;
286 if (name_len > 255) {
291 add = ALIGN(struct_size(ea_all, name, 1 + name_len + val_size), 4);
293 err = ntfs_read_ea(ni, &ea_all, add, &info);
298 memset(&ea_info, 0, sizeof(ea_info));
302 memcpy(&ea_info, info, sizeof(ea_info));
303 size = le32_to_cpu(ea_info.size);
304 size_pack = ea_info.size_pack;
307 if (info && find_ea(ea_all, size, name, name_len, &off)) {
311 if (flags & XATTR_CREATE) {
316 ea = Add2Ptr(ea_all, off);
319 * Check simple case when we try to insert xattr with the same value
320 * e.g. ntfs_save_wsl_perm
322 if (val_size && le16_to_cpu(ea->elength) == val_size &&
323 !memcmp(ea->name + ea->name_len + 1, value, val_size)) {
324 /* xattr already contains the required value. */
328 /* Remove current xattr. */
329 if (ea->flags & FILE_NEED_EA)
330 le16_add_cpu(&ea_info.count, -1);
332 ea_sz = unpacked_ea_size(ea);
334 le16_add_cpu(&ea_info.size_pack, 0 - packed_ea_size(ea));
336 memmove(ea, Add2Ptr(ea, ea_sz), size - off - ea_sz);
339 memset(Add2Ptr(ea_all, size), 0, ea_sz);
341 ea_info.size = cpu_to_le32(size);
343 if ((flags & XATTR_REPLACE) && !val_size) {
348 if (flags & XATTR_REPLACE) {
354 ea_all = kzalloc(add, GFP_NOFS);
362 /* Append new xattr. */
363 new_ea = Add2Ptr(ea_all, size);
364 new_ea->size = cpu_to_le32(add);
366 new_ea->name_len = name_len;
367 new_ea->elength = cpu_to_le16(val_size);
368 memcpy(new_ea->name, name, name_len);
369 new_ea->name[name_len] = 0;
370 memcpy(new_ea->name + name_len + 1, value, val_size);
371 new_pack = le16_to_cpu(ea_info.size_pack) + packed_ea_size(new_ea);
372 ea_info.size_pack = cpu_to_le16(new_pack);
373 /* New size of ATTR_EA. */
375 ea_info.size = cpu_to_le32(size);
378 * 1. Check ea_info.size_pack for overflow.
379 * 2. New attibute size must fit value from $AttrDef
381 if (new_pack > 0xffff || size > sbi->ea_max_size) {
384 "The size of extended attributes must not exceed 64KiB");
385 err = -EFBIG; // -EINVAL?
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 = attr_load_runs_range(ni, ATTR_EA, NULL, 0, &ea_run, 0,
452 err = ntfs_sb_write_run(sbi, &ea_run, 0, ea_all, size, 0);
456 p = resident_data_ex(attr, size);
461 memcpy(p, ea_all, size);
465 /* Check if we delete the last xattr. */
467 ni->ni_flags |= NI_FLAG_EA;
469 ni->ni_flags &= ~NI_FLAG_EA;
471 if (ea_info.size_pack != size_pack)
472 ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
473 mark_inode_dirty(&ni->vfs_inode);
485 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
486 static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
487 struct inode *inode, int type,
490 struct ntfs_inode *ni = ntfs_i(inode);
493 struct posix_acl *acl;
498 /* Allocate PATH_MAX bytes. */
501 return ERR_PTR(-ENOMEM);
503 /* Possible values of 'type' was already checked above. */
504 if (type == ACL_TYPE_ACCESS) {
505 name = XATTR_NAME_POSIX_ACL_ACCESS;
506 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
508 name = XATTR_NAME_POSIX_ACL_DEFAULT;
509 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
515 err = ntfs_get_ea(inode, name, name_len, buf, PATH_MAX, &req);
520 /* Translate extended attribute to acl. */
522 acl = posix_acl_from_xattr(mnt_userns, buf, err);
523 } else if (err == -ENODATA) {
530 set_cached_acl(inode, type, acl);
538 * ntfs_get_acl - inode_operations::get_acl
540 struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu)
543 return ERR_PTR(-ECHILD);
545 /* TODO: init_user_ns? */
546 return ntfs_get_acl_ex(&init_user_ns, inode, type, 0);
549 static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
550 struct inode *inode, struct posix_acl *acl,
551 int type, bool init_acl)
554 size_t size, name_len;
560 if (S_ISLNK(inode->i_mode))
563 mode = inode->i_mode;
565 case ACL_TYPE_ACCESS:
566 /* Do not change i_mode if we are in init_acl */
567 if (acl && !init_acl) {
568 err = posix_acl_update_mode(mnt_userns, inode, &mode,
573 name = XATTR_NAME_POSIX_ACL_ACCESS;
574 name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
577 case ACL_TYPE_DEFAULT:
578 if (!S_ISDIR(inode->i_mode))
579 return acl ? -EACCES : 0;
580 name = XATTR_NAME_POSIX_ACL_DEFAULT;
581 name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
589 /* Remove xattr if it can be presented via mode. */
592 flags = XATTR_REPLACE;
594 size = posix_acl_xattr_size(acl->a_count);
595 value = kmalloc(size, GFP_NOFS);
598 err = posix_acl_to_xattr(mnt_userns, acl, value, size);
604 err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
605 if (err == -ENODATA && !size)
606 err = 0; /* Removing non existed xattr. */
608 set_cached_acl(inode, type, acl);
609 if (inode->i_mode != mode) {
610 inode->i_mode = mode;
611 mark_inode_dirty(inode);
622 * ntfs_set_acl - inode_operations::set_acl
624 int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
625 struct posix_acl *acl, int type)
627 return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false);
630 static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
631 struct inode *inode, int type, void *buffer,
634 struct posix_acl *acl;
637 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
638 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
642 acl = ntfs_get_acl(inode, type, false);
649 err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
650 posix_acl_release(acl);
655 static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
656 struct inode *inode, int type, const void *value,
659 struct posix_acl *acl;
662 if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
663 ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
667 if (!inode_owner_or_capable(mnt_userns, inode))
673 acl = posix_acl_from_xattr(mnt_userns, value, size);
678 err = posix_acl_valid(mnt_userns, acl);
680 goto release_and_out;
684 err = ntfs_set_acl(mnt_userns, inode, acl, type);
687 posix_acl_release(acl);
692 * ntfs_init_acl - Initialize the ACLs of a new inode.
694 * Called from ntfs_create_inode().
696 int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
699 struct posix_acl *default_acl, *acl;
702 err = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
707 err = ntfs_set_acl_ex(mnt_userns, inode, default_acl,
708 ACL_TYPE_DEFAULT, true);
709 posix_acl_release(default_acl);
711 inode->i_default_acl = NULL;
716 err = ntfs_set_acl_ex(mnt_userns, inode, acl,
717 ACL_TYPE_ACCESS, true);
718 posix_acl_release(acl);
728 * ntfs_acl_chmod - Helper for ntfs3_setattr().
730 int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
732 struct super_block *sb = inode->i_sb;
734 if (!(sb->s_flags & SB_POSIXACL))
737 if (S_ISLNK(inode->i_mode))
740 return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
744 * ntfs_permission - inode_operations::permission
746 int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
749 if (ntfs_sb(inode->i_sb)->options->noacsrules) {
750 /* "No access rules" mode - Allow all changes. */
754 return generic_permission(mnt_userns, inode, mask);
758 * ntfs_listxattr - inode_operations::listxattr
760 ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
762 struct inode *inode = d_inode(dentry);
763 struct ntfs_inode *ni = ntfs_i(inode);
766 if (!(ni->ni_flags & NI_FLAG_EA)) {
767 /* no xattr in file */
773 ret = ntfs_list_ea(ni, buffer, size);
780 static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
781 struct inode *inode, const char *name, void *buffer,
785 struct ntfs_inode *ni = ntfs_i(inode);
786 size_t name_len = strlen(name);
788 /* Dispatch request. */
789 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
790 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
791 /* system.dos_attrib */
794 } else if (size < sizeof(u8)) {
798 *(u8 *)buffer = le32_to_cpu(ni->std_fa);
803 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
804 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
805 /* system.ntfs_attrib */
808 } else if (size < sizeof(u32)) {
812 *(u32 *)buffer = le32_to_cpu(ni->std_fa);
817 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
818 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
819 /* system.ntfs_security*/
820 struct SECURITY_DESCRIPTOR_RELATIVE *sd = NULL;
823 if (!is_ntfs3(ni->mi.sbi)) {
824 /* We should get nt4 security. */
827 } else if (le32_to_cpu(ni->std_security_id) <
833 err = ntfs_get_security_by_id(ni->mi.sbi, ni->std_security_id,
838 if (!is_sd_valid(sd, sd_size)) {
841 "looks like you get incorrect security descriptor id=%u",
842 ni->std_security_id);
847 } else if (size < sd_size) {
851 memcpy(buffer, sd, sd_size);
857 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
858 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
859 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
860 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
861 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
862 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
863 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
864 /* TODO: init_user_ns? */
865 err = ntfs_xattr_get_acl(
866 &init_user_ns, inode,
867 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
874 /* Deal with NTFS extended attribute. */
875 err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
882 * ntfs_setxattr - inode_operations::setxattr
884 static noinline int ntfs_setxattr(const struct xattr_handler *handler,
885 struct user_namespace *mnt_userns,
886 struct dentry *de, struct inode *inode,
887 const char *name, const void *value,
888 size_t size, int flags)
891 struct ntfs_inode *ni = ntfs_i(inode);
892 size_t name_len = strlen(name);
893 enum FILE_ATTRIBUTE new_fa;
895 /* Dispatch request. */
896 if (name_len == sizeof(SYSTEM_DOS_ATTRIB) - 1 &&
897 !memcmp(name, SYSTEM_DOS_ATTRIB, sizeof(SYSTEM_DOS_ATTRIB))) {
898 if (sizeof(u8) != size)
900 new_fa = cpu_to_le32(*(u8 *)value);
904 if (name_len == sizeof(SYSTEM_NTFS_ATTRIB) - 1 &&
905 !memcmp(name, SYSTEM_NTFS_ATTRIB, sizeof(SYSTEM_NTFS_ATTRIB))) {
906 if (size != sizeof(u32))
908 new_fa = cpu_to_le32(*(u32 *)value);
910 if (S_ISREG(inode->i_mode)) {
911 /* Process compressed/sparsed in special way. */
913 err = ni_new_attr_flags(ni, new_fa);
920 * Thanks Mark Harmstone:
921 * Keep directory bit consistency.
923 if (S_ISDIR(inode->i_mode))
924 new_fa |= FILE_ATTRIBUTE_DIRECTORY;
926 new_fa &= ~FILE_ATTRIBUTE_DIRECTORY;
928 if (ni->std_fa != new_fa) {
930 if (new_fa & FILE_ATTRIBUTE_READONLY)
931 inode->i_mode &= ~0222;
933 inode->i_mode |= 0222;
934 /* Std attribute always in primary record. */
936 mark_inode_dirty(inode);
943 if (name_len == sizeof(SYSTEM_NTFS_SECURITY) - 1 &&
944 !memcmp(name, SYSTEM_NTFS_SECURITY, sizeof(SYSTEM_NTFS_SECURITY))) {
945 /* system.ntfs_security*/
948 struct ATTR_STD_INFO5 *std;
950 if (!is_ntfs3(ni->mi.sbi)) {
952 * We should replace ATTR_SECURE.
953 * Skip this way cause it is nt4 feature.
959 if (!is_sd_valid(value, size)) {
963 "you try to set invalid security descriptor");
967 err = ntfs_insert_security(ni->mi.sbi, value, size,
968 &security_id, &inserted);
976 } else if (std->security_id != security_id) {
977 std->security_id = ni->std_security_id = security_id;
978 /* Std attribute always in primary record. */
980 mark_inode_dirty(&ni->vfs_inode);
986 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
987 if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
988 !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
989 sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
990 (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
991 !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
992 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
993 err = ntfs_xattr_set_acl(
995 name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
1002 /* Deal with NTFS extended attribute. */
1003 err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
1006 inode->i_ctime = current_time(inode);
1007 mark_inode_dirty(inode);
1013 * ntfs_save_wsl_perm
1015 * save uid/gid/mode in xattr
1017 int ntfs_save_wsl_perm(struct inode *inode)
1021 struct ntfs_inode *ni = ntfs_i(inode);
1024 value = cpu_to_le32(i_uid_read(inode));
1025 err = ntfs_set_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value,
1026 sizeof(value), 0, true); /* true == already locked. */
1030 value = cpu_to_le32(i_gid_read(inode));
1031 err = ntfs_set_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value,
1032 sizeof(value), 0, true);
1036 value = cpu_to_le32(inode->i_mode);
1037 err = ntfs_set_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value,
1038 sizeof(value), 0, true);
1042 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
1043 value = cpu_to_le32(inode->i_rdev);
1044 err = ntfs_set_ea(inode, "$LXDEV", sizeof("$LXDEV") - 1, &value,
1045 sizeof(value), 0, true);
1052 /* In case of error should we delete all WSL xattr? */
1059 * get uid/gid/mode from xattr
1060 * it is called from ntfs_iget5->ntfs_read_mft
1062 void ntfs_get_wsl_perm(struct inode *inode)
1067 if (ntfs_get_ea(inode, "$LXUID", sizeof("$LXUID") - 1, &value[0],
1068 sizeof(value[0]), &sz) == sizeof(value[0]) &&
1069 ntfs_get_ea(inode, "$LXGID", sizeof("$LXGID") - 1, &value[1],
1070 sizeof(value[1]), &sz) == sizeof(value[1]) &&
1071 ntfs_get_ea(inode, "$LXMOD", sizeof("$LXMOD") - 1, &value[2],
1072 sizeof(value[2]), &sz) == sizeof(value[2])) {
1073 i_uid_write(inode, (uid_t)le32_to_cpu(value[0]));
1074 i_gid_write(inode, (gid_t)le32_to_cpu(value[1]));
1075 inode->i_mode = le32_to_cpu(value[2]);
1077 if (ntfs_get_ea(inode, "$LXDEV", sizeof("$$LXDEV") - 1,
1078 &value[0], sizeof(value),
1079 &sz) == sizeof(value[0])) {
1080 inode->i_rdev = le32_to_cpu(value[0]);
1085 static bool ntfs_xattr_user_list(struct dentry *dentry)
1091 static const struct xattr_handler ntfs_xattr_handler = {
1093 .get = ntfs_getxattr,
1094 .set = ntfs_setxattr,
1095 .list = ntfs_xattr_user_list,
1098 const struct xattr_handler *ntfs_xattr_handlers[] = {
1099 &ntfs_xattr_handler,