Lines Matching refs:vol

140  * @vol:	
148 s64 ntfs_get_attribute_value(const ntfs_volume *vol,
156 if (!vol || !a || !b) {
198 rl = ntfs_mapping_pairs_decompress(vol, a, NULL);
216 if (total + (rl[i].length << vol->cluster_size_bits) >=
226 * rl[i].length << vol->cluster_size_bits, do the
239 + vol->cluster_size - 1)
240 >> vol->cluster_size_bits;
244 << vol->cluster_size_bits);
260 r = ntfs_pread(vol->dev,
261 rl[i].lcn << vol->cluster_size_bits,
262 intlth << vol->cluster_size_bits,
264 if (r != intlth << vol->cluster_size_bits) {
269 vol->cluster_size_bits) {
297 r = ntfs_pread(vol->dev, rl[i].lcn << vol->cluster_size_bits,
298 rl[i].length << vol->cluster_size_bits,
300 if (r != rl[i].length << vol->cluster_size_bits) {
304 else if (r < rl[i].length << vol->cluster_size_bits) {
382 ntfs_volume *vol = na->ni->vol;
387 vol->cluster_size_bits);
422 if (!ni || !ni->vol || !ni->mrec) {
503 && (ni->vol->major_ver >= 3)
504 && NVolCompression(ni->vol)
505 && (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE))
525 && (ni->vol->major_ver < 3)) {
530 ni->vol->major_ver,
531 ni->vol->major_ver);
633 rl = ntfs_mapping_pairs_decompress(na->ni->vol, ctx->attr,
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;
789 rl = ntfs_mapping_pairs_decompress(na->ni->vol,
807 vol->cluster_size_bits;
992 ntfs_volume *vol;
1013 vol = na->ni->vol;
1014 if (!vol->efs_raw && NAttrEncrypted(na) && NAttrNonResident(na)) {
1028 if (na->ni->vol->efs_raw
1060 (char*)ctx->mrec + vol->mft_record_size) {
1086 if (na->ni->vol->efs_raw &&
1108 rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits);
1126 ofs = pos - (rl->vcn << vol->cluster_size_bits);
1139 ofs = pos + total - (rl->vcn << vol->cluster_size_bits);
1155 vol->cluster_size_bits) - ofs);
1164 to_read = min(count, (rl->length << vol->cluster_size_bits) -
1170 br = ntfs_pread(vol->dev, (rl->lcn << vol->cluster_size_bits) +
1222 if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
1246 ntfs_volume *vol;
1263 vol = na->ni->vol;
1266 vol->cluster_size_bits) <= pos)) {
1267 ofsi += (rli->length << vol->cluster_size_bits);
1278 && (ofsi + (rli->length << vol->cluster_size_bits)
1281 + (rli->length << vol->cluster_size_bits));
1284 written = ntfs_rl_pwrite(vol, rli, ofsi, pos,
1306 ntfs_volume *vol = na->ni->vol;
1323 to_write = min(count, ((*rl)->length << vol->cluster_size_bits) - *ofs);
1326 from_vcn = (*rl)->vcn + (*ofs >> vol->cluster_size_bits);
1391 need = ((*ofs + to_write - 1) >> vol->cluster_size_bits)
1418 rlc = ntfs_cluster_alloc(vol, alloc_vcn, need,
1421 rlc = ntfs_cluster_alloc(vol, from_vcn, need,
1426 na->compressed_size += need << vol->cluster_size_bits;
1443 if (ntfs_cluster_free_from_rl(vol, rlc)) {
1477 if (ntfs_attr_fill_zero(na, cur_vcn << vol->cluster_size_bits,
1486 *ofs += (cur_vcn - (*rl)->vcn) << vol->cluster_size_bits;
1492 *ofs -= ((*rl)->vcn - cur_vcn) << vol->cluster_size_bits;
1521 int cluster_size_bits = na->ni->vol->cluster_size_bits;
1683 int cluster_size_bits = na->ni->vol->cluster_size_bits;
1853 ntfs_volume *vol;
1867 vol = na->ni->vol;
1877 && (compressed || !vol->efs_raw)) {
1977 (char*)ctx->mrec + vol->mft_record_size) {
1983 if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
2019 block_begin = pos >> vol->cluster_size_bits;
2021 block_begin = na->initialized_size >> vol->cluster_size_bits;
2068 if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
2076 ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
2105 rl = ntfs_attr_find_vcn(na, pos >> vol->cluster_size_bits);
2176 ofs = pos - (rl->vcn << vol->cluster_size_bits);
2194 ofs = pos + total - (rl->vcn << vol->cluster_size_bits);
2217 && (ofs >= (rl->length << vol->cluster_size_bits))) {
2218 ofs -= rl->length << vol->cluster_size_bits;
2224 to_write = min(count, (rl->length << vol->cluster_size_bits) - ofs);
2229 if (!NVolReadOnly(vol)) {
2231 s64 wpos = (rl->lcn << vol->cluster_size_bits) + ofs;
2232 s64 wend = (rl->vcn << vol->cluster_size_bits) + ofs + to_write;
2233 u32 bsize = vol->cluster_size;
2247 (wend < (hole_end << vol->cluster_size_bits)))){
2266 written = ntfs_pwrite(vol->dev, wpos,
2280 written = ntfs_pwrite(vol->dev, wpos,
2362 err = ntfs_mft_record_write(vol,
2403 if (!na || !na->ni || !na->ni->vol || !b || pos < 0 || count < 0) {
2432 ntfs_volume *vol;
2443 if (!na || !na->ni || !na->ni->vol) {
2448 vol = na->ni->vol;
2485 rl = ntfs_attr_find_vcn(na, (na->initialized_size - 1) >> vol->cluster_size_bits);
2527 ofs = na->initialized_size - (rl->vcn << vol->cluster_size_bits);
2540 ofs = na->initialized_size - (rl->vcn << vol->cluster_size_bits);
2560 && (ofs >= (rl->length << vol->cluster_size_bits))) {
2561 ofs -= rl->length << vol->cluster_size_bits;
2568 if (!NVolReadOnly(vol)) {
2672 warn = !na->ni || !na->ni->vol || !NVolNoFixupWarn(na->ni->vol);
2830 ntfs_volume *vol;
2839 vol = ctx->ntfs_ino->vol;
2840 upcase = vol->upcase;
2841 upcase_len = vol->upcase_len;
2848 vol = NULL;
3069 ntfs_volume *vol;
3092 vol = base_ni->vol;
3235 vol->upcase, vol->upcase_len)))) {
3266 vol->upcase, vol->upcase_len))
3285 if (!vol->mft_na) {
3345 vol->upcase, vol->upcase_len))
3680 ntfs_volume *vol;
3687 (!ctx->ntfs_ino || !(vol = ctx->ntfs_ino->vol) ||
3688 !vol->upcase || !vol->upcase_len))) {
3833 * @vol: ntfs volume to which the attribute belongs
3843 * EINVAL - Invalid parameters (e.g. @vol is not valid).
3845 ATTR_DEF *ntfs_attr_find_in_attrdef(const ntfs_volume *vol,
3850 if (!vol || !vol->attrdef || !type) {
3855 for (ad = vol->attrdef; ((ptrdiff_t)((u8*)ad - (u8*)vol->attrdef
3856 + sizeof(ATTR_DEF)) <= vol->attrdef_len)
3874 * @vol: ntfs volume to which the attribute belongs
3879 * ntfs volume @vol. This information is obtained from $AttrDef system file.
3885 * EINVAL - Invalid parameters (e.g. @size is < 0 or @vol is not valid).
3887 int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
3910 ad = ntfs_attr_find_in_attrdef(vol, type);
3938 * @vol: ntfs volume to which the attribute belongs
3944 * the ntfs volume @vol is allowed to be non-resident. This information is
3953 * EINVAL - Invalid parameters (e.g. @vol is not valid).
3955 static int ntfs_attr_can_be_non_resident(const ntfs_volume *vol, const ATTR_TYPES type,
3972 CASE_SENSITIVE, vol->upcase, vol->upcase_len))
3976 ad = ntfs_attr_find_in_attrdef(vol, type);
3992 * @vol: ntfs volume to which the attribute belongs
3995 * Check whether the attribute of @type on the ntfs volume @vol is allowed to
4005 * EINVAL - Invalid parameters (e.g. @vol is not valid).
4012 int ntfs_attr_can_be_resident(const ntfs_volume *vol, const ATTR_TYPES type)
4014 if (!vol || !vol->attrdef || !type) {
4116 if (ntfs_attr_can_be_resident(ni->vol, type)) {
4250 if (ntfs_attr_can_be_non_resident(ni->vol, type, name, name_len)) {
4425 if (ntfs_mft_record_free(ni->vol, ni)) {
4457 al_rl = ntfs_mapping_pairs_decompress(base_ni->vol,
4464 if (ntfs_cluster_free_from_rl(base_ni->vol, al_rl)) {
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)) {
4623 attr_ni = ntfs_mft_record_alloc(ni->vol, ni);
4632 && (ni->vol->major_ver >= 3)
4633 && NVolCompression(ni->vol)
4634 && (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
4697 if (ntfs_mft_record_free(attr_ni->vol, attr_ni))
4759 if (ntfs_cluster_free(na->ni->vol, na, 0, -1) < 0) {
5074 ni = ntfs_mft_record_alloc(base_ni->vol, base_ni);
5109 ntfs_volume *vol = na->ni->vol;
5126 if (ntfs_attr_can_be_non_resident(vol, na->type, na->name, na->name_len))
5129 new_allocated_size = (le32_to_cpu(a->value_length) + vol->cluster_size
5130 - 1) & ~(vol->cluster_size - 1);
5138 + vol->cluster_size_bits)) - 1)) + 1;
5141 rl = ntfs_cluster_alloc(vol, 0, new_allocated_size >>
5142 vol->cluster_size_bits, -1, DATA_ZONE);
5165 = 1 << (STANDARD_COMPRESSION_UNIT + vol->cluster_size_bits);
5184 mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0, INT_MAX);
5225 vol->cluster_size_bits);
5253 if (ntfs_mapping_pairs_build(vol, (u8*)a + mp_ofs, arec_size - mp_ofs,
5267 if (rl && ntfs_cluster_free(vol, na, 0, -1) < 0)
5304 ntfs_volume *vol;
5322 vol = na->ni->vol;
5327 if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) {
5339 if ((newsize < vol->mft_record_size) && (holes != HOLES_NONRES)) {
5517 ni = ntfs_mft_record_alloc(vol, ni);
5610 ntfs_volume *vol = na->ni->vol;
5641 if (ntfs_attr_can_be_resident(vol, na->type))
5699 && (na->ni->vol->major_ver >= 3)
5700 && NVolCompression(na->ni->vol)
5701 && (na->ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
5722 bytes_read = ntfs_rl_pread(vol, na->rl, 0, na->initialized_size,
5746 if (ntfs_cluster_free(vol, na, 0, -1) < 0) {
5871 new_compr_size = ntfs_rl_get_compressed_size(na->ni->vol, na->rl);
5977 | (na->ni->vol->cluster_size - 1)) + 1)
6071 mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol, stop_rl,
6139 if (!ntfs_mapping_pairs_build(na->ni->vol, (u8*)a + le16_to_cpu(
6220 mp_size = ntfs_get_size_for_mapping_pairs(na->ni->vol,
6228 ni = ntfs_mft_rec_alloc(na->ni->vol,
6231 ni = ntfs_mft_record_alloc(na->ni->vol, base_ni);
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))
6346 ntfs_volume *vol;
6355 vol = na->ni->vol;
6361 if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) {
6380 >> vol->cluster_size_bits;
6382 first_free_vcn = (newsize + vol->cluster_size - 1) >>
6383 vol->cluster_size_bits;
6388 if ((na->allocated_size >> vol->cluster_size_bits) != first_free_vcn) {
6395 nr_freed_clusters = ntfs_cluster_free(vol, na, first_free_vcn,
6417 na->allocated_size = first_free_vcn << vol->cluster_size_bits;
6504 ntfs_volume *vol;
6514 vol = na->ni->vol;
6520 if (ntfs_attr_size_bounds_check(vol, na->type, newsize) < 0) {
6532 first_free_vcn = (newsize + vol->cluster_size - 1) >>
6533 vol->cluster_size_bits;
6538 if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) {
6546 start_update = na->allocated_size >> vol->cluster_size_bits;
6564 if ((na->type == AT_DATA) && (vol->major_ver >= 3)
6571 vol->cluster_size_bits);
6574 (na->allocated_size >> vol->cluster_size_bits);
6604 rl = ntfs_cluster_alloc(vol, na->allocated_size >>
6605 vol->cluster_size_bits, first_free_vcn -
6607 vol->cluster_size_bits), lcn_seek_from,
6614 vol->cluster_size_bits));
6625 ntfs_cluster_free_from_rl(vol, rl);
6634 na->allocated_size = first_free_vcn << vol->cluster_size_bits;
6701 if (ntfs_cluster_free(vol, na, org_alloc_size >>
6702 vol->cluster_size_bits, -1) < 0) {
6708 vol->cluster_size_bits)) {
6722 vol->cluster_size_bits*/)) {
6794 if ((na->data_flags & ATTR_IS_ENCRYPTED) && !na->ni->vol->efs_raw) {
6996 (u64)((ni->vol->nr_clusters + 7) >> 3)))) {