Open metcenger opened 4 days ago
I suppose, you made mistake in the code:
in while should be:
if(read_size != remain)
not a <
Check and confirm it pls.
On first read, "remain" is bigger than read_size. On last read, "remain" become smaller than read_size. There should be: if(read_size > remain)
Therefore, not like a <
?
And should be a >
not a !=
?
I noticed, in first read, "remain" is equal to read_size. 4096 = 4096
"remain" is initial from here: "int remain = size;" What's the value of "size" you trans?
I transferred size = 4096. Total size of file = 11481 I made 2 rounds in while with 4096- no problems and 3nd round- I had 11481- 2*4096= 3289 like rest bytes
while(remain){
int read_size = vcn_size - vcn_offset;
if(read_size != remain) // was a <
read_size = remain;
in this part I always have read_size = 4096 (sector size)
Therefore, we should use a >
or !=
If I have small file (13 Bytes), and call
static int ntfs_read(void *fs_super, void *fd, void *in_buf, int size)
no problems- buffer is being filled properly and I can read this buffer.
But if I have another file to read (1 Mb), I should run this part of code:
And in this case, project goes to Abort handler.
So I have a question- If I have large file, and buffer transferred like an argument, size of this buffer is 2048, and size like the argument (I transferred 2048), how can I call this function many times to get my file in parts for 2048?