Lines Matching refs:attr

162 		ntfs_u8 *attr)  in ntfs_insert_mft_attribute()  argument
191 if (NTFS_GETU32(attr) == -1) { in ntfs_insert_mft_attribute()
196 error = ntfs_insert_attribute(ino, attr); in ntfs_insert_mft_attribute()
206 ntfs_u8 *mft, *attr; in parse_attributes() local
212 if (!ino->attr) { in parse_attributes()
248 attr = ntfs_find_attr_in_mft_rec( in parse_attributes()
251 ino->attr: /* base record */ in parse_attributes()
259 if (!attr) { in parse_attributes()
265 error = ntfs_insert_mft_attribute(ino, mftno, attr); in parse_attributes()
345 ino->attr: /* base record */ in parse_attributes()
388 if (ntfs_insert_mft_attributes(ino, ino->attr, ino->i_number)) in ntfs_load_attributes()
448 ino->attr = buf = ntfs_malloc(vol->mft_record_size); in ntfs_init_inode()
451 error = ntfs_read_mft_record(vol, inum, ino->attr); in ntfs_init_inode()
470 if (!ino->attr) { in ntfs_clear_inode()
474 ntfs_free(ino->attr); in ntfs_clear_inode()
475 ino->attr = 0; in ntfs_clear_inode()
505 *result = NTFS_GETU16(ino->attr + 0x28); in ntfs_allocate_attr_number()
506 NTFS_PUTU16(ino->attr + 0x28, (*result) + 1); in ntfs_allocate_attr_number()
512 char *ntfs_get_attr(ntfs_inode *ino, int attr, char *name) in ntfs_get_attr() argument
515 char *it = ino->attr + NTFS_GETU16(ino->attr + 0x14); in ntfs_get_attr()
520 if (!IS_MFT_RECORD(ino->attr)) in ntfs_get_attr()
526 if (type == attr) { in ntfs_get_attr()
552 ntfs_attribute *attr = ntfs_find_attr(ino, type, name); in ntfs_get_attr_size() local
553 if (!attr) in ntfs_get_attr_size()
556 attr->size; in ntfs_get_attr_size()
561 ntfs_attribute *attr = ntfs_find_attr(ino, type, name); in ntfs_attr_is_resident() local
562 if (!attr) in ntfs_attr_is_resident()
564 return attr->resident; in ntfs_attr_is_resident()
667 int ntfs_readwrite_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset, in ntfs_readwrite_attr() argument
678 attr->type); in ntfs_readwrite_attr()
684 if (offset >= attr->size) { in ntfs_readwrite_attr()
690 if (offset + l >= attr->size) in ntfs_readwrite_attr()
691 l = dest->size = attr->size - offset; in ntfs_readwrite_attr()
697 if ((!attr->resident && offset + l > attr->allocated) || in ntfs_readwrite_attr()
698 (attr->resident && offset + l > attr->size)) { in ntfs_readwrite_attr()
699 error = ntfs_resize_attr(ino, attr, offset + l); in ntfs_readwrite_attr()
703 if (!attr->resident) { in ntfs_readwrite_attr()
705 if (offset + l > attr->size) in ntfs_readwrite_attr()
706 attr->size = offset + l; in ntfs_readwrite_attr()
708 if (offset + l > attr->initialized) { in ntfs_readwrite_attr()
712 attr->initialized = offset + l; in ntfs_readwrite_attr()
716 if (attr->resident) { in ntfs_readwrite_attr()
718 dest->fn_put(dest, (ntfs_u8*)attr->d.data + offset, l); in ntfs_readwrite_attr()
720 dest->fn_get((ntfs_u8*)attr->d.data + offset, dest, l); in ntfs_readwrite_attr()
726 if (offset >= attr->initialized) in ntfs_readwrite_attr()
728 if (offset + l > attr->initialized) { in ntfs_readwrite_attr()
729 dest->size = chunk = attr->initialized - offset; in ntfs_readwrite_attr()
730 error = ntfs_readwrite_attr(ino, attr, offset, dest); in ntfs_readwrite_attr()
736 if (attr->flags & ATTR_IS_COMPRESSED) in ntfs_readwrite_attr()
737 return ntfs_read_compressed(ino, attr, offset, dest); in ntfs_readwrite_attr()
739 if (attr->flags & ATTR_IS_COMPRESSED) in ntfs_readwrite_attr()
740 return ntfs_write_compressed(ino, attr, offset, dest); in ntfs_readwrite_attr()
745 for (rnum = 0; rnum < attr->d.r.len && in ntfs_readwrite_attr()
746 vcn + attr->d.r.runlist[rnum].len <= s_vcn; rnum++) in ntfs_readwrite_attr()
747 vcn += attr->d.r.runlist[rnum].len; in ntfs_readwrite_attr()
748 if (rnum == attr->d.r.len) { in ntfs_readwrite_attr()
753 dump_runlist(attr->d.r.runlist, attr->d.r.len); in ntfs_readwrite_attr()
760 cluster = attr->d.r.runlist[rnum].lcn; in ntfs_readwrite_attr()
761 len = attr->d.r.runlist[rnum].len; in ntfs_readwrite_attr()
780 cluster = attr->d.r.runlist[rnum].lcn; in ntfs_readwrite_attr()
781 len = attr->d.r.runlist[rnum].len; in ntfs_readwrite_attr()
791 ntfs_attribute *attr; in ntfs_read_attr() local
794 attr = ntfs_find_attr(ino, type, name); in ntfs_read_attr()
795 if (!attr) { in ntfs_read_attr()
800 return ntfs_readwrite_attr(ino, attr, offset, buf); in ntfs_read_attr()
806 ntfs_attribute *attr; in ntfs_write_attr() local
809 attr = ntfs_find_attr(ino, type, name); in ntfs_write_attr()
810 if (!attr) { in ntfs_write_attr()
815 return ntfs_readwrite_attr(ino, attr, offset, buf); in ntfs_write_attr()
892 static int layout_runs(ntfs_attribute *attr, char *rec, int *offs, int size) in layout_runs() argument
897 ntfs_runlist *rl = attr->d.r.runlist; in layout_runs()
900 for (i = 0; i < attr->d.r.len; i++) { in layout_runs()
998 static void count_runs(ntfs_attribute *attr, char *buf) in count_runs() argument
1003 for (i = 0, count = 0; i < attr->d.r.len; i++) in count_runs()
1004 count += attr->d.r.runlist[i].len; in count_runs()
1023 static int layout_attr(ntfs_attribute *attr, char *buf, int size, int *psize) in layout_attr() argument
1027 if (attr->resident) { in layout_attr()
1029 hdrsize = (nameoff + 2 * attr->namelen + 7) & ~7; in layout_attr()
1030 asize = (hdrsize + attr->size + 7) & ~7; in layout_attr()
1033 NTFS_PUTU32(buf + 0x10, attr->size); in layout_attr()
1034 NTFS_PUTU8(buf + 0x16, attr->indexed); in layout_attr()
1036 if (attr->size) in layout_attr()
1037 ntfs_memcpy(buf + hdrsize, attr->d.data, attr->size); in layout_attr()
1041 if (attr->flags & ATTR_IS_COMPRESSED) in layout_attr()
1045 hdrsize = (nameoff + 2 * attr->namelen + 7) & ~7; in layout_attr()
1051 error = layout_runs(attr, buf, &asize, size); in layout_attr()
1059 count_runs(attr, buf); in layout_attr()
1061 NTFS_PUTU16(buf + 0x22, attr->cengine); in layout_attr()
1063 NTFS_PUTS64(buf + 0x28, attr->allocated); in layout_attr()
1064 NTFS_PUTS64(buf + 0x30, attr->size); in layout_attr()
1065 NTFS_PUTS64(buf + 0x38, attr->initialized); in layout_attr()
1066 if (attr->flags & ATTR_IS_COMPRESSED) in layout_attr()
1067 NTFS_PUTS64(buf + 0x40, attr->compsize); in layout_attr()
1069 NTFS_PUTU32(buf, attr->type); in layout_attr()
1071 NTFS_PUTU8(buf + 8, attr->resident ? 0 : 1); in layout_attr()
1072 NTFS_PUTU8(buf + 9, attr->namelen); in layout_attr()
1074 NTFS_PUTU16(buf + 0xc, attr->flags); in layout_attr()
1075 NTFS_PUTU16(buf + 0xe, attr->attrno); in layout_attr()
1076 if (attr->namelen) in layout_attr()
1077 ntfs_memcpy(buf + nameoff, attr->name, 2 * attr->namelen); in layout_attr()
1100 ntfs_attribute *attr; in layout_inode() local
1126 offset = NTFS_GETU16(ino->attr + 0x14); /* attrs_offset */ in layout_inode()
1127 ntfs_memcpy(rec, ino->attr, offset); in layout_inode()
1130 attr = ino->attrs + i; in layout_inode()
1131 error = layout_attr(attr, rec + offset, in layout_inode()
1133 if (error == -E2BIG && offset != NTFS_GETU16(ino->attr in layout_inode()
2208 ntfs_attribute* attr; in add_security() local
2212 attr = ntfs_find_attr(dir, ino->vol->at_security_descriptor, 0); in add_security()
2213 if (!attr) in add_security()
2215 size = attr->size; in add_security()
2290 result->attr = ntfs_calloc(vol->mft_record_size); in ntfs_alloc_inode()
2291 if (!result->attr) { in ntfs_alloc_inode()
2296 ntfs_fill_mft_header(result->attr, vol->mft_record_size, in ntfs_alloc_inode()
2308 result->attr = NULL; in ntfs_alloc_inode()