parent
							
								
									dde45c851e
								
							
						
					
					
						commit
						fafd832996
					
				| 
						 | 
				
			
			@ -69,7 +69,7 @@ struct progress_bar {
 | 
			
		|||
struct __ntfs_walk_clusters_ctx {
 | 
			
		||||
	ntfs_inode *ni;			/* inode being processed */
 | 
			
		||||
	ntfs_attr_search_ctx *ctx;	/* inode attribute being processed */
 | 
			
		||||
	u64 inuse;			/* number of clusters in use */
 | 
			
		||||
	s64 inuse;			/* number of clusters in use */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct __ntfs_walk_clusters_ctx ntfs_walk_clusters_ctx;
 | 
			
		||||
| 
						 | 
				
			
			@ -167,7 +167,7 @@ int perr_exit(const char *fmt, ...)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void usage()
 | 
			
		||||
void usage(void)
 | 
			
		||||
{
 | 
			
		||||
	Eprintf("\nUsage: %s [options] device\n"
 | 
			
		||||
		"    Efficiently clone NTFS to a sparse file, device or standard output.\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -370,7 +370,7 @@ int io_all(void *fd, void *buf, int count, int do_write)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void copy_cluster()
 | 
			
		||||
void copy_cluster(void)
 | 
			
		||||
{
 | 
			
		||||
	char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +440,7 @@ void clone_ntfs(u64 nr_clusters)
 | 
			
		|||
			return;
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < count; i++, pos++) {
 | 
			
		||||
			u64 cl;  /* current cluster */	  
 | 
			
		||||
			s64 cl;  /* current cluster */	  
 | 
			
		||||
 | 
			
		||||
			for (cl = pos * 8; cl < (pos + 1) * 8; cl++) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -495,7 +495,8 @@ void wipe_timestamps(ntfs_walk_clusters_ctx *image)
 | 
			
		|||
void wipe_resident_data(ntfs_walk_clusters_ctx *image)
 | 
			
		||||
{
 | 
			
		||||
	ATTR_RECORD *a;
 | 
			
		||||
	int i, n = 0;
 | 
			
		||||
	u32 i;
 | 
			
		||||
	int n = 0;
 | 
			
		||||
	char *p;
 | 
			
		||||
 | 
			
		||||
	a = image->ctx->attr;
 | 
			
		||||
| 
						 | 
				
			
			@ -612,7 +613,7 @@ void compare_bitmaps(struct bitmap *a)
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < count; i++, pos++) {
 | 
			
		||||
			u64 cl;  /* current cluster */	  
 | 
			
		||||
			s64 cl;  /* current cluster */	  
 | 
			
		||||
 | 
			
		||||
			if (a->bm[pos] == bm[i])
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -787,7 +788,7 @@ void bitmap_file_data_fixup(s64 cluster, struct bitmap *bm)
 | 
			
		|||
 * All the bits are set to 0, except those representing the region beyond the
 | 
			
		||||
 * end of the disk.
 | 
			
		||||
 */
 | 
			
		||||
void setup_lcn_bitmap()
 | 
			
		||||
void setup_lcn_bitmap(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Determine lcn bitmap byte size and allocate it. */
 | 
			
		||||
	lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters);
 | 
			
		||||
| 
						 | 
				
			
			@ -1010,7 +1011,7 @@ int main(int argc, char **argv)
 | 
			
		|||
	/* FIXME: save backup boot sector */
 | 
			
		||||
 | 
			
		||||
	if (opt.stdout || !opt.metadata_only) {
 | 
			
		||||
		u64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse;
 | 
			
		||||
		s64 nr_clusters = opt.stdout ? vol->nr_clusters : image.inuse;
 | 
			
		||||
		
 | 
			
		||||
		clone_ntfs(nr_clusters);
 | 
			
		||||
		Printf("Syncing ...\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -194,7 +194,7 @@ int perr_exit(const char *fmt, ...)
 | 
			
		|||
 *
 | 
			
		||||
 * Return:  none
 | 
			
		||||
 */
 | 
			
		||||
void usage()
 | 
			
		||||
void usage(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	printf ("\nUsage: %s [options] device\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -694,7 +694,7 @@ void compare_bitmaps(struct bitmap *a)
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < count; i++, pos++) {
 | 
			
		||||
			u64 cl;  /* current cluster */	  
 | 
			
		||||
			s64 cl;  /* current cluster */	  
 | 
			
		||||
 | 
			
		||||
			if (a->bm[pos] == bm[i])
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -930,8 +930,8 @@ void truncate_badclust_bad_attr(ATTR_RECORD *a, s64 nr_clusters)
 | 
			
		|||
	if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl_bad)) == -1)
 | 
			
		||||
		perr_exit("ntfs_get_size_for_mapping_pairs");
 | 
			
		||||
 | 
			
		||||
	if (mp_size > le32_to_cpu (a->length) -
 | 
			
		||||
			le16_to_cpu (a->mapping_pairs_offset))
 | 
			
		||||
	if (mp_size > (int)(le32_to_cpu (a->length) -
 | 
			
		||||
			le16_to_cpu (a->mapping_pairs_offset)))
 | 
			
		||||
		err_exit("Enlarging attribute header isn't supported yet.\n");
 | 
			
		||||
 | 
			
		||||
	if (!(mp = (char *)calloc(1, mp_size)))
 | 
			
		||||
| 
						 | 
				
			
			@ -959,7 +959,7 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size)
 | 
			
		|||
{
 | 
			
		||||
	runlist *rl = *rlist;
 | 
			
		||||
	int i, j;
 | 
			
		||||
	u64 k;
 | 
			
		||||
	s64 k;
 | 
			
		||||
	int trunc_at = -1;	/* FIXME: -1 means unset */
 | 
			
		||||
 | 
			
		||||
	/* Unallocate truncated clusters in $Bitmap */
 | 
			
		||||
| 
						 | 
				
			
			@ -974,11 +974,11 @@ void shrink_bitmap_data_attr(runlist **rlist, s64 nr_bm_clusters, s64 new_size)
 | 
			
		|||
			if (rl[i].vcn + j < nr_bm_clusters)
 | 
			
		||||
				continue;
 | 
			
		||||
 | 
			
		||||
			k = (u64)rl[i].lcn + j;
 | 
			
		||||
			k = rl[i].lcn + j;
 | 
			
		||||
			if (k < new_size) {
 | 
			
		||||
				ntfs_bit_set(lcn_bitmap.bm, k, 0);
 | 
			
		||||
				Dprintf("Unallocate cluster: "
 | 
			
		||||
				       "%llu (%llx)\n", k, k);
 | 
			
		||||
				       "%lld (%llx)\n", k, k);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -1076,8 +1076,8 @@ void truncate_bitmap_data_attr(ntfs_resize_t *resize)
 | 
			
		|||
	if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl)) == -1)
 | 
			
		||||
		perr_exit("ntfs_get_size_for_mapping_pairs");
 | 
			
		||||
 | 
			
		||||
	if (mp_size > le32_to_cpu (a->length) -
 | 
			
		||||
			le16_to_cpu (a->mapping_pairs_offset))
 | 
			
		||||
	if (mp_size > (int)(le32_to_cpu (a->length) -
 | 
			
		||||
			le16_to_cpu (a->mapping_pairs_offset)))
 | 
			
		||||
		err_exit("Enlarging attribute header isn't supported yet.\n");
 | 
			
		||||
 | 
			
		||||
	if (!(mp = (char *)calloc(1, mp_size)))
 | 
			
		||||
| 
						 | 
				
			
			@ -1204,7 +1204,7 @@ void truncate_bitmap_file(ntfs_resize_t *resize)
 | 
			
		|||
 * All the bits are set to 0, except those representing the region beyond the
 | 
			
		||||
 * end of the disk.
 | 
			
		||||
 */
 | 
			
		||||
void setup_lcn_bitmap()
 | 
			
		||||
void setup_lcn_bitmap(void)
 | 
			
		||||
{
 | 
			
		||||
	/* Determine lcn bitmap byte size and allocate it. */
 | 
			
		||||
	lcn_bitmap.size = nr_clusters_to_bitmap_byte_size(vol->nr_clusters);
 | 
			
		||||
| 
						 | 
				
			
			@ -1294,7 +1294,7 @@ void print_disk_usage(ntfs_resize_t *resize)
 | 
			
		|||
 * is dirty (Windows wasn't shutdown properly).  If everything is OK, then mount
 | 
			
		||||
 * the volume (load the metadata into memory).
 | 
			
		||||
 */
 | 
			
		||||
void mount_volume()
 | 
			
		||||
void mount_volume(void)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long mntflag;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1348,7 +1348,7 @@ void mount_volume()
 | 
			
		|||
 * boots it will automatically run chkdsk to check for any problems.  If the
 | 
			
		||||
 * read-only command line option was given, this function will do nothing.
 | 
			
		||||
 */
 | 
			
		||||
void prepare_volume_fixup()
 | 
			
		||||
void prepare_volume_fixup(void)
 | 
			
		||||
{
 | 
			
		||||
	u16 flags;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -640,11 +640,11 @@ int ntfs_info (ntfs_volume *vol)
 | 
			
		|||
	//Qprintf ("initialized_size = %lld\n", vol->lcnbmp_na->initialized_size);
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
	u64 offset;
 | 
			
		||||
	u64 size = vol->lcnbmp_na->allocated_size;
 | 
			
		||||
	s64 offset;
 | 
			
		||||
	s64 size = vol->lcnbmp_na->allocated_size;
 | 
			
		||||
	int bufsize = vol->mft_record_size;
 | 
			
		||||
	u64 use = 0;
 | 
			
		||||
	u64 not = 0;
 | 
			
		||||
	s64 use = 0;
 | 
			
		||||
	s64 not = 0;
 | 
			
		||||
	int i, j;
 | 
			
		||||
 | 
			
		||||
	for (offset = 0; offset < size; offset += bufsize) {
 | 
			
		||||
| 
						 | 
				
			
			@ -680,11 +680,11 @@ done:
 | 
			
		|||
 | 
			
		||||
	{
 | 
			
		||||
	u8 *bitmap;
 | 
			
		||||
	u64 bmpoff;
 | 
			
		||||
	u64 bmpsize = vol->mftbmp_na->data_size;
 | 
			
		||||
	s64 bmpoff;
 | 
			
		||||
	s64 bmpsize = vol->mftbmp_na->data_size;
 | 
			
		||||
	int bmpbufsize = 512;
 | 
			
		||||
	int i, j;
 | 
			
		||||
	u64 use = 0, not = 0;
 | 
			
		||||
	s64 use = 0, not = 0;
 | 
			
		||||
 | 
			
		||||
	bitmap = malloc (bmpbufsize);
 | 
			
		||||
	if (!bitmap)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue