printf("kernfs_getattr: stat rootdir\n");
struct kern_target *kt = VTOKERN(vp)->kf_kt; printf("kernfs_getattr: stat rootdir (%s)\n", kt->kt_name);
kernfs_getattr(v)	void *v;{	struct vop_getattr_args /* {		struct vnode *a_vp;		struct vattr *a_vap;		struct ucred *a_cred;		struct proc *a_p;	} */ *ap = v;	struct vnode *vp = ap->a_vp;	struct vattr *vap = ap->a_vap;	struct timeval tv;	int error = 0;	char strbuf[KSTRING], *buf;	bzero((caddr_t) vap, sizeof(*vap));	vattr_null(vap);	vap->va_uid = 0;	vap->va_gid = 0;	vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];	vap->va_size = 0;	vap->va_blocksize = DEV_BSIZE;	microtime(&tv);	TIMEVAL_TO_TIMESPEC(&tv, &vap->va_atime);	vap->va_mtime = vap->va_atime;	vap->va_ctime = vap->va_atime;	vap->va_gen = 0;	vap->va_flags = 0;	vap->va_rdev = 0;	vap->va_bytes = 0;	if (vp->v_flag & VROOT) {#ifdef KERNFS_DIAGNOSTIC		printf("kernfs_getattr: stat rootdir\n");#endif		vap->va_type = VDIR;		vap->va_mode = DIR_MODE;		vap->va_nlink = 2;		vap->va_fileid = 2;		vap->va_size = DEV_BSIZE;	} else {		struct kern_target *kt = VTOKERN(vp)->kf_kt;		int nbytes, total;#ifdef KERNFS_DIAGNOSTIC		printf("kernfs_getattr: stat target %s\n", kt->kt_name);#endif		vap->va_type = kt->kt_vtype;		vap->va_mode = kt->kt_mode;		vap->va_nlink = 1;		vap->va_fileid = 3 + (kt - kern_targets);		total = 0;		while (buf = strbuf,		       nbytes = kernfs_xread(kt, total, &buf, sizeof(strbuf)))			total += nbytes;		vap->va_size = total;	}#ifdef KERNFS_DIAGNOSTIC	printf("kernfs_getattr: return error %d\n", error);#endif	return (error);}