diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile index 229adc6015f716..e20518910ba3ef 100644 --- a/lib/libprocstat/Makefile +++ b/lib/libprocstat/Makefile @@ -52,18 +52,23 @@ MLINKS+=libprocstat.3 procstat_close.3 \ libprocstat.3 procstat_open_kvm.3 \ libprocstat.3 procstat_open_sysctl.3 -# XXX This is a hack. .if ${MK_CDDL} != "no" CFLAGS+= -DLIBPROCSTAT_ZFS SRCS+= zfs.c -OBJS+= zfs/zfs_defs.o -SUBDIR= zfs -zfs/zfs_defs.o: .PHONY - @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.o -zfs/zfs_defs.pico: .PHONY - @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pico -zfs/zfs_defs.pieo: .PHONY - @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.pieo +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs +CFLAGS.zfs.c+= -DIN_BASE +CFLAGS.zfs.c+= -DHAVE_ISSETUGID +CFLAGS.zfs.c+= -DZFS_DEBUG +CFLAGS.zfs.c+= -I${ZFSTOP}/include +CFLAGS.zfs.c+= -I${ZFSTOP}/lib/libspl/include +CFLAGS.zfs.c+= -I${ZFSTOP}/lib/libspl/include/os/freebsd +CFLAGS.zfs.c+= -I${ZFSTOP}/include/os/freebsd/zfs +CFLAGS.zfs.c+= -I${ZFSTOP}/module/icp/include +CFLAGS.zfs.c+= -I${SRCTOP}/sys +CFLAGS.zfs.c+= -I${SRCTOP}/sys/modules/zfs +CFLAGS.zfs.c+= -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h +CFLAGS.zfs.c+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS.zfs.c+= -Wno-cast-qual .endif .include diff --git a/lib/libprocstat/cd9660.c b/lib/libprocstat/cd9660.c index de1140145527af..ec37f49df0f6b4 100644 --- a/lib/libprocstat/cd9660.c +++ b/lib/libprocstat/cd9660.c @@ -52,9 +52,8 @@ #include -#define _KERNEL +#define _WANT_ISO_MNT #include -#undef _KERNEL #include #include diff --git a/lib/libprocstat/msdosfs.c b/lib/libprocstat/msdosfs.c index bb1ad65e6b1a4e..01345bb8d3349a 100644 --- a/lib/libprocstat/msdosfs.c +++ b/lib/libprocstat/msdosfs.c @@ -44,17 +44,15 @@ #include #include #include +#include #include -#define _KERNEL -#include +#define _WANT_MSDOSFS_INTERNALS #include #include -#undef _KERNEL - -#include #include +#include #include #include @@ -62,13 +60,6 @@ #include #include -/* - * XXX - - * VTODE is defined in denode.h only if _KERNEL is defined, but that leads to - * header explosion - */ -#define VTODE(vp) ((struct denode *)getvnodedata(vp)) - #include "libprocstat.h" #include "common_kvm.h" diff --git a/lib/libprocstat/smbfs.c b/lib/libprocstat/smbfs.c index 136cceacb47155..cbd32cf8f59727 100644 --- a/lib/libprocstat/smbfs.c +++ b/lib/libprocstat/smbfs.c @@ -32,9 +32,8 @@ #include #include #include -#define _KERNEL +#define _WANT_MOUNT #include -#undef _KERNEL #include diff --git a/lib/libprocstat/udf.c b/lib/libprocstat/udf.c index 9a110950f8b05f..3298af6dec5fc6 100644 --- a/lib/libprocstat/udf.c +++ b/lib/libprocstat/udf.c @@ -32,9 +32,7 @@ #include #include #include -#define _KERNEL #include -#undef _KERNEL #include diff --git a/lib/libprocstat/zfs.c b/lib/libprocstat/zfs.c index 665b1e5abe24fc..6dc23d7573fde7 100644 --- a/lib/libprocstat/zfs.c +++ b/lib/libprocstat/zfs.c @@ -26,39 +26,36 @@ * SUCH DAMAGE. */ -#include /* __RENAME */ - -#include - #include -#define _KERNEL +#define _WANT_MOUNT #include -#undef _KERNEL #include #include #include #include #include +#define _WANT_ZNODE +#include +#include #include #include #include +#include #include #include #define ZFS #include "libprocstat.h" #include "common_kvm.h" -#include "zfs_defs.h" int zfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn) { struct mount mount, *mountptr; - void *znodeptr; - char *dataptr; + znode_t *kznodeptr, *znode; size_t len; int size; @@ -67,27 +64,30 @@ zfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn) warnx("error getting sysctl"); return (1); } - dataptr = malloc(size); - if (dataptr == NULL) { + znode = malloc(size); + if (znode == NULL) { warnx("error allocating memory for znode storage"); return (1); } - if ((size_t)size < offsetof_z_id + sizeof(uint64_t) || - (size_t)size < offsetof_z_mode + sizeof(mode_t) || - (size_t)size < offsetof_z_size + sizeof(uint64_t)) { + if ((size_t)size != sizeof(znode_t)) + warnx("znode_t size mismatch, data could be wrong"); + + if ((size_t)size < offsetof(znode_t, z_id) + sizeof(znode->z_id) || + (size_t)size < offsetof(znode_t, z_mode) + sizeof(znode->z_mode) || + (size_t)size < offsetof(znode_t, z_size) + sizeof(znode->z_size)) { warnx("znode_t size is too small"); goto bad; } - if ((size_t)size != sizeof_znode_t) - warnx("znode_t size mismatch, data could be wrong"); - - /* Since we have problems including vnode.h, we'll use the wrappers. */ - znodeptr = getvnodedata(vp); - if (!kvm_read_all(kd, (unsigned long)znodeptr, dataptr, - (size_t)size)) { - warnx("can't read znode at %p", (void *)znodeptr); + /* + * OpenZFS's libspl provides a dummy sys/vnode.h that shadows ours so + * struct vnode is an incomplete type. Use the wrapper until that is + * resolved. + */ + kznodeptr = getvnodedata(vp); + if (!kvm_read_all(kd, (unsigned long)kznodeptr, znode, (size_t)size)) { + warnx("can't read znode at %p", (void *)kznodeptr); goto bad; } @@ -103,12 +103,10 @@ zfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn) * under .zfs/. */ vn->vn_fsid = mount.mnt_stat.f_fsid.val[0]; - vn->vn_fileid = *(uint64_t *)(void *)(dataptr + offsetof_z_id); - vn->vn_mode = *(mode_t *)(void *)(dataptr + offsetof_z_mode); - vn->vn_size = *(uint64_t *)(void *)(dataptr + offsetof_z_size); - free(dataptr); + vn->vn_fileid = znode->z_id; + vn->vn_mode = znode->z_mode; + vn->vn_size = znode->z_size; return (0); bad: - free(dataptr); return (1); } diff --git a/lib/libprocstat/zfs/Makefile b/lib/libprocstat/zfs/Makefile deleted file mode 100644 index 5e1ebd44d1d33f..00000000000000 --- a/lib/libprocstat/zfs/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -.PATH: ${.CURDIR:H} - -SRCS= zfs_defs.c -OBJS= zfs_defs.o -WARNS?= 1 - -FORTIFY_SOURCE= 0 - -# We fake a kernel compilation environment in order to get the definition for -# 'zpool_t'. -CFLAGS+= -DIN_BASE -D__KERNEL__ -D_KERNEL -UKLD_TIED -DKLD_MODULE -CFLAGS+= -DHAVE_ISSETUGID -D_SYS_VMEM_H_ - -CFLAGS+= -fno-builtin -nostdlib - -CFLAGS+= -I${.CURDIR} -CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include -CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl -CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs -CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd -CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include -CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include -CFLAGS+= -I${SRCTOP}/sys -I. -I.. - -CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h - -all: ${OBJS} -CLEANFILES= ${OBJS} - -.include diff --git a/lib/libprocstat/zfs/Makefile.depend b/lib/libprocstat/zfs/Makefile.depend deleted file mode 100644 index 993ab0638f4ae7..00000000000000 --- a/lib/libprocstat/zfs/Makefile.depend +++ /dev/null @@ -1,11 +0,0 @@ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - include \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/lib/libprocstat/zfs_defs.c b/lib/libprocstat/zfs_defs.c deleted file mode 100644 index 7f935c827118ee..00000000000000 --- a/lib/libprocstat/zfs_defs.c +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Andriy Gapon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -/* - * Prevent some headers from getting included and fake some types - * in order to allow this file to compile without bringing in - * too many kernel build dependencies. - */ -#define _OPENSOLARIS_SYS_PATHNAME_H_ -#define _OPENSOLARIS_SYS_POLICY_H_ -#define _VNODE_PAGER_ - - -enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, - VMARKER }; - -/* - * Vnode attributes. A field value of VNOVAL represents a field whose value - * is unavailable (getattr) or which is not to be changed (setattr). - */ -struct vattr { - enum vtype va_type; /* vnode type (for create) */ - u_short va_mode; /* files access mode and type */ - u_short va_padding0; - uid_t va_uid; /* owner user id */ - gid_t va_gid; /* owner group id */ - nlink_t va_nlink; /* number of references to file */ - dev_t va_fsid; /* filesystem id */ - ino_t va_fileid; /* file id */ - u_quad_t va_size; /* file size in bytes */ - long va_blocksize; /* blocksize preferred for i/o */ - struct timespec va_atime; /* time of last access */ - struct timespec va_mtime; /* time of last modification */ - struct timespec va_ctime; /* time file changed */ - struct timespec va_birthtime; /* time file created */ - u_long va_gen; /* generation number of file */ - u_long va_flags; /* flags defined for file */ - dev_t va_rdev; /* device the special file represents */ - u_quad_t va_bytes; /* bytes of disk space held by file */ - u_quad_t va_filerev; /* file modification number */ - u_int va_vaflags; /* operations flags, see below */ - long va_spare; /* remain quad aligned */ -}; - -#define _WANT_MOUNT -#include -#include - -size_t sizeof_znode_t = sizeof(znode_t); -size_t offsetof_z_id = offsetof(znode_t, z_id); -size_t offsetof_z_size = offsetof(znode_t, z_size); -size_t offsetof_z_mode = offsetof(znode_t, z_mode); - -/* Keep pcpu.h satisfied. */ -uintptr_t *__start_set_pcpu; -uintptr_t *__stop_set_pcpu; diff --git a/lib/libprocstat/zfs_defs.h b/lib/libprocstat/zfs_defs.h deleted file mode 100644 index de17efba5630c4..00000000000000 --- a/lib/libprocstat/zfs_defs.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Andriy Gapon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _LIBPROCSTAT_ZFS_DEFS_H -#define _LIBPROCSTAT_ZFS_DEFS_H - -extern size_t sizeof_znode_t; -extern size_t offsetof_z_id; -extern size_t offsetof_z_size; -extern size_t offsetof_z_mode; - -#endif /* _LIBPROCSTAT_ZFS_DEFS_H */ diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h index b292818750d9de..15e3affba0e871 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h @@ -29,6 +29,7 @@ #ifndef _FREEBSD_ZFS_SYS_ZNODE_IMPL_H #define _FREEBSD_ZFS_SYS_ZNODE_IMPL_H +#ifdef _KERNEL #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#endif #ifdef __cplusplus extern "C" { @@ -54,7 +56,7 @@ extern "C" { */ #define ZNODE_OS_FIELDS \ struct zfsvfs *z_zfsvfs; \ - vnode_t *z_vnode; \ + struct vnode *z_vnode; \ char *z_cached_symlink; \ uint64_t z_uid; \ uint64_t z_gid; \ @@ -62,6 +64,8 @@ extern "C" { uint64_t z_atime[2]; \ uint64_t z_links; +#ifdef _KERNEL + #define ZFS_LINK_MAX UINT64_MAX /* @@ -183,6 +187,9 @@ extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp, char *buf, uint64_t buflen); extern int zfs_rlimit_fsize(off_t fsize); + +#endif /* _KERNEL */ + #ifdef __cplusplus } #endif diff --git a/sys/contrib/openzfs/include/sys/zfs_vfsops.h b/sys/contrib/openzfs/include/sys/zfs_vfsops.h index 18cc31e7183fec..8b8f73cf354097 100644 --- a/sys/contrib/openzfs/include/sys/zfs_vfsops.h +++ b/sys/contrib/openzfs/include/sys/zfs_vfsops.h @@ -27,7 +27,7 @@ #ifndef _SYS_ZFS_VFSOPS_H #define _SYS_ZFS_VFSOPS_H -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_ZNODE) #include #endif diff --git a/sys/contrib/openzfs/include/sys/zfs_znode.h b/sys/contrib/openzfs/include/sys/zfs_znode.h index b3a267e16f3ea1..2fedaff78534d8 100644 --- a/sys/contrib/openzfs/include/sys/zfs_znode.h +++ b/sys/contrib/openzfs/include/sys/zfs_znode.h @@ -163,8 +163,9 @@ extern int zfs_obj_to_pobj(objset_t *osp, sa_handle_t *hdl, sa_attr_type_t *sa_table, uint64_t *pobjp, int *is_xattrdir); extern int zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value); -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_ZNODE) #include +#include /* * Directory entry locks control access to directory entries. @@ -219,7 +220,9 @@ typedef struct znode { */ ZNODE_OS_FIELDS; } znode_t; +#endif +#ifdef _KERNEL /* Verifies the znode is valid. */ static inline int zfs_verify_zp(znode_t *zp) diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index 63ce5f50949a1f..40047cc92de65b 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -212,7 +212,7 @@ struct iso_extended_attributes { u_char len_au [ISODCL (247, 250)]; /* 723 */ }; -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_ISO_MNT) /* CD-ROM Format type */ enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, @@ -253,6 +253,10 @@ struct iso_mnt { void *im_l2d; }; +#endif /* defined(_KERNEL) || defined(_WANT_ISO_MNT) */ + +#ifdef _KERNEL + struct ifid { u_short ifid_len; u_short ifid_pad; diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index 0d31b0583fa6bd..e6928fb4605214 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -212,7 +212,7 @@ struct denode { ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) -#if defined(_KERNEL) || defined(MAKEFS) +#if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) #define VTODE(vp) ((struct denode *)(vp)->v_data) #define DETOV(de) ((de)->de_vnode) @@ -294,5 +294,5 @@ int removede(struct denode *pdep, struct denode *dep); int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred); int doscheckpath( struct denode *source, struct denode *target, daddr_t *wait_scn); -#endif /* _KERNEL || MAKEFS */ +#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */ #endif /* !_FS_MSDOSFS_DENODE_H_ */ diff --git a/sys/fs/msdosfs/fat.h b/sys/fs/msdosfs/fat.h index a88bfb94e91daf..344cd5a9416dbf 100644 --- a/sys/fs/msdosfs/fat.h +++ b/sys/fs/msdosfs/fat.h @@ -81,7 +81,7 @@ #define MSDOSFSEOF(pmp, cn) ((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) -#if defined (_KERNEL) || defined(MAKEFS) +#if defined (_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) /* * These are the values for the function argument to the function * fatentry(). @@ -110,5 +110,5 @@ markvoldirty(struct msdosfsmount *pmp, bool dirty) return (markvoldirty_upgrade(pmp, dirty, false)); } -#endif /* _KERNEL || MAKEFS */ +#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */ #endif /* !_FS_MSDOSFS_FAT_H_ */ diff --git a/sys/fs/msdosfs/msdosfsmount.h b/sys/fs/msdosfs/msdosfsmount.h index 8f15bc2eaf42e5..fcaac544a74d56 100644 --- a/sys/fs/msdosfs/msdosfsmount.h +++ b/sys/fs/msdosfs/msdosfsmount.h @@ -52,14 +52,17 @@ #ifndef _MSDOSFS_MSDOSFSMOUNT_H_ #define _MSDOSFS_MSDOSFSMOUNT_H_ -#if defined (_KERNEL) || defined(MAKEFS) +#if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) #include -#ifndef MAKEFS +#ifdef _KERNEL #include #include -#include +#else +#include +#include #endif +#include #include #ifdef MALLOC_DECLARE @@ -114,11 +117,9 @@ struct msdosfsmount { void *pm_w2u; /* Unicode->Local iconv handle */ void *pm_u2d; /* Unicode->DOS iconv handle */ void *pm_d2u; /* DOS->Local iconv handle */ -#ifndef MAKEFS struct lock pm_fatlock; /* lockmgr protecting allocations */ struct lock pm_checkpath_lock; /* protects doscheckpath result */ struct task pm_rw2ro_task; /* context for emergency remount ro */ -#endif }; /* @@ -245,9 +246,9 @@ struct msdosfs_fileno { #define MSDOSFS_ASSERT_MP_LOCKED(pmp) \ lockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED) -#endif /* _KERNEL || MAKEFS */ +#endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */ -#ifndef MAKEFS +#ifdef _KERNEL /* * Arguments to mount MSDOS filesystems. */ @@ -265,7 +266,7 @@ struct msdosfs_args { char *cs_local; /* Local Charset */ mode_t dirmask; /* dir mask to be applied for msdosfs perms */ }; -#endif /* MAKEFS */ +#endif /* _KERNEL */ /* * Msdosfs mount options: diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 66822a5aadc26b..a6f858e023956a 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -32,15 +32,19 @@ #ifndef _SYS_MOUNT_H_ #define _SYS_MOUNT_H_ +#include #include #include #ifdef _KERNEL -#include #include #include #include #include #include +#elif defined(_WANT_MOUNT) +#include +#include +#include #endif /* diff --git a/tools/build/Makefile b/tools/build/Makefile index 40ac498bfbb461..83f589ce38642a 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -270,6 +270,12 @@ subr_capability.c: ${SRCTOP}/sys/kern/subr_capability.c cp ${.ALLSRC} ${.TARGET} SRCS+= subr_capability.c CLEANFILES+= subr_capability.c + +# Headers needed for msdosfs use in makefs +SYSINCS+= ${SRCTOP}/sys/sys/_callout.h +SYSINCS+= ${SRCTOP}/sys/sys/_lock.h +SYSINCS+= ${SRCTOP}/sys/sys/_lockmgr.h +SYSINCS+= ${SRCTOP}/sys/sys/_task.h .endif # ${MAKE.OS} != "FreeBSD" CASPERINC+= ${SRCTOP}/lib/libcasper/services/cap_fileargs/cap_fileargs.h diff --git a/tools/build/cross-build/include/common/sys/_types.h b/tools/build/cross-build/include/common/sys/_types.h index 408f0537d1e626..dc1b76f2506378 100644 --- a/tools/build/cross-build/include/common/sys/_types.h +++ b/tools/build/cross-build/include/common/sys/_types.h @@ -48,3 +48,6 @@ typedef __builtin_va_list __va_list; /* Needed for opensolaris compat. */ typedef __int64_t off64_t; + +/* Needed for sys/_callout.h */ +typedef __int64_t __sbintime_t; diff --git a/usr.sbin/makefs/msdos/Makefile.inc b/usr.sbin/makefs/msdos/Makefile.inc index 78ddc7804b31e3..cfa9e0e114c2fe 100644 --- a/usr.sbin/makefs/msdos/Makefile.inc +++ b/usr.sbin/makefs/msdos/Makefile.inc @@ -3,7 +3,7 @@ MSDOS_NEWFS= ${SRCTOP}/sbin/newfs_msdos .PATH: ${SRCDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} -CFLAGS+= -DMAKEFS -I${MSDOS} -I${MSDOS_NEWFS} +CFLAGS+= -DMAKEFS -D_WANT_MSDOSFS_INTERNALS -I${MSDOS} -I${MSDOS_NEWFS} SRCS+= mkfs_msdos.c SRCS+= msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c