Lines Matching refs:attr

307 	const ATTR_RECORD *attr;
321 attr = (const ATTR_RECORD*)&buffer[k];
324 && (attr->type != AT_END)
325 && valid_type(attr->type)) {
326 type = le32_to_cpu(attr->type);
332 instance = le16_to_cpu(attr->instance);
335 printf("** Bad attr instance %d (max %d)\n",
342 printf("** Duplicated attr instance %d\n",
348 if ((attr->type == AT_FILE_NAME)
350 printf("attr %08lx offs 0x%x nres %d",
352 (int)attr->non_resident);
356 printf("attr %08lx offs 0x%x nres %d\n",
358 (int)attr->non_resident);
360 if ((attr->type == AT_INDEX_ROOT)
362 k + le16_to_cpu(attr->value_offset) + 32,
363 k + le32_to_cpu(attr->length))) {
366 k += le32_to_cpu(attr->length);
367 attr = (const ATTR_RECORD*)&buffer[k];
370 if ((optv > 1) && (attr->type == AT_END))
371 printf("attr %08lx offs 0x%x\n",
372 (long)le32_to_cpu(attr->type), (int)k);
373 if ((attr->type != AT_END)
729 static int resize_attribute(MFT_RECORD *entry, ATTR_RECORD *attr, INDEX_ROOT *index,
740 if (attr) {
741 newvalue = le32_to_cpu(attr->value_length) + rawresize;
742 attr->value_length = cpu_to_le32(newvalue);
743 newlength = le32_to_cpu(attr->length) + resize;
744 attr->length = cpu_to_le32(newlength);
770 static void adjust_instance(const ATTR_RECORD *attr, MFT_RECORD *entry, int increment)
776 if (attr->instance == entry->next_attr_instance) {
786 if (attr->instance == cpu_to_le16(instance))
787 entry->next_attr_instance = attr->instance;
797 static int adjust_high_vcn(ntfs_volume *vol, ATTR_RECORD *attr)
805 attr->highest_vcn = const_cpu_to_sle64(0);
806 rl = ntfs_mapping_pairs_decompress(vol, attr, (runlist_element*)NULL);
814 attr->highest_vcn = cpu_to_sle64(high_vcn);
819 dump((char*)attr,128);
866 ATTR_RECORD *attr;
880 attr = (ATTR_RECORD*)(buffer
889 + le32_to_cpu(attr->length);
921 ATTR_RECORD *attr;
934 attr = (ATTR_RECORD*)(buffer
940 dump((char*)attr, le32_to_cpu(attr->length));
942 if ((attr->type == type)
1099 ATTR_RECORD *attr;
1114 attr = (ATTR_RECORD*)(buffer
1120 base = 24 + 2*attr->name_length;
1126 found = le32_to_cpu(attr->value_length) == length;
1140 resize_attribute(entry, attr, NULL,
1181 ATTR_RECORD *attr;
1197 attr = (ATTR_RECORD*)(buffer
1203 if (le32_to_cpu(attr->type) < le32_to_cpu(newattr->type)) {
1209 if (valid_type(attr->type)
1210 && (le32_to_cpu(attr->type)
1264 ATTR_RECORD *attr;
1279 attr = (ATTR_RECORD*)(buffer
1289 if (attr->type == AT_DATA)
1291 le16_to_cpu(attr->value_offset));
1296 (long)le32_to_cpu(attr->type),
1299 (long)le16_to_cpu(attr->value_offset));
1304 printf("full attr :\n");
1305 dump((const char*)attr,mftrecsz
1310 if (attr->type == AT_FILE_NAME) {
1316 adjust_instance(attr, entry, -1);
1408 ATTR_RECORD *attr;
1425 attr = (ATTR_RECORD*)(buffer
1431 base = 24 + 2*attr->name_length;
1435 // TODO limit to attr length
1445 printf("* fake test, assuming not shrinked : value length %ld length %ld oldlength %ld\n",(long)le32_to_cpu(attr->value_length),(long)length,(long)oldlength);
1467 resize_attribute(entry, attr, NULL,
1537 ATTR_RECORD *attr;
1548 attr = (ATTR_RECORD*)&buffer[pos];
1549 length = le32_to_cpu(attr->length);
1550 if (attr->type == AT_FILE_NAME) {
1561 && (le32_to_cpu(attr->type) <= le32_to_cpu(AT_FILE_NAME)));
1569 ATTR_RECORD *attr;
1576 attr = (ATTR_RECORD*)malloc(headlth + datalth);
1577 if (attr) {
1578 attr->type = AT_FILE_NAME;
1579 attr->length = cpu_to_le32(headlth + datalth);
1580 attr->non_resident = 0;
1581 attr->name_length = 0;
1582 attr->name_offset = const_cpu_to_le16(0);
1583 attr->flags = const_cpu_to_le16(0);
1584 attr->instance = const_cpu_to_le16(0);
1585 attr->value_length = cpu_to_le32(
1588 attr->value_offset = cpu_to_le16(headlth);
1589 attr->resident_flags = RESIDENT_ATTR_IS_INDEXED;
1590 memcpy(attr->resident_end, &index->key.file_name, datalth);
1591 free(attr);
1609 ATTR_RECORD *attr;
1628 attr = (ATTR_RECORD*)&buffer[pos];
1630 && (le32_to_cpu(attr->type) < le32_to_cpu(AT_INDEX_ROOT))) {
1631 pos += le32_to_cpu(attr->length);
1632 attr = (ATTR_RECORD*)&buffer[pos];
1634 length = le32_to_cpu(attr->length);
1637 if ((attr->type == AT_INDEX_ROOT)
1647 attr = (ATTR_RECORD*)&buffer[offs];
1648 attr->type = AT_INDEX_ALLOCATION;
1649 attr->length = cpu_to_le32(length - 8);
1650 attr->non_resident = 1;
1652 attr->name_length = namelength;
1653 attr->name_offset = const_cpu_to_le16(0x40);
1656 attr->flags = const_cpu_to_le16(0);
1658 attr->instance = record->next_attr_instance;
1661 attr->lowest_vcn = const_cpu_to_sle64(0);
1662 attr->highest_vcn = const_cpu_to_sle64(0);
1663 attr->mapping_pairs_offset = cpu_to_le16(
1665 attr->compression_unit = 0;
1667 attr->allocated_size = cpu_to_sle64(xsize);
1668 attr->data_size = attr->allocated_size;
1669 attr->initialized_size = attr->allocated_size;
1673 attr = (ATTR_RECORD*)&buffer[offs + length - 8];
1674 attr->type = AT_BITMAP;
1675 attr->length = cpu_to_le32(length - 48);
1676 attr->non_resident = 0;
1678 attr->name_length = namelength;
1679 attr->name_offset = const_cpu_to_le16(0x18);
1682 attr->flags = const_cpu_to_le16(0);
1683 attr->value_length = const_cpu_to_le32(8);
1684 attr->value_offset = cpu_to_le16(2*namelength + 24);
1685 attr->resident_flags = 0;
1686 memcpy((char*)attr->resident_end + 2*namelength,
1689 attr->instance = record->next_attr_instance;
1710 const ATTR_RECORD *attr;
1733 attr = (const ATTR_RECORD*)((const char*)record + k);
1734 while (((k + sizeof(attr->type)) <= length)
1735 && (attr->type != AT_END)
1736 && valid_type(attr->type)) {
1737 k += le32_to_cpu(attr->length);
1738 attr = (const ATTR_RECORD*)((const char*)record + k);
1741 ok = ((k + sizeof(attr->type)) <= length)
1742 && (attr->type == AT_END);
1928 ATTR_RECORD *attr;
1951 attr = (ATTR_RECORD*)(buffer
1953 index = (INDEX_ROOT*)(((char*)attr)
1954 + le16_to_cpu(attr->value_offset));
1959 if ((attr->type == AT_INDEX_ROOT)
1971 resize_attribute(entry, attr, index, length, length);
2219 ATTR_RECORD *attr;
2243 attr = (ATTR_RECORD*)(buffer
2245 index = (INDEX_ROOT*)(((char*)attr)
2246 + le16_to_cpu(attr->value_offset));
2251 if ((attr->type == AT_INDEX_ROOT)
2265 resize_attribute(entry, attr, index, -length, -length);
2474 ATTR_RECORD *attr;
2505 attr = (ATTR_RECORD*)(buffer
2507 if (!attr->non_resident) {
2508 printf("** Error : update_mapping on resident attr\n");
2510 if (valid_type(attr->type)
2511 && attr->non_resident
2531 alen = le32_to_cpu(attr->length) + resize;
2532 attr->length = cpu_to_le32(alen);
2538 err = adjust_high_vcn(vol, attr);
2999 ATTR_RECORD *attr;
3022 attr = (ATTR_RECORD*)(buffer
3024 index = (INDEX_ROOT*)(((char*)attr)
3025 + le16_to_cpu(attr->value_offset));
3030 if ((attr->type == AT_INDEX_ROOT)
3041 resize_attribute(entry, attr, index, -length, -length);
3173 ATTR_RECORD *attr;
3196 attr = (ATTR_RECORD*)(buffer
3198 index = (INDEX_ROOT*)(((char*)attr)
3199 + le16_to_cpu(attr->value_offset));
3200 if (attr->type != AT_INDEX_ROOT) {
3201 printf("** Unexpected attr type 0x%lx\n",
3202 (long)le32_to_cpu(attr->type));
3212 if ((attr->type == AT_INDEX_ROOT)
3225 resize_attribute(entry, attr, index, length, length);
3442 // TODO Only process is attr is not older ?
3444 /* check whether the redo attr matches what we have in store */
3480 ATTR_RECORD *attr;
3502 attr = (ATTR_RECORD*)(buffer + offs);
3503 if (attr->type != AT_INDEX_ALLOCATION) {
3613 ATTR_RECORD *attr;
3645 attr = (ATTR_RECORD*)(buffer
3647 if (!attr->non_resident) {
3648 printf("** Error : update_mapping on resident attr\n");
3650 if (valid_type(attr->type)
3651 && attr->non_resident
3671 alen = le32_to_cpu(attr->length) + resize;
3672 attr->length = cpu_to_le32(alen);
3678 err = adjust_high_vcn(vol, attr);