"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ntfsprogs/ntfsfix.c" between
ntfs-3g_ntfsprogs-2016.2.22.tgz and ntfs-3g_ntfsprogs-2017.3.23.tgz

About: NTFS-3G is a read-write NTFS driver for Linux and other operating systems. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008, Windows 7 and Windows 8 NTFS file systems.

ntfsfix.c  (ntfs-3g_ntfsprogs-2016.2.22.tgz):ntfsfix.c  (ntfs-3g_ntfsprogs-2017.3.23.tgz)
skipping to change at line 344 skipping to change at line 344
ntfs_log_info("Going to empty the journal ($LogFile)... "); ntfs_log_info("Going to empty the journal ($LogFile)... ");
if (ntfs_logfile_reset(vol)) { if (ntfs_logfile_reset(vol)) {
ntfs_log_info(FAILED); ntfs_log_info(FAILED);
ntfs_log_perror("Failed to reset $LogFile"); ntfs_log_perror("Failed to reset $LogFile");
return -1; return -1;
} }
ntfs_log_info(OK); ntfs_log_info(OK);
return 0; return 0;
} }
/*
* Clear the sparse flag of an attribute
*/
static int clear_sparse(ntfs_attr *na, const char *name)
{
ntfs_attr_search_ctx *ctx;
int res;
res = -1;
ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
if (ctx) {
if (!ntfs_attr_lookup(na->type, na->name, na->name_len,
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
na->data_flags &= ~ATTR_IS_SPARSE;
ctx->attr->data_size = cpu_to_sle64(na->data_size);
ctx->attr->initialized_size
= cpu_to_sle64(na->initialized_size);
ctx->attr->flags = na->data_flags;
ctx->attr->compression_unit = 0;
ntfs_inode_mark_dirty(ctx->ntfs_ino);
NInoFileNameSetDirty(na->ni);
res = 0;
} else
ntfs_log_perror("Could not locate attribute for %s",
name);
ntfs_attr_put_search_ctx(ctx);
} else
ntfs_log_perror("Could not get a search context for %s",
name);
return (res);
}
/** /**
* Clear the bad cluster marks (option) * Clear the bad cluster marks (option)
*/ */
static int clear_badclus(ntfs_volume *vol) static int clear_badclus(ntfs_volume *vol)
{ {
static ntfschar badstream[] = { static ntfschar badstream[] = {
const_cpu_to_le16('$'), const_cpu_to_le16('B'), const_cpu_to_le16('$'), const_cpu_to_le16('B'),
const_cpu_to_le16('a'), const_cpu_to_le16('d') const_cpu_to_le16('a'), const_cpu_to_le16('d')
} ; } ;
ntfs_inode *ni; ntfs_inode *ni;
skipping to change at line 375 skipping to change at line 408
* check the runlist. * check the runlist.
*/ */
if (na && !ntfs_attr_map_whole_runlist(na)) { if (na && !ntfs_attr_map_whole_runlist(na)) {
if (na->rl if (na->rl
&& na->rl[0].length && na->rl[1].length) { && na->rl[0].length && na->rl[1].length) {
/* /*
* Truncate the stream to free all its clusters, * Truncate the stream to free all its clusters,
* (which requires setting the data size according * (which requires setting the data size according
* to allocation), then reallocate a sparse stream * to allocation), then reallocate a sparse stream
* to full size of volume and reset the data size. * to full size of volume and reset the data size.
* Note : the sparse flags should not be set.
*/ */
na->data_size = na->allocated_size; na->data_size = na->allocated_size;
na->initialized_size = na->allocated_size; na->initialized_size = na->allocated_size;
if (!ntfs_attr_truncate(na,0) if (!ntfs_attr_truncate(na,0)
&& !ntfs_attr_truncate(na,vol->nr_clusters && !ntfs_attr_truncate(na,vol->nr_clusters
<< vol->cluster_size_bits)) { << vol->cluster_size_bits)) {
na->data_size = 0;
na->initialized_size = 0; na->initialized_size = 0;
ni->flags |= FILE_ATTR_SPARSE_FILE;
NInoFileNameSetDirty(ni); NInoFileNameSetDirty(ni);
ok = TRUE; ok = TRUE;
} else { } else {
ntfs_log_perror("Failed to un-mark the ba d clusters"); ntfs_log_perror("Failed to un-mark the ba d clusters");
} }
} else { } else {
ntfs_log_info("No bad clusters..."); ntfs_log_info("No bad clusters...");
ok = TRUE; ok = TRUE;
} }
/*
* The sparse flags are not set after an initial
* formatting, so do the same.
*/
if (ok) {
ni->flags &= ~FILE_ATTR_SPARSE_FILE;
ok = !clear_sparse(na, "$BadClus::$Bad");
}
ntfs_attr_close(na); ntfs_attr_close(na);
} else { } else {
ntfs_log_perror("Failed to open $BadClus::$Bad"); ntfs_log_perror("Failed to open $BadClus::$Bad");
} }
ntfs_inode_close(ni); ntfs_inode_close(ni);
} else { } else {
ntfs_log_perror("Failed to open inode FILE_BadClus"); ntfs_log_perror("Failed to open inode FILE_BadClus");
} }
if (ok) if (ok)
ntfs_log_info(OK); ntfs_log_info(OK);
 End of changes. 5 change blocks. 
2 lines changed or deleted 42 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS