Message ID | CACQ1gAg_s8S8V5AWN4pR9XKqctyeYZpW_mtD3XczDde5Y+9Y4A@mail.gmail.com |
---|---|
State | New, archived |
Headers | show |
2012/9/11 Cheney Chen <cheneychencl2012@gmail.com>: > I add the case _FILE_OFFSET_BITS=64 into the file Android.mk, compile them > and try it again. it dose not work. > > + LOCAL_CFLAGS = -O2 -Wall -D_FILE_OFFSET_BITS=64 > > Why not use uint64_t? It seems that there's a problem somewhere in the android makefiles, because you don't need to define _FILE_OFFSET_BITS yourself, it should be enabled by common.mk (in mtd-utils), unless WITHOUT_LARGEFILE=1 is set. maybe try to grep WITHOUT_LARGEFILE in your project, and make the mtd_utils with V=1. you should see -D_FILE_OFFSET_BITS=64 in the compilation log. If not, something in your project had disabled it. (maybe you're using µClibc without large file support, or buildroot which disables it for mtd-utils or...) It's better to use off_t because the prototype of lseek is: off_t lseek(int fd, off_t offset, int whence); cf man lseek64: lseek(2) uses the type off_t. This is a 32-bit signed type on 32-bit architectures, unless one compiles with #define _FILE_OFFSET_BITS 64 in which case it is a 64-bit signed type. (and off_t is signed, not unsigned)
diff --git a/ubi-utils/libubigen.c b/ubi-utils/libubigen.c index 9eaa7f5..d2a949b 100644 --- a/ubi-utils/libubigen.c +++ b/ubi-utils/libubigen.c @@ -279,7 +279,7 @@ int ubigen_write_layout_vol(const struct ubigen_info *ui, int peb1, int peb2, memset(outbuf + ui->data_offs + ui->vtbl_size, 0xFF, ui->peb_size - ui->data_offs - ui->vtbl_size); - seek = peb1 * ui->peb_size; + seek = (off_t) peb1 * ui->peb_size; if (lseek(fd, seek, SEEK_SET) != seek) { sys_errmsg("cannot seek output file");