Lines Matching refs:ni
89 return (na->ni->flags & flag);
96 na->ni->flags |= flag;
105 na->ni->flags &= ~flag;
326 * @ni: ntfs inode with which to initialize the ntfs attribute
331 * Initialize the ntfs attribute @na with @ni, @type, @name, and @name_len.
333 static void __ntfs_attr_init(ntfs_attr *na, ntfs_inode *ni,
337 na->ni = ni;
382 ntfs_volume *vol = na->ni->vol;
397 * @ni: open ntfs inode in which the ntfs attribute resides
402 * Allocate a new ntfs attribute structure, initialize it with @ni, @type,
410 ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
420 (unsigned long long)ni->mft_no, le32_to_cpu(type));
422 if (!ni || !ni->vol || !ni->mrec) {
435 " of inode %lld\n",(long long)ni->mft_no);
444 ctx = ntfs_attr_get_search_ctx(ni, NULL);
464 (long long)ni->mft_no);
478 __ntfs_attr_init(na, ni, type, name, name_len);
502 if ((ni->flags & FILE_ATTR_COMPRESSED)
503 && (ni->vol->major_ver >= 3)
504 && NVolCompression(ni->vol)
505 && (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE))
517 "(0x%x <> 0x%x)",(unsigned long long)ni->mft_no,
518 le16_to_cpu(a->flags), le32_to_cpu(na->ni->flags));
525 && (ni->vol->major_ver < 3)) {
529 (unsigned long long)ni->mft_no,
530 ni->vol->major_ver,
531 ni->vol->major_ver);
539 (unsigned long long)ni->mft_no, le32_to_cpu(type));
548 (unsigned long long)ni->mft_no,
617 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type), (long long)vcn);
623 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
633 rl = ntfs_mapping_pairs_decompress(na->ni->vol, ctx->attr,
670 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
675 last_vcn = na->allocated_size >> na->ni->vol->cluster_size_bits;
692 rl = ntfs_mapping_pairs_decompress(na->ni->vol,
754 ntfs_volume *vol = na->ni->vol;
760 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type));
767 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
789 rl = ntfs_mapping_pairs_decompress(na->ni->vol,
802 (unsigned long long)na->ni->mft_no);
824 (unsigned long long)na->ni->mft_no);
842 (unsigned long long)na->ni->mft_no,
887 long)na->ni->mft_no, le32_to_cpu(na->type));
939 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
1013 vol = na->ni->vol;
1028 if (na->ni->vol->efs_raw
1048 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
1086 if (na->ni->vol->efs_raw &&
1222 if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
1231 "%lld\n", (unsigned long long)na->ni->mft_no,
1263 vol = na->ni->vol;
1306 ntfs_volume *vol = na->ni->vol;
1312 if (na->ni->mft_no == FILE_Bitmap) {
1521 int cluster_size_bits = na->ni->vol->cluster_size_bits;
1683 int cluster_size_bits = na->ni->vol->cluster_size_bits;
1748 (long long)na->ni->mft_no,
1867 vol = na->ni->vol;
1966 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
2049 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
2082 if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY
2085 na->ni->data_size = na->data_size;
2088 na->ni->allocated_size = na->compressed_size;
2090 na->ni->allocated_size = na->allocated_size;
2091 set_nino_flag(na->ni,KnownSize);
2350 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
2399 "0x%llx.\n", (long long)na->ni->mft_no, le32_to_cpu(na->type),
2403 if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
2440 (unsigned long long)na->ni->mft_no,
2443 if (!na || !na->ni || !na->ni->vol) {
2448 vol = na->ni->vol;
2470 (long long)na->ni->mft_no);
2571 if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY
2574 na->ni->data_size = na->data_size;
2575 na->ni->allocated_size = na->compressed_size;
2576 set_nino_flag(na->ni,KnownSize);
2660 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
2672 warn = !na->ni || !na->ni->vol || !NVolNoFixupWarn(na->ni->vol);
2716 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
3068 ntfs_inode *base_ni, *ni;
3079 ni = ctx->ntfs_ino;
3082 (unsigned long long)ni->mft_no, le32_to_cpu(type));
3088 if (ni == base_ni)
3269 if (MREF_LE(al_entry->mft_reference) == ni->mft_no) {
3272 ni->mrec->sequence_number)) {
3281 ni = ctx->ntfs_ino = base_ni;
3291 ni = ntfs_extent_inode_open(base_ni,
3293 if (!ni)
3295 ctx->ntfs_ino = ni;
3296 ctx->mrec = ni->mrec;
3365 if (ni != base_ni) {
3741 * @ni: ntfs inode with which to initialize the search context
3744 * Initialize the attribute search context @ctx with @ni and @mrec.
3747 ntfs_inode *ni, MFT_RECORD *mrec)
3750 mrec = ni->mrec;
3755 ctx->ntfs_ino = ni;
3792 * @ni: ntfs inode with which to initialize the search context
3795 * Allocate a new attribute search context, initialize it with @ni and @mrec,
3798 * @mrec can be NULL, in which case the mft record is taken from @ni.
3800 * Note: For low level utilities which know what they are doing we allow @ni to
3804 ntfs_attr_search_ctx *ntfs_attr_get_search_ctx(ntfs_inode *ni, MFT_RECORD *mrec)
3808 if (!ni && !mrec) {
3815 ntfs_attr_init_search_ctx(ctx, ni, mrec);
4082 * @ni: opened ntfs inode to which MFT record add attribute
4097 int ntfs_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
4109 (long long) ni->mft_no, (unsigned) le32_to_cpu(type), (unsigned) le16_to_cpu(data_flags));
4111 if (!ni || (!name && name_len)) {
4116 if (ntfs_attr_can_be_resident(ni->vol, type)) {
4125 ctx = ntfs_attr_get_search_ctx(ni, NULL);
4130 * attribute in @ni->mrec, not any extent inode in case if @ni is base
4182 if (ni->nr_extents == -1)
4183 base_ni = ni->base_ni;
4185 base_ni = ni;
4187 if (ntfs_attrlist_entry_add(ni, a)) {
4195 if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY
4198 ni->data_size = size;
4199 ni->allocated_size = (size + 7) & ~7;
4200 set_nino_flag(ni,KnownSize);
4202 ntfs_inode_mark_dirty(ni);
4213 * @ni: opened ntfs inode to which MFT record add attribute
4229 int ntfs_non_resident_attr_record_add(ntfs_inode *ni, ATTR_TYPES type,
4242 (long long) ni->mft_no, (unsigned) le32_to_cpu(type),
4245 if (!ni || dataruns_size <= 0 || (!name && name_len)) {
4250 if (ntfs_attr_can_be_non_resident(ni->vol, type, name, name_len)) {
4259 ctx = ntfs_attr_get_search_ctx(ni, NULL);
4264 * attribute in @ni->mrec, not any extent inode in case if @ni is base
4321 if (ni->nr_extents == -1)
4322 base_ni = ni->base_ni;
4324 base_ni = ni;
4326 if (ntfs_attrlist_entry_add(ni, a)) {
4333 ntfs_inode_mark_dirty(ni);
4370 ntfs_inode *base_ni, *ni;
4382 ni = ctx->ntfs_ino;
4393 if (ntfs_attrlist_entry_add(ni, ctx->attr))
4399 ntfs_inode_mark_dirty(ni);
4425 if (ntfs_mft_record_free(ni->vol, ni)) {
4432 if (ni == base_ni)
4488 * @ni: opened ntfs inode to which add attribute
4512 int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
4523 if (!ni || size < 0 || type == AT_ATTRIBUTE_LIST) {
4525 ntfs_log_perror("%s: ni=%p size=%lld", __FUNCTION__, ni,
4531 (long long)ni->mft_no, le32_to_cpu(type), (long long)size);
4533 if (ni->nr_extents == -1)
4534 ni = ni->base_ni;
4537 if (ntfs_attr_size_bounds_check(ni->vol, type, size)) {
4544 if (ntfs_attr_can_be_non_resident(ni->vol, type, name, name_len)) {
4557 if (size > ni->vol->mft_record_size) {
4569 if (!ntfs_attr_can_be_resident(ni->vol, type)) {
4592 if (le32_to_cpu(ni->mrec->bytes_allocated) -
4593 le32_to_cpu(ni->mrec->bytes_in_use) >= attr_rec_size) {
4594 attr_ni = ni;
4599 if (ntfs_inode_attach_all_extents(ni)) {
4604 for (i = 0; i < ni->nr_extents; i++) {
4605 attr_ni = ni->extent_nis[i];
4613 if (!NInoAttrList(ni)) {
4615 if (ntfs_inode_add_attrlist(ni)) {
4620 return ntfs_attr_add(ni, type, name, name_len, val, size);
4623 attr_ni = ntfs_mft_record_alloc(ni->vol, ni);
4631 if ((ni->flags & FILE_ATTR_COMPRESSED)
4632 && (ni->vol->major_ver >= 3)
4633 && NVolCompression(ni->vol)
4634 && (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
4669 na = ntfs_attr_open(ni, type, name, name_len);
4708 int ntfs_attr_set_flags(ntfs_inode *ni, ATTR_TYPES type, const ntfschar *name,
4716 ctx = ntfs_attr_get_search_ctx(ni, NULL);
4723 NInoSetDirty(ni);
4753 (long long) na->ni->mft_no, le32_to_cpu(na->type));
4759 if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) {
4767 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
4911 * @ni: opened ntfs inode to which move attribute record
4918 int ntfs_attr_record_move_to(ntfs_attr_search_ctx *ctx, ntfs_inode *ni)
4924 if (!ctx || !ctx->attr || !ctx->ntfs_ino || !ni) {
4931 "0x%llx, ni->mft_no 0x%llx.\n",
4934 (long long) ni->mft_no);
4936 if (ctx->ntfs_ino == ni)
4948 nctx = ntfs_attr_get_search_ctx(ni, NULL);
4954 * attribute in @ni->mrec, not any extent inode in case if @ni is base
4972 if (ntfs_make_room_for_attr(ni->mrec, (u8*) nctx->attr,
4984 ntfs_inode_mark_dirty(ni);
4988 MK_LE_MREF(ni->mft_no, le16_to_cpu(ni->mrec->sequence_number));
4990 ntfs_attrlist_mark_dirty(ni);
5015 ntfs_inode *base_ni, *ni;
5050 ni = base_ni->extent_nis[i];
5051 m = ni->mrec;
5053 if (ctx->ntfs_ino->mft_no == ni->mft_no)
5066 if (!ntfs_attr_record_move_to(ctx, ni))
5074 ni = ntfs_mft_record_alloc(base_ni->vol, base_ni);
5075 if (!ni) {
5079 if (ntfs_attr_record_move_to(ctx, ni)) {
5109 ntfs_volume *vol = na->ni->vol;
5115 long)na->ni->mft_no, le32_to_cpu(na->type));
5192 if (na->ni->flags & FILE_ATTR_COMPRESSED)
5305 ntfs_inode *ni;
5309 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
5313 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
5322 vol = na->ni->vol;
5349 if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY
5352 na->ni->data_size = na->data_size;
5356 na->ni->allocated_size
5359 na->ni->allocated_size
5361 set_nino_flag(na->ni,KnownSize);
5363 NInoFileNameSetDirty(na->ni);
5403 ntfs_attr_init_search_ctx(ctx, NULL, na->ni->mrec);
5421 tna = ntfs_attr_open(na->ni, a->type, (ntfschar*)((u8*)a +
5438 tna->ni->allocated_size = tna->allocated_size;
5439 NInoFileNameSetDirty(tna->ni);
5448 ntfs_inode_mark_dirty(tna->ni);
5466 if (!NInoAttrList(na->ni) && ntfs_inode_add_attrlist(na->ni)) {
5470 if (ntfs_inode_free_space(na->ni, offsetof(ATTR_RECORD,
5484 ntfs_attr_init_search_ctx(ctx, na->ni, NULL);
5506 if (na->ni->nr_extents == -1)
5507 ni = na->ni->base_ni;
5509 ni = na->ni;
5510 if (!NInoAttrList(ni)) {
5512 if (ntfs_inode_add_attrlist(ni))
5517 ni = ntfs_mft_record_alloc(vol, ni);
5518 if (!ni) {
5524 if (ntfs_attr_record_move_to(ctx, ni)) {
5530 if (na->ni->nr_extents == -1)
5531 na->ni = ni;
5610 ntfs_volume *vol = na->ni->vol;
5616 long)na->ni->mft_no, le32_to_cpu(na->type));
5635 if (na->type == AT_BITMAP && na->ni->mft_no == FILE_MFT) {
5699 && (na->ni->vol->major_ver >= 3)
5700 && NVolCompression(na->ni->vol)
5701 && (na->ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
5702 && (na->ni->flags & FILE_ATTR_COMPRESSED)) {
5778 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type));
5810 if (!NInoAttrList(na->ni)) {
5812 if (ntfs_inode_add_attrlist(na->ni))
5871 new_compr_size = ntfs_rl_get_compressed_size(na->ni->vol, na->rl);
5884 na->ni->allocated_size = na->compressed_size;
5886 na->ni->allocated_size = na->allocated_size;
5887 NInoFileNameSetDirty(na->ni);
5904 ntfs_inode *ni, *base_ni;
5921 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type));
5977 | (na->ni->vol->cluster_size - 1)) + 1)
5990 if (na->ni->nr_extents == -1)
5991 base_ni = na->ni->base_ni;
5993 base_ni = na->ni;
6071 mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, stop_rl,
6086 if (ntfs_inode_free_space(na->ni, mp_size -
6139 if (!ntfs_mapping_pairs_build(na->ni->vol, (u8*)a + le16_to_cpu(
6178 na->ni->allocated_size
6182 NInoFileNameSetDirty(na->ni);
6220 mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol,
6227 if (!na->ni->mft_no)
6228 ni = ntfs_mft_rec_alloc(na->ni->vol,
6231 ni = ntfs_mft_record_alloc(na->ni->vol, base_ni);
6232 if (!ni) {
6236 m = ni->mrec;
6251 err = ntfs_non_resident_attr_record_add(ni, na->type,
6257 if (ntfs_mft_record_free(na->ni->vol, ni))
6264 err = ntfs_mapping_pairs_build(na->ni->vol, (u8*)a +
6274 if (ntfs_mft_record_free(na->ni->vol, ni))
6280 ntfs_inode_mark_dirty(ni);
6353 na->ni->mft_no, le32_to_cpu(na->type), (long long)newsize);
6355 vol = na->ni->vol;
6428 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
6450 if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
6452 na->ni->data_size = na->data_size;
6453 na->ni->allocated_size = na->allocated_size;
6454 set_nino_flag(na->ni,KnownSize);
6458 na->ni->data_size = na->data_size;
6459 NInoFileNameSetDirty(na->ni);
6511 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
6514 vol = na->ni->vol;
6655 ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
6682 if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
6684 na->ni->data_size = na->data_size;
6685 na->ni->allocated_size = na->allocated_size;
6686 set_nino_flag(na->ni,KnownSize);
6690 na->ni->data_size = na->data_size;
6691 NInoFileNameSetDirty(na->ni);
6775 (na->ni->mft_no == FILE_MFT && na->type == AT_DATA)) {
6782 (unsigned long long)na->ni->mft_no, le32_to_cpu(na->type),
6794 if ((na->data_flags & ATTR_IS_ENCRYPTED) && !na->ni->vol->efs_raw) {
6956 * @ni: open ntfs inode in which the ntfs attribute resides
6973 void *ntfs_attr_readall(ntfs_inode *ni, const ATTR_TYPES type,
6982 na = ntfs_attr_open(ni, type, name, name_len);
6985 (long long)ni->mft_no,(long)le32_to_cpu(type));
6996 (u64)((ni->vol->nr_clusters + 7) >> 3)))) {
6998 (long)le32_to_cpu(type),(long long)ni->mft_no);
7028 int ntfs_attr_data_read(ntfs_inode *ni,
7035 na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
7073 int ntfs_attr_data_write(ntfs_inode *ni, ntfschar *stream_name,
7079 na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
7116 int ntfs_attr_shrink_size(ntfs_inode *ni, ntfschar *stream_name,
7124 ctx = ntfs_attr_get_search_ctx(ni, NULL);
7142 int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, const ntfschar *name,
7150 ctx = ntfs_attr_get_search_ctx(ni, NULL);
7162 int ntfs_attr_remove(ntfs_inode *ni, const ATTR_TYPES type, ntfschar *name,
7170 if (!ni) {
7176 na = ntfs_attr_open(ni, type, name, name_len);
7181 "0x%llx", le32_to_cpu(type), (unsigned long long)ni->mft_no);
7189 "0x%llx", le32_to_cpu(type), (unsigned long long)ni->mft_no);