Lines Matching refs:g_vol
193 static ntfs_volume *g_vol = NULL; variable
607 length = rl[i].length * g_vol->cluster_size; in ntfs_rlwrite()
626 if (dev->d_ops->seek(dev, rl[i].lcn * g_vol->cluster_size, in ntfs_rlwrite()
779 end = g_vol->nr_clusters; in allocate_scattered_clusters()
917 ntfschar *upcase = g_vol->upcase; in mkntfs_attr_find()
918 u32 upcase_len = g_vol->upcase_len; in mkntfs_attr_find()
1196 mpa_size = ntfs_get_size_for_mapping_pairs(g_vol, rl, 0, INT_MAX); in insert_positioned_attr_in_mft_record()
1213 if (highest_vcn * g_vol->cluster_size < val_len) { in insert_positioned_attr_in_mft_record()
1260 a->allocated_size = cpu_to_sle64(highest_vcn * g_vol->cluster_size); in insert_positioned_attr_in_mft_record()
1283 bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, in insert_positioned_attr_in_mft_record()
1286 bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, in insert_positioned_attr_in_mft_record()
1293 err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + in insert_positioned_attr_in_mft_record()
1378 g_vol->cluster_size - 1) / g_vol->cluster_size); in insert_non_resident_attr_in_mft_record()
1398 mpa_size = ntfs_get_size_for_mapping_pairs(g_vol, rl, 0, INT_MAX); in insert_non_resident_attr_in_mft_record()
1455 a->allocated_size = cpu_to_sle64((val_len + (g_vol->cluster_size - 1)) & in insert_non_resident_attr_in_mft_record()
1456 ~(g_vol->cluster_size - 1)); in insert_non_resident_attr_in_mft_record()
1476 bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, NULL, in insert_non_resident_attr_in_mft_record()
1483 err = ntfs_mapping_pairs_build(g_vol, (u8*)a + hdr_size + in insert_non_resident_attr_in_mft_record()
1990 if (index_block_size >= g_vol->cluster_size) { in add_attr_index_root()
1991 if (index_block_size % g_vol->cluster_size) { in add_attr_index_root()
1998 g_vol->cluster_size; in add_attr_index_root()
2414 if (g_vol->mft_record_size > idx_size + le32_to_cpu(m->bytes_allocated)) in insert_index_entry_in_res_dir_index()
2454 IGNORE_CASE, g_vol->upcase, in insert_index_entry_in_res_dir_index()
2455 g_vol->upcase_len); in insert_index_entry_in_res_dir_index()
2478 CASE_SENSITIVE, g_vol->upcase, in insert_index_entry_in_res_dir_index()
2479 g_vol->upcase_len); in insert_index_entry_in_res_dir_index()
2778 IGNORE_CASE, g_vol->upcase, g_vol->upcase_len); in insert_file_link_in_dir_index()
2808 CASE_SENSITIVE, g_vol->upcase, g_vol->upcase_len); in insert_file_link_in_dir_index()
3116 if (g_vol) { in mkntfs_cleanup()
3117 if (g_vol->dev) { in mkntfs_cleanup()
3118 if (NDevOpen(g_vol->dev) && g_vol->dev->d_ops->close(g_vol->dev)) in mkntfs_cleanup()
3119 ntfs_log_perror("Warning: Could not close %s", g_vol->dev->d_name); in mkntfs_cleanup()
3120 ntfs_device_free(g_vol->dev); in mkntfs_cleanup()
3122 free(g_vol->vol_name); in mkntfs_cleanup()
3123 free(g_vol->attrdef); in mkntfs_cleanup()
3124 free(g_vol->upcase); in mkntfs_cleanup()
3125 free(g_vol); in mkntfs_cleanup()
3126 g_vol = NULL; in mkntfs_cleanup()
3551 g_lcn_bitmap_byte_size = (g_vol->nr_clusters + 7) >> 3; in mkntfs_initialize_bitmaps()
3554 i = (g_lcn_bitmap_byte_size + g_vol->cluster_size - 1) & in mkntfs_initialize_bitmaps()
3555 ~(g_vol->cluster_size - 1); in mkntfs_initialize_bitmaps()
3566 if (!bitmap_allocate(g_vol->nr_clusters, in mkntfs_initialize_bitmaps()
3567 ((s64)g_lcn_bitmap_byte_size << 3) - g_vol->nr_clusters)) in mkntfs_initialize_bitmaps()
3574 g_mft_size *= g_vol->mft_record_size; in mkntfs_initialize_bitmaps()
3575 if (g_mft_size < (s32)g_vol->cluster_size) in mkntfs_initialize_bitmaps()
3576 g_mft_size = g_vol->cluster_size; in mkntfs_initialize_bitmaps()
3579 mft_bitmap_size = g_mft_size / g_vol->mft_record_size; in mkntfs_initialize_bitmaps()
3596 i = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; in mkntfs_initialize_bitmaps()
3625 if (g_mft_lcn * g_vol->cluster_size < 16 * 1024) in mkntfs_initialize_rl_mft()
3626 g_mft_lcn = (16 * 1024 + g_vol->cluster_size - 1) / in mkntfs_initialize_rl_mft()
3627 g_vol->cluster_size; in mkntfs_initialize_rl_mft()
3631 g_mft_zone_end = g_vol->nr_clusters; in mkntfs_initialize_rl_mft()
3648 g_vol->cluster_size_bits >> 10 /* >> 10 == / 1024 */); in mkntfs_initialize_rl_mft()
3662 j = (g_mft_size + g_vol->cluster_size - 1) / g_vol->cluster_size; in mkntfs_initialize_rl_mft()
3671 / g_vol->cluster_size; in mkntfs_initialize_rl_mft()
3688 j = (4 * g_vol->mft_record_size + g_vol->cluster_size - 1) / g_vol->cluster_size; in mkntfs_initialize_rl_mft()
3715 volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; in mkntfs_initialize_rl_logfile()
3745 ~(g_vol->cluster_size - 1); in mkntfs_initialize_rl_logfile()
3747 j = g_logfile_size / g_vol->cluster_size; in mkntfs_initialize_rl_logfile()
3748 while (g_rl_logfile[0].lcn + j >= g_vol->nr_clusters) { in mkntfs_initialize_rl_logfile()
3755 j = g_logfile_size / g_vol->cluster_size; in mkntfs_initialize_rl_logfile()
3757 g_logfile_size = (g_logfile_size + g_vol->cluster_size - 1) & in mkntfs_initialize_rl_logfile()
3758 ~(g_vol->cluster_size - 1); in mkntfs_initialize_rl_logfile()
3796 j = (8192 + g_vol->cluster_size - 1) / g_vol->cluster_size; in mkntfs_initialize_rl_boot()
3821 g_rl_bad[1].vcn = g_vol->nr_clusters; in mkntfs_initialize_rl_bad()
3822 g_rl_bad[0].length = g_vol->nr_clusters; in mkntfs_initialize_rl_bad()
3842 float progress_inc = (float)g_vol->nr_clusters / 100; in mkntfs_fill_device_with_zeroes()
3845 volume_size = g_vol->nr_clusters << g_vol->cluster_size_bits; in mkntfs_fill_device_with_zeroes()
3848 for (position = 0; position < (unsigned long long)g_vol->nr_clusters; in mkntfs_fill_device_with_zeroes()
3854 bw = mkntfs_write(g_vol->dev, g_buf, g_vol->cluster_size); in mkntfs_fill_device_with_zeroes()
3855 if (bw != (ssize_t)g_vol->cluster_size) { in mkntfs_fill_device_with_zeroes()
3874 g_vol->dev->d_ops->seek(g_vol->dev, in mkntfs_fill_device_with_zeroes()
3876 g_vol->cluster_size, SEEK_SET); in mkntfs_fill_device_with_zeroes()
3880 position = (volume_size & (g_vol->cluster_size - 1)) / in mkntfs_fill_device_with_zeroes()
3883 bw = mkntfs_write(g_vol->dev, g_buf, opts.sector_size); in mkntfs_fill_device_with_zeroes()
3895 g_vol->dev->d_ops->seek(g_vol->dev, in mkntfs_fill_device_with_zeroes()
3932 rl_index = ntfs_mapping_pairs_decompress(g_vol, a, NULL); in mkntfs_sync_index_record()
3955 lw = ntfs_rlwrite(g_vol->dev, rl_index, (u8*)idx, i, NULL, in mkntfs_sync_index_record()
3977 m = (MFT_RECORD*)(g_buf + 3 * g_vol->mft_record_size); in create_file_volume()
3990 err = add_attr_vol_name(m, g_vol->vol_name, g_vol->vol_name ? in create_file_volume()
3991 strlen(g_vol->vol_name) : 0); in create_file_volume()
3997 err = add_attr_vol_info(m, fl, g_vol->major_ver, in create_file_volume()
3998 g_vol->minor_ver); in create_file_volume()
4030 if (g_vol->dev->d_ops->seek(g_vol->dev, (opts.num_sectors + 1) * in create_backup_boot_sector()
4037 bw = mkntfs_write(g_vol->dev, buff, size); in create_backup_boot_sector()
4091 if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf + in mkntfs_create_root_structures()
4092 i * g_vol->mft_record_size))) { in mkntfs_create_root_structures()
4106 if (nr_sysfiles * (s32)g_vol->mft_record_size < g_mft_size) { in mkntfs_create_root_structures()
4108 i * (s32)g_vol->mft_record_size < g_mft_size; i++) { in mkntfs_create_root_structures()
4109 m = (MFT_RECORD *)(g_buf + i * g_vol->mft_record_size); in mkntfs_create_root_structures()
4110 if (ntfs_mft_record_layout(g_vol, 0, m)) { in mkntfs_create_root_structures()
4126 m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); in mkntfs_create_root_structures()
4167 m = (MFT_RECORD*)(g_buf + 5 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4182 g_vol->indx_record_size); in mkntfs_create_root_structures()
4225 | (g_vol->cluster_size - 1)) + 1, in mkntfs_create_root_structures()
4239 m = (MFT_RECORD*)(g_buf + 1 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4242 g_rl_mftmirr[0].length * g_vol->cluster_size); in mkntfs_create_root_structures()
4246 g_rl_mftmirr[0].length * g_vol->cluster_size, in mkntfs_create_root_structures()
4247 g_rl_mftmirr[0].length * g_vol->cluster_size, in mkntfs_create_root_structures()
4256 m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4272 m = (MFT_RECORD*)(g_buf + 4 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4274 (u8*)g_vol->attrdef, g_vol->attrdef_len); in mkntfs_create_root_structures()
4286 (g_vol->attrdef_len + g_vol->cluster_size - 1) & in mkntfs_create_root_structures()
4287 ~(g_vol->cluster_size - 1), g_vol->attrdef_len, in mkntfs_create_root_structures()
4300 m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4313 (g_lcn_bitmap_byte_size + g_vol->cluster_size - in mkntfs_create_root_structures()
4314 1) & ~(g_vol->cluster_size - 1), in mkntfs_create_root_structures()
4323 m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4334 bs->bpb.sectors_per_cluster = (u8)(g_vol->cluster_size / in mkntfs_create_root_structures()
4350 if (g_vol->mft_record_size >= g_vol->cluster_size) { in mkntfs_create_root_structures()
4351 bs->clusters_per_mft_record = g_vol->mft_record_size / in mkntfs_create_root_structures()
4352 g_vol->cluster_size; in mkntfs_create_root_structures()
4354 bs->clusters_per_mft_record = -(ffs(g_vol->mft_record_size) - in mkntfs_create_root_structures()
4357 g_vol->mft_record_size) { in mkntfs_create_root_structures()
4368 if (g_vol->indx_record_size >= g_vol->cluster_size) { in mkntfs_create_root_structures()
4369 bs->clusters_per_index_record = g_vol->indx_record_size / in mkntfs_create_root_structures()
4370 g_vol->cluster_size; in mkntfs_create_root_structures()
4372 bs->clusters_per_index_record = -g_vol->indx_record_size_bits; in mkntfs_create_root_structures()
4374 (s32)g_vol->indx_record_size) { in mkntfs_create_root_structures()
4405 (8192 + g_vol->cluster_size - 1) & in mkntfs_create_root_structures()
4406 ~(g_vol->cluster_size - 1), 8192, in mkntfs_create_root_structures()
4444 m = (MFT_RECORD*)(g_buf + 8 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4449 g_vol->nr_clusters * g_vol->cluster_size); in mkntfs_create_root_structures()
4467 m = (MFT_RECORD*)(g_buf + 9 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4495 g_vol->indx_record_size); in mkntfs_create_root_structures()
4500 g_vol->indx_record_size); in mkntfs_create_root_structures()
4510 m = (MFT_RECORD*)(g_buf + 0xa * g_vol->mft_record_size); in mkntfs_create_root_structures()
4512 (u8*)g_vol->upcase, g_vol->upcase_len << 1); in mkntfs_create_root_structures()
4516 ((g_vol->upcase_len << 1) + in mkntfs_create_root_structures()
4517 g_vol->cluster_size - 1) & in mkntfs_create_root_structures()
4518 ~(g_vol->cluster_size - 1), in mkntfs_create_root_structures()
4519 g_vol->upcase_len << 1, in mkntfs_create_root_structures()
4531 m = (MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4543 g_vol->indx_record_size); in mkntfs_create_root_structures()
4552 m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); in mkntfs_create_root_structures()
4570 m = (MFT_RECORD*)(g_buf + 24 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4575 11 * g_vol->mft_record_size), extend_ref, m, in mkntfs_create_root_structures()
4581 COLLATION_NTOFS_ULONG, g_vol->indx_record_size); in mkntfs_create_root_structures()
4585 COLLATION_NTOFS_SID, g_vol->indx_record_size); in mkntfs_create_root_structures()
4593 m = (MFT_RECORD*)(g_buf + 25 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4598 11 * g_vol->mft_record_size), extend_ref, in mkntfs_create_root_structures()
4607 g_vol->indx_record_size); in mkntfs_create_root_structures()
4617 m = (MFT_RECORD*)(g_buf + 26 * g_vol->mft_record_size); in mkntfs_create_root_structures()
4622 11 * g_vol->mft_record_size), in mkntfs_create_root_structures()
4629 COLLATION_NTOFS_ULONGS, g_vol->indx_record_size); in mkntfs_create_root_structures()
4658 g_vol = ntfs_volume_alloc(); in mkntfs_redirect()
4659 if (!g_vol) { in mkntfs_redirect()
4664 g_vol->major_ver = 3; in mkntfs_redirect()
4665 g_vol->minor_ver = 1; in mkntfs_redirect()
4668 g_vol->vol_name = strdup(opts.label); in mkntfs_redirect()
4669 if (!g_vol->vol_name) { in mkntfs_redirect()
4675 g_vol->cluster_size = opts.cluster_size; in mkntfs_redirect()
4677 g_vol->upcase_len = ntfs_upcase_build_default(&g_vol->upcase); in mkntfs_redirect()
4681 if (!g_vol->upcase_len || !g_upcaseinfo) in mkntfs_redirect()
4685 upcase_crc = crc64(0,(byte*)g_vol->upcase, in mkntfs_redirect()
4686 g_vol->upcase_len * sizeof(ntfschar)); in mkntfs_redirect()
4691 g_vol->attrdef = ntfs_malloc(sizeof(attrdef_ntfs3x_array)); in mkntfs_redirect()
4692 if (!g_vol->attrdef) { in mkntfs_redirect()
4696 memcpy(g_vol->attrdef, attrdef_ntfs3x_array, in mkntfs_redirect()
4698 g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array); in mkntfs_redirect()
4700 if (!mkntfs_open_partition(g_vol)) in mkntfs_redirect()
4706 if (!mkntfs_override_vol_params(g_vol)) in mkntfs_redirect()
4750 g_vol->mft_record_size), NTFS_INDEX_I30, 4)) in mkntfs_redirect()
4754 m = (MFT_RECORD*)(g_buf + 6 * g_vol->mft_record_size); in mkntfs_redirect()
4770 runlist *rl = ntfs_mapping_pairs_decompress(g_vol, a, NULL); in mkntfs_redirect()
4775 lw = ntfs_rlwrite(g_vol->dev, rl, (const u8*)NULL, in mkntfs_redirect()
4795 pos = g_mft_lcn * g_vol->cluster_size; in mkntfs_redirect()
4797 for (i = 0; i < g_mft_size / (s32)g_vol->mft_record_size; i++) { in mkntfs_redirect()
4799 …lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_siz… in mkntfs_redirect()
4805 pos += g_vol->mft_record_size; in mkntfs_redirect()
4808 pos = g_mftmirr_lcn * g_vol->cluster_size; in mkntfs_redirect()
4810 for (i = 0; i < g_rl_mftmirr[0].length * g_vol->cluster_size / g_vol->mft_record_size; i++) { in mkntfs_redirect()
4811 m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size); in mkntfs_redirect()
4823 …lw = ntfs_mst_pwrite(g_vol->dev, pos, 1, g_vol->mft_record_size, g_buf + i * g_vol->mft_record_siz… in mkntfs_redirect()
4829 pos += g_vol->mft_record_size; in mkntfs_redirect()
4832 if (g_vol->dev->d_ops->sync(g_vol->dev)) { in mkntfs_redirect()
4863 g_vol = NULL; in mkntfs_main()