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 <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
@ -28,11 +28,12 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/dirent.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.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_mtim, ZPL_ATIME, &bonussz);
|
||||||
fs_populate_time(fs, attrbuf, &sb->st_ctim, ZPL_CTIME, &bonussz);
|
fs_populate_time(fs, attrbuf, &sb->st_ctim, ZPL_CTIME, &bonussz);
|
||||||
fs_populate_time(fs, attrbuf, &sb->st_mtim, ZPL_MTIME, &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);
|
fs_populate_time(fs, attrbuf, &sb->st_birthtim, ZPL_CRTIME, &bonussz);
|
||||||
|
#endif
|
||||||
|
|
||||||
fs_populate_varszattr(fs, attrbuf, aces, sizeof(aces), 0,
|
fs_populate_varszattr(fs, attrbuf, aces, sizeof(aces), 0,
|
||||||
ZPL_DACL_ACES, &bonussz);
|
ZPL_DACL_ACES, &bonussz);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <util.h>
|
#include <util.h>
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#define _MAKEFS_ZFS_H_
|
#define _MAKEFS_ZFS_H_
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/endian.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
|
|
||||||
#include <bitstring.h>
|
#include <bitstring.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user