mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
makefs: Fix issues building as a cross-tool on non-FreeBSD
This adds missing includes, uses the standard dirent.h rather than the
BSD-specific sys/dirent.h subset (which works on macOS but not Linux)
and works around Linux's lack of st_birthtim.
This allows usr.sbin/makefs to be added to LOCAL_XTOOL_DIRS again on
macOS and Linux so that disk images can be cross-built.
Reviewed by: markj
Fixes: 240afd8c1f
("makefs: Add ZFS support")
Differential Revision: https://reviews.freebsd.org/D36135
This commit is contained in:
parent
548f8a657b
commit
c6890399fc
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <util.h>
|
||||
|
|
|
@ -28,11 +28,12 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -456,7 +457,12 @@ fs_populate_sattrs(struct fs_populate_arg *arg, const fsnode *cur,
|
|||
fs_populate_time(fs, attrbuf, &sb->st_mtim, ZPL_ATIME, &bonussz);
|
||||
fs_populate_time(fs, attrbuf, &sb->st_ctim, ZPL_CTIME, &bonussz);
|
||||
fs_populate_time(fs, attrbuf, &sb->st_mtim, ZPL_MTIME, &bonussz);
|
||||
#ifdef __linux__
|
||||
/* Linux has no st_birthtim; approximate with st_ctim */
|
||||
fs_populate_time(fs, attrbuf, &sb->st_ctim, ZPL_CRTIME, &bonussz);
|
||||
#else
|
||||
fs_populate_time(fs, attrbuf, &sb->st_birthtim, ZPL_CRTIME, &bonussz);
|
||||
#endif
|
||||
|
||||
fs_populate_varszattr(fs, attrbuf, aces, sizeof(aces), 0,
|
||||
ZPL_DACL_ACES, &bonussz);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <util.h>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <util.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define _MAKEFS_ZFS_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <bitstring.h>
|
||||
|
|
Loading…
Reference in a new issue