• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/ntfs-3g-2009.3.8/libntfs-3g/

Lines Matching refs:vol

222  * @vol:	ntfs volume whose $MFT to load
224 * Load $MFT from @vol and setup @vol with it. After calling this function the
225 * volume @vol is ready for use by all read access functions provided by the
230 static int ntfs_mft_load(ntfs_volume *vol)
240 vol->mft_ni = ntfs_inode_allocate(vol);
241 mb = ntfs_malloc(vol->mft_record_size);
242 if (!vol->mft_ni || !mb) {
246 vol->mft_ni->mft_no = 0;
247 vol->mft_ni->mrec = mb;
249 l = ntfs_mst_pread(vol->dev, vol->mft_lcn << vol->cluster_size_bits, 1,
250 vol->mft_record_size, mb);
258 if (ntfs_mft_record_check(vol, 0, mb))
261 ctx = ntfs_attr_get_search_ctx(vol->mft_ni, NULL);
274 NInoSetAttrList(vol->mft_ni);
281 vol->mft_ni->attr_list_size = l;
282 vol->mft_ni->attr_list = ntfs_malloc(l);
283 if (!vol->mft_ni->attr_list)
286 l = ntfs_get_attribute_value(vol, ctx->attr, vol->mft_ni->attr_list);
291 if (l != vol->mft_ni->attr_list_size) {
294 vol->mft_ni->attr_list_size);
300 ntfs_attr_setup_flag(vol->mft_ni);
302 /* We now have a fully setup ntfs inode for $MFT in vol->mft_ni. */
305 vol->mft_na = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0);
306 if (!vol->mft_na) {
312 last_vcn = vol->mft_na->allocated_size >> vol->cluster_size_bits;
338 nrl = ntfs_mapping_pairs_decompress(vol, a, vol->mft_na->rl);
343 vol->mft_na->rl = nrl;
375 vol->mftbmp_na = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0);
376 if (!vol->mftbmp_na) {
387 if (vol->mft_na) {
388 ntfs_attr_close(vol->mft_na);
389 vol->mft_na = NULL;
391 if (vol->mft_ni) {
392 ntfs_inode_close(vol->mft_ni);
393 vol->mft_ni = NULL;
401 * @vol: ntfs volume whose $MFTMirr to load
403 * Load $MFTMirr from @vol and setup @vol with it. After calling this function
404 * the volume @vol is ready for use by all write access functions provided by
410 static int ntfs_mftmirr_load(ntfs_volume *vol)
414 vol->mftmirr_ni = ntfs_inode_open(vol, FILE_MFTMirr);
415 if (!vol->mftmirr_ni) {
420 vol->mftmirr_na = ntfs_attr_open(vol->mftmirr_ni, AT_DATA, AT_UNNAMED, 0);
421 if (!vol->mftmirr_na) {
426 if (ntfs_attr_map_runlist(vol->mftmirr_na, 0) < 0) {
435 if (vol->mftmirr_na) {
436 ntfs_attr_close(vol->mftmirr_na);
437 vol->mftmirr_na = NULL;
439 ntfs_inode_close(vol->mftmirr_ni);
440 vol->mftmirr_ni = NULL;
461 ntfs_volume *vol;
476 vol = ntfs_volume_alloc();
477 if (!vol)
481 vol->upcase_len = 65536;
482 vol->upcase = ntfs_malloc(vol->upcase_len * sizeof(ntfschar));
483 if (!vol->upcase)
486 ntfs_upcase_table_build(vol->upcase,
487 vol->upcase_len * sizeof(ntfschar));
490 NVolSetReadOnly(vol);
493 if ((dev->d_ops->open)(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) {
498 vol->dev = dev;
515 if (ntfs_boot_sector_parse(vol, bs) < 0)
521 if (ntfs_device_block_size_set(vol->dev, vol->sector_size))
528 mft_zone_size = vol->nr_clusters >> 3; /* 12.5% */
531 vol->mft_zone_start = vol->mft_zone_pos = vol->mft_lcn;
532 ntfs_log_debug("mft_zone_pos = 0x%llx\n", (long long)vol->mft_zone_pos);
543 mft_lcn = (8192 + 2 * vol->cluster_size - 1) / vol->cluster_size;
544 if (mft_lcn * vol->cluster_size < 16 * 1024)
545 mft_lcn = (16 * 1024 + vol->cluster_size - 1) /
546 vol->cluster_size;
547 if (vol->mft_zone_start <= mft_lcn)
548 vol->mft_zone_start = 0;
549 ntfs_log_debug("mft_zone_start = 0x%llx\n", (long long)vol->mft_zone_start);
556 vol->mft_zone_end = vol->mft_lcn + mft_zone_size;
557 while (vol->mft_zone_end >= vol->nr_clusters) {
559 vol->mft_zone_end = vol->mft_lcn + mft_zone_size;
561 ntfs_log_debug("mft_zone_end = 0x%llx\n", (long long)vol->mft_zone_end);
567 vol->data1_zone_pos = vol->mft_zone_end;
568 ntfs_log_debug("data1_zone_pos = %lld\n", (long long)vol->data1_zone_pos);
569 vol->data2_zone_pos = 0;
570 ntfs_log_debug("data2_zone_pos = %lld\n", (long long)vol->data2_zone_pos);
573 vol->mft_data_pos = 24;
580 if (ntfs_mft_load(vol) < 0) {
586 if (ntfs_mftmirr_load(vol) < 0) {
590 return vol;
594 if (vol)
595 __ntfs_volume_release(vol);
602 * @vol: volume on which to check logfile
606 static int ntfs_volume_check_logfile(ntfs_volume *vol)
613 ni = ntfs_inode_open(vol, FILE_LogFile);
643 * @vol: An ntfs volume obtained from ntfs_mount
648 static ntfs_inode *ntfs_hiberfile_open(ntfs_volume *vol)
657 if (!vol) {
662 ni_root = ntfs_inode_open(vol, FILE_root);
681 ni_hibr = ntfs_inode_open(vol, inode);
701 * @vol: volume on which to check hiberfil.sys
706 int ntfs_volume_check_hiberfile(ntfs_volume *vol, int verbose)
713 ni = ntfs_hiberfile_open(vol);
786 ntfs_volume *vol;
797 vol = ntfs_volume_startup(dev, flags);
798 if (!vol)
802 m = ntfs_malloc(vol->mftmirr_size << vol->mft_record_size_bits);
803 m2 = ntfs_malloc(vol->mftmirr_size << vol->mft_record_size_bits);
807 l = ntfs_attr_mst_pread(vol->mft_na, 0, vol->mftmirr_size,
808 vol->mft_record_size, m);
809 if (l != vol->mftmirr_size) {
815 vol->mftmirr_size);
820 l = ntfs_attr_mst_pread(vol->mftmirr_na, 0, vol->mftmirr_size,
821 vol->mft_record_size, m2);
822 if (l != vol->mftmirr_size) {
827 vol->mftmirr_size = l;
830 for (i = 0; i < vol->mftmirr_size; ++i) {
844 mrec = (MFT_RECORD*)(m + i * vol->mft_record_size);
858 mrec2 = (MFT_RECORD*)(m2 + i * vol->mft_record_size);
885 vol->lcnbmp_ni = ntfs_inode_open(vol, FILE_Bitmap);
886 if (!vol->lcnbmp_ni) {
891 vol->lcnbmp_na = ntfs_attr_open(vol->lcnbmp_ni, AT_DATA, AT_UNNAMED, 0);
892 if (!vol->lcnbmp_na) {
897 if (vol->lcnbmp_na->data_size > vol->lcnbmp_na->allocated_size) {
899 (long long)vol->lcnbmp_na->data_size,
900 (long long)vol->lcnbmp_na->allocated_size);
906 ni = ntfs_inode_open(vol, FILE_UpCase);
929 if (vol->upcase_len != na->data_size >> 1) {
930 vol->upcase_len = na->data_size >> 1;
932 free(vol->upcase);
933 vol->upcase = ntfs_malloc(na->data_size);
934 if (!vol->upcase)
938 l = ntfs_attr_pread(na, 0, na->data_size, vol->upcase);
955 * vol structure accordingly.
958 vol->vol_ni = ntfs_inode_open(vol, FILE_Volume);
959 if (!vol->vol_ni) {
964 ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL);
994 /* Setup vol from the volume information attribute value. */
995 vol->major_ver = vinf->major_ver;
996 vol->minor_ver = vinf->minor_ver;
999 vol->flags = vinf->flags;
1016 vol->vol_name = ntfs_malloc(1);
1017 if (!vol->vol_name)
1019 vol->vol_name[0] = '\0';
1035 vol->vol_name = NULL;
1036 if (ntfs_ucstombs(vname, u, &vol->vol_name, 0) == -1) {
1041 vol->vol_name = ntfs_malloc(u + 1);
1042 if (!vol->vol_name)
1049 vol->vol_name[j] = (char)uc;
1051 vol->vol_name[u] = '\0';
1058 ni = ntfs_inode_open(vol, FILE_AttrDef);
1076 vol->attrdef_len = na->data_size;
1077 vol->attrdef = ntfs_malloc(na->data_size);
1078 if (!vol->attrdef)
1081 l = ntfs_attr_pread(na, 0, na->data_size, vol->attrdef);
1101 ntfs_volume_check_hiberfile(vol, 1) < 0)
1103 if (ntfs_volume_check_logfile(vol) < 0) {
1108 if (ntfs_logfile_reset(vol))
1113 return vol;
1122 __ntfs_volume_release(vol);
1157 ntfs_volume *vol;
1164 vol = ntfs_device_mount(dev, flags);
1165 if (!vol) {
1170 return vol;
1184 * @vol: address of ntfs_volume structure of volume to close
1187 * Deallocate all structures (including @vol itself) associated with the ntfs
1188 * volume @vol.
1198 * @vol must have previously been returned by a call to ntfs_mount().
1200 * @vol itself is deallocated and should no longer be dereferenced after this
1202 * so it is safe to continue using @vol.
1204 int ntfs_umount(ntfs_volume *vol, const BOOL force __attribute__((unused)))
1209 if (!vol) {
1213 dev = vol->dev;
1214 ret = __ntfs_volume_release(vol);
1329 * @vol: ntfs volume whose version we're interested in.
1343 int ntfs_version_is_supported(ntfs_volume *vol)
1347 if (!vol) {
1352 major = vol->major_ver;
1353 minor = vol->minor_ver;
1370 * @vol: ntfs volume whose $LogFile we intend to reset.
1383 int ntfs_logfile_reset(ntfs_volume *vol)
1389 if (!vol) {
1394 ni = ntfs_inode_open(vol, FILE_LogFile);
1424 * @vol: ntfs volume where we set the volume flags
1428 * on volume @vol to @flags.
1432 int ntfs_volume_write_flags(ntfs_volume *vol, const u16 flags)
1439 if (!vol || !vol->vol_ni) {
1444 ctx = ntfs_attr_get_search_ctx(vol->vol_ni, NULL);
1475 vol->flags = c->flags = flags & VOLUME_FLAGS_MASK;
1477 ntfs_inode_mark_dirty(vol->vol_ni);
1478 if (ntfs_inode_sync(vol->vol_ni))