2011/8/17 Michal Nazarewicz <mina86@xxxxxxxxxx>: > On Wed, 17 Aug 2011 10:19:40 +0200, Barry Song <Baohua.Song@xxxxxxx> wrote: >> >> @@ -835,7 +835,8 @@ static int do_read(struct fsg_common *common) >> } else if (nread < amount) { >> LDBG(curlun, "partial file read: %d/%u\n", >> (int)nread, amount); >> - nread -= (nread & 511); /* Round down to a block >> */ >> + nread -= (nread & (curlun->blksize - 1)); >> + /* Round down to a block */ > > How about: “nread = round_down(nread, curlun->blksize)”? This also applies > to > other places in f_mass_storage.c and file_storage.c files. that's definitely good to use the genefic round_down macro. i guess the original code just used nread &= 511 even without round_down. > >> } >> file_offset += nread; >> amount_left -= nread; > -barry ��.n��������+%������w��{.n�����{���)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥