Lines 1-84
Link Here
|
1 |
--- libntfs/attrib.c Sat Sep 4 13:16:32 2004 |
|
|
2 |
+++ libntfs/attrib.c Fri Jul 22 01:05:09 2005 |
3 |
@@ -709,9 +709,9 @@ |
4 |
*/ |
5 |
s64 ntfs_attr_pread(ntfs_attr *na, const s64 pos, s64 count, void *b) |
6 |
{ |
7 |
- s64 br, to_read, ofs, total, total2; |
8 |
+ s64 br, old_to_read, to_read, ofs, total, total2; |
9 |
ntfs_volume *vol; |
10 |
runlist_element *rl; |
11 |
|
12 |
Dprintf("%s(): Entering for inode 0x%llx, attr 0x%x, pos 0x%llx, " |
13 |
"count 0x%llx.\n", __FUNCTION__, |
14 |
@@ -741,6 +744,7 @@ |
15 |
if (pos + count > na->data_size) { |
16 |
if (pos >= na->data_size) |
17 |
return 0; |
18 |
+ Dprintf("trunacting read pos=%lld, na->data_size=%lld, (old) count=%lld\n", pos, na->data_size, count); |
19 |
count = na->data_size - pos; |
20 |
} |
21 |
vol = na->ni->vol; |
22 |
@@ -820,6 +825,10 @@ |
23 |
/* It is a real lcn, read it into @dst. */ |
24 |
to_read = min(count, (rl->length << vol->cluster_size_bits) - |
25 |
ofs); |
26 |
+ old_to_read = to_read; |
27 |
+ to_read = (to_read + 511) / 512 * 512; |
28 |
+ if(old_to_read != to_read) |
29 |
+ Dprintf("adjusted %lld->%lld\n", old_to_read, to_read); |
30 |
retry: |
31 |
Dprintf("%s(): Reading 0x%llx bytes from vcn 0x%llx, lcn 0x%llx, " |
32 |
"ofs 0x%llx.\n", __FUNCTION__, to_read, |
33 |
@@ -828,6 +837,8 @@ |
34 |
ofs, to_read, b); |
35 |
/* If everything ok, update progress counters and continue. */ |
36 |
if (br > 0) { |
37 |
+ if(br > old_to_read) |
38 |
+ br = old_to_read; |
39 |
total += br; |
40 |
count -= br; |
41 |
b = (u8*)b + br; |
42 |
--- libntfs/device.c Sat Sep 4 13:16:32 2004 |
43 |
+++ libntfs/device.c Mon Jul 11 23:27:55 2005 |
44 |
@@ -441,10 +441,10 @@ |
45 |
*/ |
46 |
static inline int ntfs_device_offset_valid(struct ntfs_device *dev, s64 ofs) |
47 |
{ |
48 |
- char ch; |
49 |
+ char ch[512]; |
50 |
|
51 |
if (dev->d_ops->seek(dev, ofs, SEEK_SET) >= 0 && |
52 |
- dev->d_ops->read(dev, &ch, 1) == 1) |
53 |
+ dev->d_ops->read(dev, &ch, 512) > 0) |
54 |
return 0; |
55 |
return -1; |
56 |
} |
57 |
--- ntfsprogs/ntfsclone.c Mon Jul 25 12:31:30 2005 |
58 |
+++ ntfsprogs/ntfsclone.c Mon Jul 25 12:33:32 2005 |
59 |
@@ -1080,9 +1080,9 @@ |
60 |
|
61 |
static int device_offset_valid(int fd, s64 ofs) |
62 |
{ |
63 |
- char ch; |
64 |
+ char ch[512]; |
65 |
|
66 |
- if (lseek(fd, ofs, SEEK_SET) >= 0 && read(fd, &ch, 1) == 1) |
67 |
+ if (lseek(fd, ofs, SEEK_SET) >= 0 && read(fd, &ch, 512) > 0) |
68 |
return 0; |
69 |
return -1; |
70 |
} |
71 |
--- ntfsprogs/ntfsresize.c Fri Oct 7 23:57:31 2005 |
72 |
+++ ntfsprogs/ntfsresize.c Tue Oct 11 13:35:09 2005 |
73 |
@@ -1971,6 +1971,11 @@ |
74 |
err_exit("Resident attribute in $Bitmap isn't supported!\n"); |
75 |
|
76 |
bm_bsize = nr_clusters_to_bitmap_byte_size(resize->new_volume_size); |
77 |
+ if(bm_bsize % 512 != 0) { |
78 |
+ s64 old_bm_bsize = bm_bsize; |
79 |
+ bm_bsize = (bm_bsize + 511) / 512 * 512; |
80 |
+ Dprintf("adjusted bm_bsize: %lld->%lld\n", old_bm_bsize, bm_bsize); |
81 |
+ } |
82 |
nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size); |
83 |
|
84 |
if (resize->shrink) { |