FreeBSD/lib/libprocstat/libprocstat.c
/*
 * Vnode type to filestate translation.
 */
Vnode type to filestate translation.
Vnode type to filestate translation .
static int
vntype2psfsttype(int type)
{
	static struct {
		int	vtype; 
		int	fst_vtype;
	} vt2fst[] = {
		{ VBAD, PS_FST_VTYPE_VBAD },
		{ VBLK, PS_FST_VTYPE_VBLK },
		{ VCHR, PS_FST_VTYPE_VCHR },
		{ VDIR, PS_FST_VTYPE_VDIR },
		{ VFIFO, PS_FST_VTYPE_VFIFO },
		{ VLNK, PS_FST_VTYPE_VLNK },
		{ VNON, PS_FST_VTYPE_VNON },
		{ VREG, PS_FST_VTYPE_VREG },
		{ VSOCK, PS_FST_VTYPE_VSOCK }
	};
#define	NVFTYPES	(sizeof(vt2fst) / sizeof(*vt2fst))
	unsigned int i, fst_type;
	fst_type = PS_FST_VTYPE_UNKNOWN;
	for (i = 0; i < NVFTYPES; i++) {
		if (type == vt2fst[i].vtype) {
			fst_type = vt2fst[i].fst_vtype;
			break;
		}
	}
	return (fst_type);
}
static int vntype2psfsttype ( int type ) { static struct { int vtype ; int fst_vtype ; } vt2fst [ ] = { { VBAD , PS_FST_VTYPE_VBAD } , { VBLK , PS_FST_VTYPE_VBLK } , { VCHR , PS_FST_VTYPE_VCHR } , { VDIR , PS_FST_VTYPE_VDIR } , { VFIFO , PS_FST_VTYPE_VFIFO } , { VLNK , PS_FST_VTYPE_VLNK } , { VNON , PS_FST_VTYPE_VNON } , { VREG , PS_FST_VTYPE_VREG } , { VSOCK , PS_FST_VTYPE_VSOCK } } ; #define NVFTYPES 	(sizeof(vt2fst) / sizeof(*vt2fst)) unsigned int i , fst_type ; fst_type = PS_FST_VTYPE_UNKNOWN ; for ( i = 0 ; i < NVFTYPES ; i ++ ) { if ( type == vt2fst [ i ] . vtype ) { fst_type = vt2fst [ i ] . fst_vtype ; break ; } } return ( fst_type ) ; }
Vnode type to filestate translation.
Vnode type to filestate translation .