Source
939
939
940
940
/*
941
941
* Read the aligned data in file into aligned buffer first, then copy the data
942
942
* into the final buffer. If the data size is bigger than maximal copy buffer
943
943
* size, do the reading by segment (the outer while loop). If not, do one step
944
944
* reading.
945
945
*/
946
946
do {
947
947
/* Read the aligned data in file first. Not able to handle interrupted
948
948
* system calls and partial results like sec2 driver does because the
949
-
* data may no longer be aligned. It's expecially true when the data in
949
+
* data may no longer be aligned. It's especially true when the data in
950
950
* file is smaller than ALLOC_SIZE. */
951
951
HDmemset(copy_buf, 0, alloc_size);
952
952
953
953
/* Calculate how much data we have to read in this iteration
954
954
* (including unused parts of blocks) */
955
955
if((copy_size + copy_offset) < alloc_size)
956
956
read_size = ((copy_size + copy_offset - 1) / _fbsize + 1)
957
957
* _fbsize;
958
958
else
959
959
read_size = alloc_size;
1124
1124
/* Calculate how much data we have to write in this iteration
1125
1125
* (including unused parts of blocks) */
1126
1126
if((copy_size + copy_offset) < alloc_size)
1127
1127
write_size = ((copy_size + copy_offset - 1) / _fbsize + 1)
1128
1128
* _fbsize;
1129
1129
else
1130
1130
write_size = alloc_size;
1131
1131
1132
1132
/*
1133
1133
* Read the aligned data first if the aligned region doesn't fall
1134
-
* entirely in the range to be writen. Not able to handle interrupted
1134
+
* entirely in the range to be written. Not able to handle interrupted
1135
1135
* system calls and partial results like sec2 driver does because the
1136
-
* data may no longer be aligned. It's expecially true when the data in
1136
+
* data may no longer be aligned. It's especially true when the data in
1137
1137
* file is smaller than ALLOC_SIZE. Only read the entire section if
1138
1138
* both ends are misaligned, otherwise only read the block on the
1139
1139
* misaligned end.
1140
1140
*/
1141
1141
HDmemset(copy_buf, 0, _fbsize);
1142
1142
1143
1143
if(copy_offset > 0) {
1144
1144
if((write_addr + write_size) > (addr + size)) {
1145
1145
HDassert((write_addr + write_size) - (addr + size) < _fbsize);
1146
1146
read_size = write_size;