int _kvm_stat_udf(kvm_t *kd, struct kinfo_file *kf, struct vnode *vp) { struct unode up; struct file_entry fentry; struct umount um; if (KREAD(kd, (u_long)VTOU(vp), &up)) { _kvm_err(kd, kd->program, "can't read unode at %p", VTOU(vp)); return (-1); } if (KREAD(kd, (u_long)up.u_fentry, &fentry)) { _kvm_err(kd, kd->program, "can't read file_entry at %p", up.u_fentry); return (-1); } if (KREAD(kd, (u_long)up.u_ump, &um)) { _kvm_err(kd, kd->program, "can't read umount at %p", up.u_ump); return (-1); } kf->va_fsid = up.u_dev; kf->va_fileid = (long)up.u_ino; kf->va_mode = udf_permtomode(&up); /* XXX */ kf->va_rdev = 0; if (vp->v_type & VDIR) { /* * Directories that are recorded within their ICB will show * as having 0 blocks recorded. Since tradition dictates * that directories consume at least one logical block, * make it appear so. */ if (fentry.logblks_rec != 0) { kf->va_size = letoh64(fentry.logblks_rec) * um.um_bsize; } else { kf->va_size = um.um_bsize; } } else { kf->va_size = letoh64(fentry.inf_len); } return (0); }
int udf_vptofh(struct vnode *vp, struct fid *fhp) { struct unode *up; struct ifid *ifhp; up = VTOU(vp); ifhp = (struct ifid *)fhp; ifhp->ifid_len = sizeof(struct ifid); ifhp->ifid_ino = up->u_ino; return (0); }
/* Get a vnode for the Virtual Allocation Table (VAT) */ int udf_vat_get(struct umount *ump, uint32_t lb) { struct vnode *vp; struct unode *up; int error; error = udf_vget(ump->um_mountp, lb - ump->um_start - 3, &vp); if (error) return (error); up = VTOU(vp); up->u_vatlen = (letoh64(up->u_fentry->inf_len) - 36) >> 2; ump->um_vat = malloc(sizeof(struct unode), M_UDFMOUNT, M_WAITOK); *ump->um_vat = *up; ump->um_flags &= ~UDF_MNT_FIND_VAT; ump->um_flags |= UDF_MNT_USES_VAT; vput(vp); return (0); }