FreeBSD/lib/libprocstat/libprocstat.c
/*
 * kinfo vnode type to filestat translation.
 */
kinfo vnode type to filestat translation.
kinfo vnode type to filestat translation .
static int
kinfo_vtype2fst(int kfvtype)
{
	static struct {
		int	kf_vtype; 
		int	fst_vtype;
	} kfvtypes2fst[] = {
		{ KF_VTYPE_VBAD, PS_FST_VTYPE_VBAD },
		{ KF_VTYPE_VBLK, PS_FST_VTYPE_VBLK },
		{ KF_VTYPE_VCHR, PS_FST_VTYPE_VCHR },
		{ KF_VTYPE_VDIR, PS_FST_VTYPE_VDIR },
		{ KF_VTYPE_VFIFO, PS_FST_VTYPE_VFIFO },
		{ KF_VTYPE_VLNK, PS_FST_VTYPE_VLNK },
		{ KF_VTYPE_VNON, PS_FST_VTYPE_VNON },
		{ KF_VTYPE_VREG, PS_FST_VTYPE_VREG },
		{ KF_VTYPE_VSOCK, PS_FST_VTYPE_VSOCK }
	};
#define	NKFVTYPES	(sizeof(kfvtypes2fst) / sizeof(*kfvtypes2fst))
	unsigned int i;
	for (i = 0; i < NKFVTYPES; i++)
		if (kfvtypes2fst[i].kf_vtype == kfvtype)
			break;
	if (i == NKFVTYPES)
		return (PS_FST_VTYPE_UNKNOWN);
	return (kfvtypes2fst[i].fst_vtype);
}
static int kinfo_vtype2fst ( int kfvtype ) { static struct { int kf_vtype ; int fst_vtype ; } kfvtypes2fst [ ] = { { KF_VTYPE_VBAD , PS_FST_VTYPE_VBAD } , { KF_VTYPE_VBLK , PS_FST_VTYPE_VBLK } , { KF_VTYPE_VCHR , PS_FST_VTYPE_VCHR } , { KF_VTYPE_VDIR , PS_FST_VTYPE_VDIR } , { KF_VTYPE_VFIFO , PS_FST_VTYPE_VFIFO } , { KF_VTYPE_VLNK , PS_FST_VTYPE_VLNK } , { KF_VTYPE_VNON , PS_FST_VTYPE_VNON } , { KF_VTYPE_VREG , PS_FST_VTYPE_VREG } , { KF_VTYPE_VSOCK , PS_FST_VTYPE_VSOCK } } ; #define NKFVTYPES 	(sizeof(kfvtypes2fst) / sizeof(*kfvtypes2fst)) unsigned int i ; for ( i = 0 ; i < NKFVTYPES ; i ++ ) if ( kfvtypes2fst [ i ] . kf_vtype == kfvtype ) break ; if ( i == NKFVTYPES ) return ( PS_FST_VTYPE_UNKNOWN ) ; return ( kfvtypes2fst [ i ] . fst_vtype ) ; }
kinfo vnode type to filestat translation.
kinfo vnode type to filestat translation .