gmzang / maczfs

Automatically exported from code.google.com/p/maczfs
Other
0 stars 0 forks source link

Inconsistent wrapping around stat/stat64 #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
10.5 added stat64, and the OpenSolaris codebase uses stat64 a lot. However, in 
10.6, stat is 
preferred.

There's an #ifdef that can support using either (according to the man page): 
_DARWIN_USE_64_BIT_INODE

There's code around some stat/stat64 methods as follows:

#if _DARWIN_FEATURE_64_BIT_INODE
                struct stat statbuf;
#else
        struct stat64 statbuf;
#endif

However, this seems to be different to the _DARWIN_USE from the man pages vs 
_DARWIN_FEATURE from the (current) code. Yet more uses __APPLE__ around such 
differentiators.

Original issue reported on code.google.com by alex.ble...@gmail.com on 20 Feb 2010 at 3:33

GoogleCodeExporter commented 9 years ago
This affects 

./usr/src/lib/libzfs/common/libzfs_import.c
./usr/src/lib/libzfs/common/libzfs_util.c

Original comment by alex.ble...@gmail.com on 19 Jul 2010 at 11:29

GoogleCodeExporter commented 9 years ago
I think something like:

#ifdef _DARWIN_FEATURE_64_BIT_INODE
#define stat64 stat
#define fstat64 fstat
#define lstat64 lstat
#endif

in the zfs_context would allow us to get rid of most of the #ifdefs, if this 
works.

Original comment by alex.ble...@gmail.com on 19 Jul 2010 at 11:52

GoogleCodeExporter commented 9 years ago
Pushed a fix to 
http://github.com/alblue/mac-zfs/commit/73564c331a37c997d73aee418b5ffde2901e4a7d
 - however, after compiling it with/without the feature, it seemed to work. 
Further testing is still required to see if this indeed fixes the issue, or 
whether we should define _DARWIN_FEATURE_64_BIT_INODE at the build time. (May 
address some other filesystem time related issues)

Original comment by alex.ble...@gmail.com on 20 Jul 2010 at 12:05