Hi, Chih-Wei Huang wrote: > Hi, > I'm trying to port ntfs-3g to Android. > I have one question about the _FILE_OFFSET_BITS macro and off_t size. > I only saw _FILE_OFFSET_BITS be used in two files: > > include/fuse-lite/fuse_common.h > src/secaudit.c > > The prior just checks if _FILE_OFFSET_BITS is 64. > The latter just undef it which is more strange to me.
_FILE_OFFSET_BITS is usually defined in config.h In secaudit.c the undef is just before including config.h in order to cancel unwanted definitions (see below). > > So what's the purpose of _FILE_OFFSET_BITS and > how does it affect the code? I can't see it. _FILE_OFFSET_BITS is used in stdio.h to force a 64-bit definition of off_t on 32-bit computers. The aim is to give a transparent access to big files (> 2GB) for older programs not initially designed for big files, also for newer programs running both on 32-bit and 64-bit computers with the same source code. This of course depends on the clib you are using, and this is not used by compilers for Windows, hence the strange undef of _FILE_OFFSET_BITS which is designed to also run on Windows, where a different off_t definition may be needed for Windows library and for the ntfs-3g one. You may face a similar issue with Android. > Then how about the off_t which is 32-bit on android? > Should I redefine off_t to 64-bit, say off64_t? NTFS is designed for big files, and ntfs-3g requires a 64-bit definition of off_t, so you need to define _FILE_OFFSET_BITS on 32-bit computers (and you should not do it on 64-bit computers). Jean-Pierre ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ ntfs-3g-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel
