Lines Matching full:attribute

3  * NTFS attribute operations.
34 * Extended attribute, reparse point are not expected to be larger than this size.
43 * @ctx: active attribute search context if present or NULL if not
55 * attribute on return as on entry. However, the actual pointers in @ctx may
69 * the attribute has zero allocated size, i.e. there simply is no runlist.
132 * If we already have the attribute extent containing @vcn in in ntfs_map_runlist_nolock()
136 * the right attribute extent. in ntfs_map_runlist_nolock()
163 * needed attribute extent. in ntfs_map_runlist_nolock()
205 * If there is no attribute list, restoring the search context in ntfs_map_runlist_nolock()
207 * the caller supplied context. If there is an attribute list, in ntfs_map_runlist_nolock()
345 * @ni: ntfs inode of the attribute whose runlist to search
349 * Find the virtual cluster number @vcn in the runlist of the ntfs attribute
353 * If the @vcn is not mapped yet, the attempt is made to map the attribute
495 * @ctx: active attribute search context if present or NULL if not
500 * If the @vcn is not mapped yet, the attempt is made to map the attribute
511 * attribute on return as on entry. However, the actual pointers in @ctx may
610 * ntfs_attr_find - find (next) attribute in mft record
611 * @type: attribute type to find
612 * @name: attribute name to find (optional, i.e. NULL means don't care)
613 * @name_len: attribute name length (only needed if @name present)
615 * @val: attribute value to find (optional, resident attributes only)
616 * @val_len: attribute value length
617 * @ctx: search context with mft record and attribute to search from
624 * attribute of @type, optionally @name and @val.
626 * If the attribute is found, ntfs_attr_find() returns 0 and @ctx->attr will
627 * point to the found attribute.
629 * If the attribute is not found, ntfs_attr_find() returns -ENOENT and
630 * @ctx->attr will point to the attribute before which the attribute being
646 * If @name is not present (NULL), we assume that the unnamed attribute is
649 * Finally, the resident attribute value @val is looked for, if present. If
653 * presence of an attribute list attribute (unless it is the one being searched
654 * for, obviously). If you need to take attribute lists into consideration,
658 * attribute list attribute only. - Note that it is possible that the first
659 * extent is only in the attribute list while the last extent is in the base
663 * Warning: Never use @val when looking for attribute types which can be
678 * attribute following that, if @ctx->is_first is 'true'. in ntfs_attr_find()
708 * missing, assume we want an unnamed attribute. in ntfs_attr_find()
711 /* The search failed if the found attribute is named. */ in ntfs_attr_find()
718 ntfs_error(vol->sb, "Corrupt attribute name in MFT record %llu\n", in ntfs_attr_find()
734 * matching attribute. in ntfs_attr_find()
752 /* Validate attribute's value offset/length */ in ntfs_attr_find()
765 "Too small %#x resident attribute value in MFT record %lld\n", in ntfs_attr_find()
785 * The names match or @name not present and attribute is in ntfs_attr_find()
786 * unnamed. If no @val specified, we have found the attribute in ntfs_attr_find()
800 * If @val collates before the current attribute's in ntfs_attr_find()
801 * value, there is no matching attribute. in ntfs_attr_find()
860 "Failed to open an inode for Attribute list, mft = %llu", in load_attribute_list()
868 "Failed to read attribute list, mft = %llu", in load_attribute_list()
887 ntfs_error(base_ni->vol->sb, "Corrupt attribute list, mft = %llu", in load_attribute_list()
895 * ntfs_external_attr_find - find an attribute in the attribute list of an inode
896 * @type: attribute type to find
897 * @name: attribute name to find (optional, i.e. NULL means don't care)
898 * @name_len: attribute name length (only needed if @name present)
901 * @val: attribute value to find (optional, resident attributes only)
902 * @val_len: attribute value length
903 * @ctx: search context with mft record and attribute to search from
908 * Find an attribute by searching the attribute list for the corresponding
909 * attribute list entry. Having found the entry, map the mft record if the
910 * attribute is in a different mft record/inode, ntfs_attr_find() the attribute
918 * After finishing with the attribute/mft record you need to call
922 * If the attribute is found, ntfs_external_attr_find() returns 0 and
923 * @ctx->attr will point to the found attribute. @ctx->mrec will point to the
925 * the attribute list entry for the attribute.
927 * If the attribute is not found, ntfs_external_attr_find() returns -ENOENT and
928 * @ctx->attr will point to the attribute in the base mft record before which
929 * the attribute being searched for would need to be inserted if such an action
931 * @ctx->attr is located and @ctx->al_entry will point to the attribute list
932 * entry of the attribute before which the attribute being searched for would
935 * Thus to insert the not found attribute, one wants to add the attribute to
937 * attribute should be placed in a newly allocated extent mft record. The
938 * attribute list entry for the inserted attribute should be inserted in the
939 * attribute list attribute at @ctx->al_entry.
980 * Iterate over entries in attribute list starting at @ctx->al_entry, in ntfs_external_attr_find()
987 * If an enumeration and the first attribute is higher than in ntfs_external_attr_find()
988 * the attribute list itself, need to return the attribute list in ntfs_external_attr_find()
989 * attribute. in ntfs_external_attr_find()
1015 * If this is an enumeration and the attribute list attribute in ntfs_external_attr_find()
1017 * attribute list attribute from the base mft record as it is in ntfs_external_attr_find()
1018 * not listed in the attribute list itself. in ntfs_external_attr_find()
1042 /* Find the attribute list attribute. */ in ntfs_external_attr_find()
1048 * attribute is returned next time round. in ntfs_external_attr_find()
1062 ntfs_error(ctx->ntfs_ino->vol->sb, "Attribute list wasn't found"); in ntfs_external_attr_find()
1072 /* Catch the end of the attribute list. */ in ntfs_external_attr_find()
1095 * missing, assume we want an unnamed attribute. in ntfs_external_attr_find()
1101 * If !@type we want the attribute represented by this in ntfs_external_attr_find()
1102 * attribute list entry. in ntfs_external_attr_find()
1119 * matching attribute. in ntfs_external_attr_find()
1136 * The names match or @name not present and attribute is in ntfs_external_attr_find()
1138 * next attribute list entry still fits @lowest_vcn. Otherwise in ntfs_external_attr_find()
1161 "Found stale mft reference in attribute list of base inode 0x%llx.%s", in ntfs_external_attr_find()
1202 * mft record containing the attribute represented by the in ntfs_external_attr_find()
1207 * attribute in this mft record but this would be less in ntfs_external_attr_find()
1209 * the attribute instance numbers for example which become in ntfs_external_attr_find()
1210 * important when one plays with attribute lists. Also, in ntfs_external_attr_find()
1211 * because a proper match has been found in the attribute list in ntfs_external_attr_find()
1241 * attribute list entry and the attribute record, there is in ntfs_external_attr_find()
1293 pr_err("Too small resident attribute value in MFT record %lld, type %#x\n", in ntfs_external_attr_find()
1305 /* Proceed to the next attribute in the current mft record. */ in ntfs_external_attr_find()
1325 "Base inode 0x%llx contains corrupt attribute, mft %#llx, type %#x. %s", in ntfs_external_attr_find()
1345 * The attribute was not found. Before we return, we want to ensure in ntfs_external_attr_find()
1347 * attribute should be inserted in the base mft record. Since we also in ntfs_external_attr_find()
1370 * keep enumerating until we get an attribute not found response (or in ntfs_external_attr_find()
1371 * another error), otherwise we would keep returning the same attribute in ntfs_external_attr_find()
1384 * ntfs_attr_lookup - find an attribute in an ntfs inode
1385 * @type: attribute type to find
1386 * @name: attribute name to find (optional, i.e. NULL means don't care)
1387 * @name_len: attribute name length (only needed if @name present)
1390 * @val: attribute value to find (optional, resident attributes only)
1391 * @val_len: attribute value length
1392 * @ctx: search context with mft record and attribute to search from
1394 * Find an attribute in an ntfs inode. On first search @ctx->ntfs_ino must
1398 * This function transparently handles attribute lists and @ctx is used to
1401 * After finishing with the attribute/mft record you need to call
1407 * When 0, @ctx->attr is the found attribute and it is in mft record
1408 * @ctx->mrec. If an attribute list attribute is present, @ctx->al_entry is
1409 * the attribute list entry of the found attribute.
1411 * When -ENOENT, @ctx->attr is the attribute which collates just after the
1412 * attribute being searched for, i.e. if one wants to add the attribute to the
1413 * mft record this is the correct place to insert it into. If an attribute
1414 * list attribute is present, @ctx->al_entry is the attribute list entry which
1415 * collates just after the attribute list entry of the attribute being searched
1416 * for, i.e. if one wants to add the attribute to the mft record this is the
1417 * correct place to insert its attribute list entry into.
1440 * ntfs_attr_init_search_ctx - initialize an attribute search context
1441 * @ctx: attribute search context to initialize
1445 * Initialize the attribute search context @ctx with @ni and @mrec.
1473 * ntfs_attr_reinit_search_ctx - reinitialize an attribute search context
1474 * @ctx: attribute search context to reinitialize
1476 * Reinitialize the attribute search context @ctx, unmapping an associated
1479 * This is used when a search for a new attribute is being started to reset
1487 /* No attribute list. */ in ntfs_attr_reinit_search_ctx()
1498 } /* Attribute list. */ in ntfs_attr_reinit_search_ctx()
1508 * ntfs_attr_get_search_ctx - allocate/initialize a new attribute search context
1512 * Allocate a new attribute search context, initialize it with @ni and @mrec,
1534 * ntfs_attr_put_search_ctx - release an attribute search context
1535 * @ctx: attribute search context to free
1537 * Release the attribute search context @ctx, unmapping an associated extent
1552 * ntfs_attr_find_in_attrdef - find an attribute in the $AttrDef system file
1553 * @vol: ntfs volume to which the attribute belongs
1554 * @type: attribute type which to find
1556 * Search for the attribute definition record corresponding to the attribute
1559 * Return the attribute type definition record if found and NULL if not found.
1572 /* We found the attribute; return it. */ in ntfs_attr_find_in_attrdef()
1578 /* Attribute not found. */ in ntfs_attr_find_in_attrdef()
1579 ntfs_debug("Attribute type 0x%x not found in $AttrDef.", in ntfs_attr_find_in_attrdef()
1585 * ntfs_attr_size_bounds_check - check a size of an attribute type for validity
1586 * @vol: ntfs volume to which the attribute belongs
1587 * @type: attribute type which to check
1590 * Check whether the @size in bytes is valid for an attribute of @type on the
1607 /* Get the $AttrDef entry for the attribute @type. */ in ntfs_attr_size_bounds_check()
1621 * ntfs_attr_can_be_non_resident - check if an attribute can be non-resident
1622 * @vol: ntfs volume to which the attribute belongs
1623 * @type: attribute type which to check
1625 * Check whether the attribute of @type on the ntfs volume @vol is allowed to
1633 /* Find the attribute definition record in $AttrDef. */ in ntfs_attr_can_be_non_resident()
1644 * ntfs_attr_can_be_resident - check if an attribute can be resident
1645 * @vol: ntfs volume to which the attribute belongs
1646 * @type: attribute type which to check
1648 * Check whether the attribute of @type on the ntfs volume @vol is allowed to
1654 * Return 0 if the attribute is allowed to be non-resident and -EPERM if not.
1656 * Warning: In the system file $MFT the attribute $Bitmap must be non-resident
1669 * ntfs_attr_record_resize - resize an attribute record
1670 * @m: mft record containing attribute record
1671 * @a: attribute record to resize
1672 * @new_size: new size in bytes to which to resize the attribute record @a
1674 * Resize the attribute record @a, i.e. the resident part of the attribute, in
1692 /* If the actual attribute length has changed, move things around. */ in ntfs_attr_record_resize()
1721 * ntfs_resident_attr_value_resize - resize the value of a resident attribute
1722 * @m: mft record containing attribute record
1723 * @a: attribute record whose value to resize
1724 * @new_size: new size in bytes to which to resize the attribute value of @a
1726 * Resize the value of the attribute @a in the mft record @m to @new_size bytes.
1734 /* Resize the resident part of the attribute record. */ in ntfs_resident_attr_value_resize()
1739 * The resize succeeded! If we made the attribute value bigger, clear in ntfs_resident_attr_value_resize()
1746 /* Finally update the length of the attribute value. */ in ntfs_resident_attr_value_resize()
1752 * ntfs_attr_make_non_resident - convert a resident to a non-resident attribute
1753 * @ni: ntfs inode describing the attribute to convert
1754 * @data_size: size of the resident data to copy to the non-resident attribute
1756 * Convert the resident ntfs attribute described by the ntfs inode @ni to a
1759 * @data_size must be equal to the attribute value size. This is needed since
1783 "Trying to make non-resident attribute non-resident. Aborting...\n"); in ntfs_attr_make_non_resident()
1787 /* Check that the attribute is allowed to be non-resident. */ in ntfs_attr_make_non_resident()
1791 ntfs_debug("Attribute is not allowed to be non-resident."); in ntfs_attr_make_non_resident()
1793 ntfs_debug("Attribute not defined on the NTFS volume!"); in ntfs_attr_make_non_resident()
1853 /* Start by allocating clusters to hold the attribute value. */ in ntfs_attr_make_non_resident()
1897 * attribute record. in ntfs_attr_make_non_resident()
1902 * attribute value. in ntfs_attr_make_non_resident()
1913 /* Backup the attribute flag. */ in ntfs_attr_make_non_resident()
1915 /* Resize the resident part of the attribute record. */ in ntfs_attr_make_non_resident()
1921 * Convert the resident part of the attribute record to describe a in ntfs_attr_make_non_resident()
1922 * non-resident attribute. in ntfs_attr_make_non_resident()
1925 /* Move the attribute name if it exists and update the offset. */ in ntfs_attr_make_non_resident()
1949 /* Generate the mapping pairs array into the attribute record. */ in ntfs_attr_make_non_resident()
1958 /* Setup the in-memory attribute structure to be non-resident. */ in ntfs_attr_make_non_resident()
2008 /* Convert the attribute back into a resident attribute. */ in ntfs_attr_make_non_resident()
2010 /* Move the attribute name if it exists and update the offset. */ in ntfs_attr_make_non_resident()
2019 /* Resize the resident part of the attribute record. */ in ntfs_attr_make_non_resident()
2025 * If the old size is too small, truncate the attribute, in ntfs_attr_make_non_resident()
2033 …Failed to undo partial resident to non-resident attribute conversion. Truncating inode 0x%llx, at… in ntfs_attr_make_non_resident()
2038 !ni->name_len) ? "FILE" : "ATTRIBUTE"); in ntfs_attr_make_non_resident()
2051 /* Copy the data from folio back to the attribute value. */ in ntfs_attr_make_non_resident()
2086 * ntfs_attr_set - fill (a part of) an attribute with a byte
2087 * @ni: ntfs inode describing the attribute to fill
2088 * @ofs: offset inside the attribute at which to start to fill
2090 * @val: the unsigned 8-bit value with which to fill the attribute
2092 * Fill @cnt bytes of the attribute described by the ntfs inode @ni starting at
2093 * byte offset @ofs inside the attribute with the constant byte @val.
2095 * This function is effectively like memset() applied to an ntfs attribute.
2097 * to the ntfs attribute and it marks them dirty after doing the memset().
2168 * ntfs_make_room_for_attr - make room for an attribute inside an mft record
2173 * @pos points to the attribute in front of which we want to make space.
2191 /* The -8 is for the attribute terminator. */ in ntfs_make_room_for_attr()
2213 * ntfs_resident_attr_record_add - add resident attribute to inode
2214 * @ni: opened ntfs inode to which MFT record add attribute
2215 * @type: type of the new attribute
2216 * @name: name of the new attribute
2217 * @name_len: name length of the new attribute
2218 * @val: value of the new attribute
2219 * @size: size of new attribute (length of @val, if @val != NULL)
2220 * @flags: flags of the new attribute
2243 ntfs_debug("Attribute can't be resident.\n"); in ntfs_resident_attr_record_add()
2258 * attribute in @ni->mrec, not any extent inode in case if @ni is base in ntfs_resident_attr_record_add()
2264 ntfs_debug("Attribute already present.\n"); in ntfs_resident_attr_record_add()
2274 /* Make room for attribute. */ in ntfs_resident_attr_record_add()
2281 ntfs_debug("Failed to make room for attribute.\n"); in ntfs_resident_attr_record_add()
2321 ntfs_debug("Failed add attribute entry to ATTRIBUTE_LIST.\n"); in ntfs_resident_attr_record_add()
2334 * ntfs_non_resident_attr_record_add - add extent of non-resident attribute
2335 * @ni: opened ntfs inode to which MFT record add attribute
2336 * @type: type of the new attribute extent
2337 * @name: name of the new attribute extent
2338 * @name_len: name length of the new attribute extent
2339 * @lowest_vcn: lowest vcn of the new attribute extent
2340 * @dataruns_size: dataruns size of the new attribute extent
2341 * @flags: flags of the new attribute extent
2365 pr_err("Attribute can't be non resident\n"); in ntfs_non_resident_attr_record_add()
2379 * attribute in @ni->mrec, not any extent inode in case if @ni is base in ntfs_non_resident_attr_record_add()
2385 pr_err("Attribute 0x%x already present\n", type); in ntfs_non_resident_attr_record_add()
2396 /* Make room for attribute. */ in ntfs_non_resident_attr_record_add()
2404 pr_err("Failed to make room for attribute\n"); in ntfs_non_resident_attr_record_add()
2423 /* If @lowest_vcn == 0, than setup empty attribute. */ in ntfs_non_resident_attr_record_add()
2451 * Locate offset from start of the MFT record where new attribute is in ntfs_non_resident_attr_record_add()
2453 * update of attribute list. in ntfs_non_resident_attr_record_add()
2459 pr_err("%s: attribute lookup failed\n", __func__); in ntfs_non_resident_attr_record_add()
2473 * ntfs_attr_record_rm - remove attribute extent
2474 * @ctx: search context describing the attribute which should be removed
2498 /* Remove attribute itself. */ in ntfs_attr_record_rm()
2500 ntfs_debug("Couldn't remove attribute record. Bug or damaged MFT record.\n"); in ntfs_attr_record_rm()
2542 /* Remove attribute list if we don't need it any more. */ in ntfs_attr_record_rm()
2550 ntfs_debug("Couldn't find attribute list. Succeed anyway.\n"); in ntfs_attr_record_rm()
2561 ntfs_debug("Couldn't decompress attribute list runlist. Succeed anyway.\n"); in ntfs_attr_record_rm()
2565 … ntfs_debug("Leaking clusters! Run chkdsk. Couldn't free clusters from attribute list runlist.\n"); in ntfs_attr_record_rm()
2568 /* Remove attribute record itself. */ in ntfs_attr_record_rm()
2570 ntfs_debug("Couldn't remove attribute list. Succeed anyway.\n"); in ntfs_attr_record_rm()
2591 * ntfs_attr_add - add attribute to inode
2592 * @ni: opened ntfs inode to which add attribute
2593 * @type: type of the new attribute
2594 * @name: name in unicode of the new attribute
2595 * @name_len: name length in unicode characters of the new attribute
2596 * @val: value of new attribute
2597 * @size: size of the new attribute / length of @val (if specified)
2600 * attribute), for attributes that can become non-resident @val can be NULL
2601 * (eg. DATA attribute). @size can be specified even if @val is NULL, in this
2605 * If inode haven't got enough space to add attribute, add attribute to one of
2607 * allocate new extent and add attribute to it.
2609 * If on one of this steps attribute list is needed but not present, than it is
2611 * @type == AT_ATTRIBUTE_LIST, if you really need to add attribute list call
2637 /* Check the attribute type and the size. */ in ntfs_attr_add()
2660 ntfs_error(sb, "Attribute is too big"); in ntfs_attr_add()
2667 * Determine resident or not will be new attribute. We add 8 to size in in ntfs_attr_add()
2681 /* Calculate attribute record size. */ in ntfs_attr_add()
2692 * If we have enough free space for the new attribute in the base MFT in ntfs_attr_add()
2693 * record, then add attribute to it. in ntfs_attr_add()
2734 /* There is no extent that contain enough space for new attribute. */ in ntfs_attr_add()
2736 /* Add attribute list not present, add it and retry. */ in ntfs_attr_add()
2739 ntfs_error(sb, "Failed to add attribute list"); in ntfs_attr_add()
2756 /* Add resident attribute. */ in ntfs_attr_add()
2763 ntfs_error(sb, "Failed to add resident attribute"); in ntfs_attr_add()
2770 /* Add non resident attribute. */ in ntfs_attr_add()
2775 ntfs_error(sb, "Failed to add non resident attribute"); in ntfs_attr_add()
2783 /* Open new attribute and resize it. */ in ntfs_attr_add()
2787 ntfs_error(sb, "Failed to open just added attribute"); in ntfs_attr_add()
2792 /* Resize and set attribute value. */ in ntfs_attr_add()
2796 ntfs_error(sb, "Failed to initialize just added attribute"); in ntfs_attr_add()
2798 ntfs_error(sb, "Failed to remove just added attribute"); in ntfs_attr_add()
2806 /* Remove just added attribute. */ in ntfs_attr_add()
2811 ntfs_error(sb, "Failed to remove just added attribute #2"); in ntfs_attr_add()
2839 * __ntfs_attr_init - primary initialization of an ntfs attribute structure
2840 * @ni: ntfs attribute inode to initialize
2841 * @ni: ntfs inode with which to initialize the ntfs attribute
2842 * @type: attribute type
2843 * @name: attribute name in little endian Unicode or NULL
2844 * @name_len: length of attribute @name in Unicode characters (if @name given)
2846 * Initialize the ntfs attribute @na with @ni, @type, @name, and @name_len.
2863 * @non_resident: true if attribute is non-resident
2864 * @compressed: true if attribute is compressed
2865 * @encrypted: true if attribute is encrypted
2866 * @sparse: true if attribute is sparse
2867 * @allocated_size: allocated size of the attribute
2868 * @data_size: actual data size of the attribute
2869 * @initialized_size: initialized size of the attribute
2873 * Final initialization for an ntfs attribute.
2911 * ntfs_attr_open - open an ntfs attribute for access
2912 * @ni: open ntfs inode in which the ntfs attribute resides
2913 * @type: attribute type
2914 * @name: attribute name in little endian Unicode or AT_UNNAMED or NULL
2915 * @name_len: length of attribute @name in Unicode characters (if @name given)
2977 * Wipe the flags in case they are not zero for an attribute list in ntfs_attr_open()
2978 * attribute. Windows does not complain about invalid flags and chkdsk in ntfs_attr_open()
3013 pr_err("Inode %lld has corrupt attribute flags (0x%x <> 0x%x)\n", in ntfs_attr_open()
3074 * ntfs_attr_close - free an ntfs attribute structure
3077 * Release all memory associated with the ntfs attribute @na and then release
3090 * ntfs_attr_map_whole_runlist - map the whole runlist of an ntfs attribute
3093 * Map the whole runlist of the ntfs attribute @na. For an attribute made up
3094 * of only one attribute extent this is the same as calling
3095 * ntfs_map_runlist(ni, 0) but for an attribute with multiple extents this
3097 * to the entirety of the disk allocation of an attribute.
3128 /* Map all attribute extents one by one. */ in ntfs_attr_map_whole_runlist()
3162 "First extent of inode %llu attribute has non-zero lowest_vcn", in ntfs_attr_map_whole_runlist()
3166 /* Get the last vcn in the attribute. */ in ntfs_attr_map_whole_runlist()
3184 ntfs_error(sb, "Inode %llu has corrupt attribute list", in ntfs_attr_map_whole_runlist()
3190 ntfs_error(sb, "Couldn't find attribute for runlist mapping"); in ntfs_attr_map_whole_runlist()
3215 * ntfs_attr_record_move_to - move attribute record to target inode
3216 * @ctx: attribute search context describing the attribute record
3217 * @ni: opened ntfs inode to which move attribute record
3242 ntfs_debug("Inode should contain attribute list to use this function.\n"); in ntfs_attr_record_move_to()
3246 /* Find place in MFT record where attribute will be moved. */ in ntfs_attr_record_move_to()
3256 * attribute in @ni->mrec, not any extent inode in case if @ni is base in ntfs_attr_record_move_to()
3263 ntfs_debug("Attribute of such type, with same name already present in this MFT record.\n"); in ntfs_attr_record_move_to()
3268 ntfs_debug("Attribute lookup failed.\n"); in ntfs_attr_record_move_to()
3272 /* Make space and move attribute. */ in ntfs_attr_record_move_to()
3282 ntfs_debug("Couldn't make space for attribute.\n"); in ntfs_attr_record_move_to()
3294 /* Update attribute list. */ in ntfs_attr_record_move_to()
3305 * ntfs_attr_record_move_away - move away attribute record from it's mft record
3306 * @ctx: attribute search context describing the attribute record
3343 /* Walk through all extents and try to move attribute to them. */ in ntfs_attr_record_move_away()
3376 * Failed to move attribute to one of the current extents, so allocate in ntfs_attr_record_move_away()
3377 * new extent and move attribute to it. in ntfs_attr_record_move_away()
3389 ntfs_error(sb, "Couldn't move attribute to MFT record"); in ntfs_attr_record_move_away()
3424 /* Attribute become sparse. */ in ntfs_attr_update_meta()
3427 * Move attribute to another mft record, if attribute is too in ntfs_attr_update_meta()
3444 ntfs_error(sb, "Failed to move attribute"); in ntfs_attr_update_meta()
3476 /* Attribute no longer sparse. */ in ntfs_attr_update_meta()
3525 * ntfs_attr_update_mapping_pairs - update mapping pairs for ntfs attribute
3560 ntfs_error(sb, "%s: resident attribute", __func__); in ntfs_attr_update_mapping_pairs()
3575 /* Fill attribute records with new mapping pairs. */ in ntfs_attr_update_mapping_pairs()
3663 * Mapping pairs of $ATTRIBUTE_LIST attribute must fit in ntfs_attr_update_mapping_pairs()
3671 ntfs_debug("Attribute list is too big. Defragment the volume\n"); in ntfs_attr_update_mapping_pairs()
3679 /* Add attribute list if it isn't present, and retry. */ in ntfs_attr_update_mapping_pairs()
3703 ntfs_error(sb, "Failed to resize attribute"); in ntfs_attr_update_mapping_pairs()
3721 * correct destination, i.e. the attribute record itself. in ntfs_attr_update_mapping_pairs()
3739 ntfs_error(sb, "%s: Attribute lookup failed", __func__); in ntfs_attr_update_mapping_pairs()
3767 /* Deallocate not used attribute extents and return with success. */ in ntfs_attr_update_mapping_pairs()
3776 /* Remove unused attribute record. */ in ntfs_attr_update_mapping_pairs()
3842 /* Add attribute extent to new record. */ in ntfs_attr_update_mapping_pairs()
3846 ntfs_error(sb, "Could not add attribute extent"); in ntfs_attr_update_mapping_pairs()
3887 * ntfs_attr_make_resident - convert a non-resident to a resident attribute
3888 * @ni: open ntfs attribute to make resident
3889 * @ctx: ntfs search context describing the attribute
3891 * Convert a non-resident ntfs attribute to a resident one.
3904 /* Should be called for the first extent of the attribute. */ in ntfs_attr_make_resident()
3906 ntfs_debug("Eeek! Should be called for the first extent of the attribute. Aborting...\n"); in ntfs_attr_make_resident()
3912 ntfs_debug("Eeek! Trying to make resident attribute resident. Aborting...\n"); in ntfs_attr_make_resident()
3920 /* Check that the attribute is allowed to be resident. */ in ntfs_attr_make_resident()
3930 /* Work out offsets into and size of the resident attribute. */ in ntfs_attr_make_resident()
3935 /* Sanity check the size before we start modifying the attribute. */ in ntfs_attr_make_resident()
3938 ntfs_debug("Not enough space to make attribute resident\n"); in ntfs_attr_make_resident()
3947 /* Move the attribute name if it exists and update the offset. */ in ntfs_attr_make_resident()
3954 /* Resize the resident part of the attribute record. */ in ntfs_attr_make_resident()
3958 * already checked that attribute fits MFT record). in ntfs_attr_make_resident()
3960 ntfs_error(ctx->ntfs_ino->vol->sb, "BUG! Failed to resize attribute record. "); in ntfs_attr_make_resident()
3964 /* Convert the attribute record to describe a resident attribute. */ in ntfs_attr_make_resident()
3984 * the whole run list and thus it doesn't matter that the attribute in ntfs_attr_make_resident()
4013 * ntfs_non_resident_attr_shrink - shrink a non-resident, open ntfs attribute
4014 * @ni: non-resident ntfs attribute to shrink
4015 * @newsize: new size (in bytes) to which to shrink the attribute
4017 * Reduce the size of a non-resident, open ntfs attribute @na to @newsize bytes.
4039 * Check the attribute type and the corresponding minimum size in ntfs_non_resident_attr_shrink()
4127 /* Get the first attribute record. */ in ntfs_non_resident_attr_shrink()
4139 ntfs_debug("Eeek! Lookup of first attribute extent failed. Leaving inconstant metadata.\n"); in ntfs_non_resident_attr_shrink()
4154 /* If the attribute now has zero size, make it resident. */ in ntfs_non_resident_attr_shrink()
4161 "Failed to make attribute resident. Leaving as is...\n"); in ntfs_non_resident_attr_shrink()
4176 * ntfs_non_resident_attr_expand - expand a non-resident, open ntfs attribute
4177 * @ni: non-resident ntfs attribute to expand
4178 * @prealloc_size: preallocation size (in bytes) to which to expand the attribute
4179 * @newsize: new size (in bytes) to which to expand the attribute
4183 * Expand the size of a non-resident, open ntfs attribute @na to @newsize bytes,
4212 * Check the attribute type and the corresponding maximum size in ntfs_non_resident_attr_expand()
4247 * If we extend $DATA attribute on NTFS 3+ volume, we can add in ntfs_non_resident_attr_expand()
4306 * Determine first after last LCN of attribute. in ntfs_non_resident_attr_expand()
4309 * attribute let the cluster allocator choose the in ntfs_non_resident_attr_expand()
4344 /* Append new clusters to attribute runlist. */ in ntfs_non_resident_attr_expand()
4444 * ntfs_resident_attr_resize - resize a resident, open ntfs attribute
4446 * @newsize: new size (in bytes) to which to resize the attribute
4447 * @prealloc_size: preallocation size (in bytes) to which to resize the attribute
4450 * Change the size of a resident, open ntfs attribute @na to @newsize bytes.
4471 /* Get the attribute record that needs modification. */ in ntfs_resident_attr_resize()
4486 * Check the attribute type and the corresponding minimum and maximum in ntfs_resident_attr_resize()
4498 * attribute non-resident if the attribute type supports it. If it is in ntfs_resident_attr_resize()
4502 /* Perform the resize of the attribute record. */ in ntfs_resident_attr_resize()
4506 /* Update attribute size everywhere. */ in ntfs_resident_attr_resize()
4523 /* Make the attribute non-resident if possible. */ in ntfs_resident_attr_resize()
4529 /* Resize non-resident attribute */ in ntfs_resident_attr_resize()
4532 ntfs_error(sb, "Failed to make attribute non-resident"); in ntfs_resident_attr_resize()
4564 ntfs_error(sb, "Couldn't open attribute"); in ntfs_resident_attr_resize()
4582 ntfs_error(sb, "%s: Attribute lookup failed 1", __func__); in ntfs_resident_attr_resize()
4587 * The standard information and attribute list attributes can't be in ntfs_resident_attr_resize()
4604 "Couldn't free space in the MFT record to make attribute list non resident"); in ntfs_resident_attr_resize()
4614 * Move the attribute to a new mft record, creating an attribute list in ntfs_resident_attr_resize()
4615 * attribute or modifying it if it is already present. in ntfs_resident_attr_resize()
4618 /* Point search context back to attribute which we need resize. */ in ntfs_resident_attr_resize()
4623 ntfs_error(sb, "%s: Attribute lookup failed 2", __func__); in ntfs_resident_attr_resize()
4628 * Check whether attribute is already single in this MFT record. in ntfs_resident_attr_resize()
4629 * 8 added for the attribute terminator. in ntfs_resident_attr_resize()
4634 ntfs_debug("MFT record is filled with one attribute\n"); in ntfs_resident_attr_resize()
4638 /* Add attribute list if not present. */ in ntfs_resident_attr_resize()
4655 /* Move attribute to it. */ in ntfs_resident_attr_resize()
4658 ntfs_error(sb, "Couldn't move attribute to new MFT record"); in ntfs_resident_attr_resize()
4740 pr_err("Failed to truncate encrypted attribute\n"); in ntfs_attr_expand()
4760 * ntfs_attr_truncate_i - resize an ntfs attribute
4762 * @newsize: new size (in bytes) to which to resize the attribute
4765 * Change the size of an open ntfs attribute @na to @newsize bytes. If the
4766 * attribute is made bigger and the attribute is resident the newly
4767 * "allocated" space is cleared and if the attribute is non-resident the
4794 pr_err("Failed to truncate encrypted attribute\n"); in ntfs_attr_truncate_i()
4799 pr_err("Failed to truncate compressed attribute\n"); in ntfs_attr_truncate_i()
4815 * Resize an attribute, creating a hole if relevant
4975 * ntfs_attr_rm - remove attribute from ntfs inode
4976 * @ni: opened ntfs attribute to delete
4978 * Remove attribute and all it's extents from ntfs inode. If attribute was non
4979 * resident also free all clusters allocated by attribute.
5016 /* Search for attribute extents and remove them all. */ in ntfs_attr_rm()
5027 "Failed to remove attribute extent. Leaving inconstant metadata.\n"); in ntfs_attr_rm()
5034 ntfs_error(sb, "Attribute lookup failed. Probably leaving inconstant metadata.\n"); in ntfs_attr_rm()
5078 ntfs_error(ni->vol->sb, "Failed to open attribute 0x%02x of inode 0x%llx", in ntfs_attr_remove()
5086 ntfs_error(ni->vol->sb, "Failed to remove attribute 0x%02x of inode 0x%llx", in ntfs_attr_remove()
5093 * ntfs_attr_readall - read the entire data from an ntfs attribute
5094 * @ni: open ntfs inode in which the ntfs attribute resides
5095 * @type: attribute type
5096 * @name: attribute name in little endian Unicode or AT_UNNAMED or NULL
5097 * @name_len: length of attribute @name in Unicode characters (if @name given)
5100 * This function will read the entire content of an ntfs attribute.
5101 * If @name is AT_UNNAMED then look specifically for an unnamed attribute.
5102 * If @name is NULL then the attribute could be either named or not.
5105 * On success a buffer is allocated with the content of the attribute
5130 ntfs_error(sb, "Invalid attribute data size"); in ntfs_attr_readall()