/*
 * DF-2819 helper: print sizeof/alignment of the tmpfs zone objects as
 * compiled into this exact kernel.  Build as a KLD and kldload it.
 */
#include <sys/param.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <vfs/tmpfs/tmpfs.h>

static int
szprobe_event(module_t mod, int type, void *data)
{
	switch (type) {
	case MOD_LOAD:
		kprintf("SZPROBE node=%zd nodealign=%zd dirent=%zd direntalign=%zd\n",
			sizeof(struct tmpfs_node),
			__VM_CACHELINE_ALIGN(sizeof(struct tmpfs_node)),
			sizeof(struct tmpfs_dirent),
			__VM_CACHELINE_ALIGN(sizeof(struct tmpfs_dirent)));
		return 0;
	case MOD_UNLOAD:
		return 0;
	}
	return (EOPNOTSUPP);
}

static moduledata_t szprobe_mod = { "szprobe", szprobe_event, NULL };
DECLARE_MODULE(szprobe, szprobe_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
