Lines Matching refs:attr

38 	struct ATTRIB *attr;  in mi_new_attt_id()  local
52 attr = NULL; in mi_new_attt_id()
55 attr = mi_enum_attr(mi, attr); in mi_new_attt_id()
56 if (!attr) { in mi_new_attt_id()
62 t16 = le16_to_cpu(attr->id); in mi_new_attt_id()
65 attr = NULL; in mi_new_attt_id()
198 struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr) in mi_enum_attr() argument
206 if (!attr) { in mi_enum_attr()
224 attr = Add2Ptr(rec, off); in mi_enum_attr()
230 off = PtrOffset(rec, attr); in mi_enum_attr()
232 asize = le32_to_cpu(attr->size); in mi_enum_attr()
234 prev_type = le32_to_cpu(attr->type); in mi_enum_attr()
235 attr = Add2Ptr(attr, asize); in mi_enum_attr()
246 if (attr->type == ATTR_END) { in mi_enum_attr()
252 t32 = le32_to_cpu(attr->type); in mi_enum_attr()
260 asize = le32_to_cpu(attr->size); in mi_enum_attr()
267 if (!attr->non_res) { in mi_enum_attr()
272 t16 = le16_to_cpu(attr->res.data_off); in mi_enum_attr()
276 if (le32_to_cpu(attr->res.data_size) > asize - t16) in mi_enum_attr()
279 t32 = sizeof(short) * attr->name_len; in mi_enum_attr()
280 if (t32 && le16_to_cpu(attr->name_off) + t32 > t16) in mi_enum_attr()
283 return attr; in mi_enum_attr()
287 if (attr->non_res != 1) in mi_enum_attr()
294 t16 = le16_to_cpu(attr->nres.run_off); in mi_enum_attr()
298 t32 = sizeof(short) * attr->name_len; in mi_enum_attr()
299 if (t32 && le16_to_cpu(attr->name_off) + t32 > t16) in mi_enum_attr()
303 if (le64_to_cpu(attr->nres.svcn) > le64_to_cpu(attr->nres.evcn) + 1) in mi_enum_attr()
306 data_size = le64_to_cpu(attr->nres.data_size); in mi_enum_attr()
307 if (le64_to_cpu(attr->nres.valid_size) > data_size) in mi_enum_attr()
310 alloc_size = le64_to_cpu(attr->nres.alloc_size); in mi_enum_attr()
318 if (!attr->nres.svcn && is_attr_ext(attr)) { in mi_enum_attr()
324 tot_size = le64_to_cpu(attr->nres.total_size); in mi_enum_attr()
331 if (attr->nres.c_unit) in mi_enum_attr()
338 return attr; in mi_enum_attr()
344 struct ATTRIB *mi_find_attr(struct mft_inode *mi, struct ATTRIB *attr, in mi_find_attr() argument
352 attr = mi_enum_attr(mi, attr); in mi_find_attr()
353 if (!attr) in mi_find_attr()
356 atype = le32_to_cpu(attr->type); in mi_find_attr()
363 if (attr->name_len != name_len) in mi_find_attr()
366 if (name_len && memcmp(attr_name(attr), name, name_len * sizeof(short))) in mi_find_attr()
369 if (id && *id != attr->id) in mi_find_attr()
372 return attr; in mi_find_attr()
465 struct ATTRIB *attr; in mi_insert_attr() local
480 attr = NULL; in mi_insert_attr()
481 while ((attr = mi_enum_attr(mi, attr))) { in mi_insert_attr()
482 int diff = compare_attr(attr, type, name, name_len, upcase); in mi_insert_attr()
487 if (!diff && !is_attr_indexed(attr)) in mi_insert_attr()
492 if (!attr) { in mi_insert_attr()
495 attr = Add2Ptr(rec, used - 8); in mi_insert_attr()
498 tail = used - PtrOffset(rec, attr); in mi_insert_attr()
503 memmove(Add2Ptr(attr, asize), attr, tail); in mi_insert_attr()
504 memset(attr, 0, asize); in mi_insert_attr()
506 attr->type = type; in mi_insert_attr()
507 attr->size = cpu_to_le32(asize); in mi_insert_attr()
508 attr->name_len = name_len; in mi_insert_attr()
509 attr->name_off = cpu_to_le16(name_off); in mi_insert_attr()
510 attr->id = id; in mi_insert_attr()
512 memmove(Add2Ptr(attr, name_off), name, name_len * sizeof(short)); in mi_insert_attr()
517 return attr; in mi_insert_attr()
526 struct ATTRIB *attr) in mi_remove_attr() argument
529 u32 aoff = PtrOffset(rec, attr); in mi_remove_attr()
531 u32 asize = le32_to_cpu(attr->size); in mi_remove_attr()
536 if (ni && is_attr_indexed(attr) && attr->type == ATTR_NAME) { in mi_remove_attr()
547 memmove(attr, Add2Ptr(attr, asize), used - aoff); in mi_remove_attr()
555 bool mi_resize_attr(struct mft_inode *mi, struct ATTRIB *attr, int bytes) in mi_resize_attr() argument
558 u32 aoff = PtrOffset(rec, attr); in mi_resize_attr()
560 u32 nsize, asize = le32_to_cpu(attr->size); in mi_resize_attr()
561 u32 rsize = le32_to_cpu(attr->res.data_size); in mi_resize_attr()
573 next = Add2Ptr(attr, asize); in mi_resize_attr()
596 attr->size = cpu_to_le32(nsize); in mi_resize_attr()
597 if (!attr->non_res) in mi_resize_attr()
598 attr->res.data_size = cpu_to_le32(rsize); in mi_resize_attr()
608 int mi_pack_runs(struct mft_inode *mi, struct ATTRIB *attr, in mi_pack_runs() argument
616 CLST svcn = le64_to_cpu(attr->nres.svcn); in mi_pack_runs()
618 u32 aoff = PtrOffset(rec, attr); in mi_pack_runs()
619 u32 asize = le32_to_cpu(attr->size); in mi_pack_runs()
620 char *next = Add2Ptr(attr, asize); in mi_pack_runs()
621 u16 run_off = le16_to_cpu(attr->nres.run_off); in mi_pack_runs()
630 err = run_pack(run, svcn, len, Add2Ptr(attr, run_off), run_size + dsize, in mi_pack_runs()
641 attr->size = cpu_to_le32(asize + new_run_size - run_size); in mi_pack_runs()
642 attr->nres.evcn = cpu_to_le64(svcn + plen - 1); in mi_pack_runs()