#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hfs_vnops.c,v 1.40 2022/08/06 18:26:42 andvar Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/vmmeter.h>
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/buf.h>
#include <sys/dirent.h>
#include <sys/msgbuf.h>
#include <miscfs/fifofs/fifo.h>
#include <miscfs/specfs/specdev.h>
#include <fs/hfs/hfs.h>
#include <fs/hfs/unicode.h>
#include <miscfs/genfs/genfs.h>
int hfs_vop_parsepath(void *);
int hfs_vop_lookup(void *);
int hfs_vop_open(void *);
int hfs_vop_close(void *);
int hfs_vop_access(void *);
int hfs_vop_getattr(void *);
int hfs_vop_setattr(void *);
int hfs_vop_bmap(void *);
int hfs_vop_read(void *);
int hfs_vop_readdir(void *);
int hfs_vop_readlink(void *);
int hfs_vop_reclaim(void *);
int hfs_vop_print(void *);
#ifdef HFS_DEBUG
#define DPRINTF(a) printf a
#else
#define DPRINTF(a)
#endif
int (**hfs_vnodeop_p) (void *);
const struct vnodeopv_entry_desc hfs_vnodeop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_parsepath_desc, genfs_parsepath },
{ &vop_lookup_desc, hfs_vop_lookup },
{ &vop_create_desc, genfs_eopnotsupp },
{ &vop_whiteout_desc, genfs_eopnotsupp },
{ &vop_mknod_desc, genfs_eopnotsupp },
{ &vop_open_desc, hfs_vop_open },
{ &vop_close_desc, hfs_vop_close },
{ &vop_access_desc, hfs_vop_access },
{ &vop_accessx_desc, genfs_accessx },
{ &vop_getattr_desc, hfs_vop_getattr },
{ &vop_setattr_desc, hfs_vop_setattr },
{ &vop_read_desc, hfs_vop_read },
{ &vop_write_desc, genfs_eopnotsupp },
{ &vop_fallocate_desc, genfs_eopnotsupp },
{ &vop_fdiscard_desc, genfs_eopnotsupp },
{ &vop_ioctl_desc, genfs_eopnotsupp },
{ &vop_fcntl_desc, genfs_fcntl },
{ &vop_poll_desc, genfs_eopnotsupp },
{ &vop_kqfilter_desc, genfs_kqfilter },
{ &vop_revoke_desc, genfs_eopnotsupp },
{ &vop_mmap_desc, genfs_mmap },
{ &vop_fsync_desc, genfs_nullop },
{ &vop_seek_desc, genfs_seek },
{ &vop_remove_desc, genfs_eopnotsupp },
{ &vop_link_desc, genfs_eopnotsupp },
{ &vop_rename_desc, genfs_eopnotsupp },
{ &vop_mkdir_desc, genfs_eopnotsupp },
{ &vop_rmdir_desc, genfs_eopnotsupp },
{ &vop_symlink_desc, genfs_eopnotsupp },
{ &vop_readdir_desc, hfs_vop_readdir },
{ &vop_readlink_desc, hfs_vop_readlink },
{ &vop_abortop_desc, genfs_abortop },
{ &vop_inactive_desc, genfs_eopnotsupp },
{ &vop_reclaim_desc, hfs_vop_reclaim },
{ &vop_lock_desc, genfs_lock },
{ &vop_unlock_desc, genfs_unlock },
{ &vop_bmap_desc, hfs_vop_bmap },
{ &vop_strategy_desc, genfs_eopnotsupp },
{ &vop_print_desc, hfs_vop_print },
{ &vop_islocked_desc, genfs_islocked },
{ &vop_pathconf_desc, genfs_eopnotsupp },
{ &vop_advlock_desc, genfs_eopnotsupp },
{ &vop_bwrite_desc, genfs_eopnotsupp },
{ &vop_getpages_desc, genfs_getpages },
{ &vop_putpages_desc, genfs_putpages },
{ &vop_openextattr_desc, genfs_eopnotsupp },
{ &vop_closeextattr_desc, genfs_eopnotsupp },
{ &vop_getextattr_desc, genfs_eopnotsupp },
{ &vop_setextattr_desc, genfs_eopnotsupp },
{ &vop_listextattr_desc, genfs_eopnotsupp },
{ &vop_deleteextattr_desc, genfs_eopnotsupp },
{ NULL, NULL }
};
const struct vnodeopv_desc hfs_vnodeop_opv_desc =
{ &hfs_vnodeop_p, hfs_vnodeop_entries };
int (**hfs_specop_p) (void *);
const struct vnodeopv_entry_desc hfs_specop_entries[] = {
{ &vop_default_desc, vn_default_error },
GENFS_SPECOP_ENTRIES,
{ &vop_close_desc, spec_close },
{ &vop_access_desc, hfs_vop_access },
{ &vop_accessx_desc, genfs_accessx },
{ &vop_getattr_desc, hfs_vop_getattr },
{ &vop_setattr_desc, hfs_vop_setattr },
{ &vop_read_desc, spec_read },
{ &vop_write_desc, spec_write },
{ &vop_fcntl_desc, genfs_fcntl },
{ &vop_fsync_desc, spec_fsync },
{ &vop_inactive_desc, genfs_eopnotsupp },
{ &vop_reclaim_desc, hfs_vop_reclaim },
{ &vop_lock_desc, genfs_lock },
{ &vop_unlock_desc, genfs_unlock },
{ &vop_print_desc, hfs_vop_print },
{ &vop_islocked_desc, genfs_islocked },
{ &vop_bwrite_desc, vn_bwrite },
#if 0
{ &vop_openextattr_desc, hfs_openextattr },
{ &vop_closeextattr_desc, hfs_closeextattr },
{ &vop_getextattr_desc, hfs_getextattr },
{ &vop_setextattr_desc, hfs_setextattr },
{ &vop_listextattr_desc, hfs_listextattr },
{ &vop_deleteextattr_desc, hfs_deleteextattr },
#endif
{ NULL, NULL }
};
const struct vnodeopv_desc hfs_specop_opv_desc =
{ &hfs_specop_p, hfs_specop_entries };
int (**hfs_fifoop_p) (void *);
const struct vnodeopv_entry_desc hfs_fifoop_entries[] = {
{ &vop_default_desc, vn_default_error },
GENFS_FIFOOP_ENTRIES,
{ &vop_close_desc, vn_fifo_bypass },
{ &vop_access_desc, hfs_vop_access },
{ &vop_accessx_desc, genfs_accessx },
{ &vop_getattr_desc, hfs_vop_getattr },
{ &vop_setattr_desc, hfs_vop_setattr },
{ &vop_read_desc, vn_fifo_bypass },
{ &vop_write_desc, vn_fifo_bypass },
{ &vop_fcntl_desc, genfs_fcntl },
{ &vop_fsync_desc, vn_fifo_bypass },
{ &vop_inactive_desc, genfs_eopnotsupp },
{ &vop_reclaim_desc, hfs_vop_reclaim },
{ &vop_lock_desc, genfs_lock },
{ &vop_unlock_desc, genfs_unlock },
{ &vop_strategy_desc, vn_fifo_bypass },
{ &vop_print_desc, hfs_vop_print },
{ &vop_islocked_desc, genfs_islocked },
{ &vop_bwrite_desc, vn_bwrite },
#if 0
{ &vop_openextattr_desc, hfs_openextattr },
{ &vop_closeextattr_desc, hfs_closeextattr },
{ &vop_getextattr_desc, hfs_getextattr },
{ &vop_setextattr_desc, hfs_setextattr },
{ &vop_listextattr_desc, hfs_listextattr },
{ &vop_deleteextattr_desc, hfs_deleteextattr },
#endif
{ NULL, NULL }
};
const struct vnodeopv_desc hfs_fifoop_opv_desc =
{ &hfs_fifoop_p, hfs_fifoop_entries };
int
hfs_vop_parsepath(void *v)
{
struct vop_parsepath_args
*ap = v;
size_t len;
int error;
error = genfs_parsepath(v);
if (error) {
return error;
}
len = *ap->a_retval;
if (!strcmp(ap->a_name + len, "/rsrc")) {
*ap->a_retval += 5;
}
return 0;
}
int
hfs_vop_lookup(void *v)
{
struct vop_lookup_v2_args
*ap = v;
struct componentname *cnp;
struct hfsnode *dp;
kauth_cred_t cred;
struct vnode **vpp;
struct vnode *tdp;
struct vnode *vdp;
hfs_catalog_key_t key;
hfs_catalog_keyed_record_t rec;
size_t namelen;
int use_resource_fork = 0;
unichar_t* unicn;
const char *pname;
int error;
int flags;
int result;
DPRINTF(("VOP = hfs_vop_lookup()\n"));
cnp = ap->a_cnp;
cred = cnp->cn_cred;
vdp = ap->a_dvp;
dp = VTOH(vdp);
error = 0;
pname = cnp->cn_nameptr;
result = 0;
unicn = NULL;
vpp = ap->a_vpp;
*vpp = NULL;
flags = cnp->cn_flags;
if ((error = VOP_ACCESS(vdp, VEXEC, cred)) != 0)
return error;
if ((flags & ISLASTCN) && (vdp->v_mount->mnt_flag & MNT_RDONLY) &&
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
return EROFS;
#if 0
if ((error = cache_lookup(vdp, vpp, cnp)) >= 0)
return error;
#endif
#if 0
if (cnp->cn_namelen == 1 && *pname == '.') {
*vpp = vdp;
vref(vdp);
return 0;
}
#endif
if (flags & ISDOTDOT) {
DPRINTF(("DOTDOT "));
error = hfs_vget_internal(vdp->v_mount, dp->h_parent,
HFS_RSRCFORK, &tdp);
if (error != 0)
goto error;
*vpp = tdp;
#if 0
} else if (dp->h_rec.u.cnid == rec.file.u.cnid) {
#endif
} else if (cnp->cn_namelen == 1 && pname[0] == '.') {
DPRINTF(("DOT "));
vref(vdp);
*vpp = vdp;
} else {
hfs_callback_args cbargs;
uint8_t len, ni;
hfslib_init_cbargs(&cbargs);
namelen = cnp->cn_namelen;
if (namelen > 5 &&
!strcmp(cnp->cn_nameptr + namelen - 5, "/rsrc")) {
namelen -= 5;
use_resource_fork = 1;
}
unicn = malloc(namelen * sizeof(unicn[0]), M_TEMP, M_WAITOK);
len = utf8_to_utf16(unicn, namelen,
cnp->cn_nameptr, namelen, 0, NULL);
for (ni = 0; ni < len; ni++)
if (unicn[ni] == (unichar_t)':')
unicn[ni] = (unichar_t)'/';
if (hfslib_make_catalog_key(VTOH(vdp)->h_rec.u.cnid, len, unicn,
&key) == 0) {
DPRINTF(("ERROR in hfslib_make_catalog_key\n"));
error = EINVAL;
goto error;
}
result = hfslib_find_catalog_record_with_key(&dp->h_hmp->hm_vol,
&key, &rec, &cbargs);
if (result > 0) {
error = EINVAL;
goto error;
}
if (result < 0) {
if (cnp->cn_nameiop == CREATE)
error = EROFS;
else
error = ENOENT;
goto error;
}
if (rec.file.user_info.file_type == HFS_HARD_LINK_FILE_TYPE
&& rec.file.user_info.file_creator == HFS_HFSLUS_CREATOR) {
if (hfslib_get_hardlink(&dp->h_hmp->hm_vol,
rec.file.bsd.special.inode_num,
&rec, &cbargs) != 0) {
error = EINVAL;
goto error;
}
}
if (rec.type == HFS_REC_FILE
&& use_resource_fork
&& rec.file.rsrc_fork.logical_size > 0) {
error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
HFS_RSRCFORK, &tdp);
} else
error = hfs_vget_internal(vdp->v_mount, rec.file.cnid,
HFS_DATAFORK, &tdp);
if (error != 0)
goto error;
*vpp = tdp;
}
DPRINTF(("\n"));
#if 0
cache_enter(vdp, *vpp, cnp);
#endif
error = 0;
error:
if (unicn != NULL)
free(unicn, M_TEMP);
return error;
}
int
hfs_vop_open(void *v)
{
#if 0
struct vop_open_args
*ap = v;
struct hfsnode *hn = VTOH(ap->a_vp);
#endif
DPRINTF(("VOP = hfs_vop_open()\n"));
return 0;
}
int
hfs_vop_close(void *v)
{
#if 0
struct vop_close_args
*ap = v;
struct hfsnode *hn = VTOH(ap->a_vp);
#endif
DPRINTF(("VOP = hfs_vop_close()\n"));
return 0;
}
static int
hfs_check_possible(struct vnode *vp, accmode_t accmode)
{
if (accmode & VWRITE) {
switch (vp->v_type) {
case VDIR:
case VLNK:
case VREG:
return EROFS;
default:
break;
}
}
return 0;
}
static int
hfs_check_permitted(vnode_t *vp, struct vattr *va, accmode_t accmode,
kauth_cred_t cred)
{
return kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(accmode,
va->va_type, va->va_mode), vp, NULL, genfs_can_access(vp, cred,
va->va_uid, va->va_gid, va->va_mode, NULL, accmode));
}
int
hfs_vop_access(void *v)
{
struct vop_access_args
*ap = v;
struct vattr va;
int error;
DPRINTF(("VOP = hfs_vop_access()\n"));
error = hfs_check_possible(ap->a_vp, ap->a_accmode);
if (error)
return error;
if ((error = VOP_GETATTR(ap->a_vp, &va, ap->a_cred)) != 0)
return error;
error = hfs_check_permitted(ap->a_vp, &va, ap->a_accmode, ap->a_cred);
return error;
}
int
hfs_vop_getattr(void *v)
{
struct vop_getattr_args
*ap = v;
struct vnode *vp;
struct hfsnode *hp;
struct vattr *vap;
hfs_bsd_data_t *bsd;
hfs_fork_t *fork;
DPRINTF(("VOP = hfs_vop_getattr()\n"));
vp = ap->a_vp;
hp = VTOH(vp);
vap = ap->a_vap;
vattr_null(vap);
vap->va_type = ap->a_vp->v_type;
if (hp->h_rec.u.rec_type == HFS_REC_FILE) {
hfs_file_record_t *f = &hp->h_rec.file;
if (hp->h_fork == HFS_RSRCFORK)
fork = &f->rsrc_fork;
else
fork = &f->data_fork;
vap->va_fileid = f->cnid;
bsd = &f->bsd;
vap->va_bytes = fork->total_blocks * HFS_BLOCKSIZE(vp);
vap->va_size = fork->logical_size;
hfs_time_to_timespec(f->date_created, &vap->va_ctime);
hfs_time_to_timespec(f->date_content_mod, &vap->va_mtime);
hfs_time_to_timespec(f->date_accessed, &vap->va_atime);
vap->va_nlink = 1;
} else if (hp->h_rec.u.rec_type == HFS_REC_FLDR) {
hfs_folder_record_t *f = &hp->h_rec.folder;
vap->va_fileid = hp->h_rec.folder.cnid;
bsd = &f->bsd;
vap->va_size = 512;
vap->va_bytes = 512;
hfs_time_to_timespec(f->date_created, &vap->va_ctime);
hfs_time_to_timespec(f->date_content_mod,&vap->va_mtime);
hfs_time_to_timespec(f->date_accessed, &vap->va_atime);
vap->va_nlink = 2;
} else {
DPRINTF(("hfs+: hfs_vop_getattr(): invalid record type %i",
hp->h_rec.u.rec_type));
return EINVAL;
}
if ((bsd->file_mode & S_IFMT) == 0) {
if (hp->h_rec.u.rec_type == HFS_REC_FILE)
vap->va_mode = (S_IFREG | HFS_DEFAULT_FILE_MODE);
else
vap->va_mode = (S_IFDIR | HFS_DEFAULT_DIR_MODE);
vap->va_uid = HFS_DEFAULT_UID;
vap->va_gid = HFS_DEFAULT_GID;
} else {
vap->va_mode = bsd->file_mode;
vap->va_uid = bsd->owner_id;
vap->va_gid = bsd->group_id;
if ((vap->va_mode & S_IFMT) == S_IFCHR
|| (vap->va_mode & S_IFMT) == S_IFBLK) {
vap->va_rdev
= HFS_CONVERT_RDEV(bsd->special.raw_device);
}
else if (bsd->special.link_count != 0) {
vap->va_nlink = bsd->special.link_count;
}
}
vap->va_fsid = hp->h_dev;
vap->va_blocksize = hp->h_hmp->hm_vol.vh.block_size;
vap->va_gen = 1;
vap->va_flags = 0;
return 0;
}
int
hfs_vop_setattr(void *v)
{
struct vop_setattr_args
*ap = v;
struct vattr *vap;
struct vnode *vp;
vap = ap->a_vap;
vp = ap->a_vp;
if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
(vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
(vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
return EINVAL;
}
if (vap->va_flags != VNOVAL
|| vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL
|| vap->va_atime.tv_sec != VNOVAL || vap->va_mtime.tv_sec != VNOVAL
|| vap->va_birthtime.tv_sec != VNOVAL) {
return EROFS;
}
if (vap->va_size != VNOVAL) {
switch (vp->v_type) {
case VDIR:
return EISDIR;
case VCHR:
case VBLK:
case VFIFO:
break;
case VREG:
return EROFS;
default:
return EOPNOTSUPP;
}
}
return 0;
}
int
hfs_vop_bmap(void *v)
{
struct vop_bmap_args
*ap = v;
struct vnode *vp;
struct hfsnode *hp;
daddr_t lblkno;
hfs_callback_args cbargs;
hfs_libcb_argsread argsread;
hfs_extent_descriptor_t *extents;
uint16_t numextents, i;
int bshift;
vp = ap->a_vp;
hp = VTOH(vp);
lblkno = ap->a_bn;
bshift = vp->v_mount->mnt_fs_bshift;
if (ap->a_vpp != NULL)
*ap->a_vpp = hp->h_devvp;
if (ap->a_bnp == NULL)
return 0;
hfslib_init_cbargs(&cbargs);
argsread.cred = NULL;
argsread.l = NULL;
cbargs.read = &argsread;
numextents = hfslib_get_file_extents(&hp->h_hmp->hm_vol,
hp->h_rec.u.cnid, hp->h_fork, &extents, &cbargs);
if (numextents == 0)
return EBADF;
for (i = 0; i < numextents; i++) {
if (lblkno < extents[i].block_count)
break;
lblkno -= extents[i].block_count;
}
if (i == numextents) {
i--;
lblkno += extents[i].block_count;
}
*ap->a_bnp = ((extents[i].start_block + lblkno) << (bshift-DEV_BSHIFT))
+ (hp->h_hmp->hm_vol.offset >> DEV_BSHIFT);
if (ap->a_runp) {
int nblk;
nblk = extents[i].block_count - lblkno - 1;
if (nblk <= 0)
*ap->a_runp = 0;
else if (nblk > MAXBSIZE >> bshift)
*ap->a_runp = (MAXBSIZE >> bshift) - 1;
else
*ap->a_runp = nblk;
}
free(extents, M_TEMP);
return 0;
}
int
hfs_vop_read(void *v)
{
struct vop_read_args
*ap = v;
struct vnode *vp;
struct hfsnode *hp;
struct uio *uio;
uint64_t fsize;
int advice;
int error;
vp = ap->a_vp;
hp = VTOH(vp);
uio = ap->a_uio;
if (hp->h_fork == HFS_RSRCFORK)
fsize = hp->h_rec.file.rsrc_fork.logical_size;
else
fsize = hp->h_rec.file.data_fork.logical_size;
error = 0;
advice = IO_ADV_DECODE(ap->a_ioflag);
if (uio->uio_offset < 0)
return EINVAL;
if (uio->uio_resid == 0 || uio->uio_offset >= fsize)
return 0;
if (vp->v_type != VREG && vp->v_type != VLNK)
return EINVAL;
error = 0;
while (uio->uio_resid > 0 && error == 0) {
vsize_t len;
len = MIN(uio->uio_resid, fsize - uio->uio_offset);
if (len == 0)
break;
error = ubc_uiomove(&vp->v_uobj, uio, len, advice,
UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
}
return error;
}
int
hfs_vop_readdir(void *v)
{
struct vop_readdir_args
*ap = v;
DPRINTF(("VOP = hfs_vop_readdir()\n"));
struct dirent curent;
struct hfsnode *hp;
hfs_catalog_keyed_record_t *children;
hfs_unistr255_t *childnames;
hfs_callback_args cbargs;
hfs_libcb_argsread argsread;
struct uio *uio;
off_t bufoff;
uint32_t numchildren;
uint32_t curchild;
size_t namlen, ni;
int error;
int i;
bufoff = 0;
children = NULL;
error = 0;
numchildren = 0;
hp = VTOH(ap->a_vp);
uio = ap->a_uio;
if (uio->uio_offset < 0)
return EINVAL;
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 0;
#if 0
if(ap->a_eofflag != NULL || ap->a_cookies != NULL ||
ap->a_ncookies != NULL)
return EOPNOTSUPP;
#endif
DPRINTF(("READDIR uio: offset=%td, resid=%zu\n",
uio->uio_offset, uio->uio_resid));
hfslib_init_cbargs(&cbargs);
argsread.cred = ap->a_cred;
argsread.l = NULL;
cbargs.read = &argsread;
if (hfslib_get_directory_contents(&hp->h_hmp->hm_vol, hp->h_rec.u.cnid,
&children, &childnames, &numchildren, &cbargs) != 0) {
DPRINTF(("ENOENT\n"));
error = ENOENT;
goto error;
}
DPRINTF(("numchildren = %u\n", numchildren));
for (curchild = 0; curchild < numchildren && uio->uio_resid > 0;
curchild++) {
namlen = utf16_to_utf8(curent.d_name, NAME_MAX,
childnames[curchild].unicode, childnames[curchild].length,
0, NULL);
if (namlen > NAME_MAX) {
continue;
}
for (ni = 0; ni < namlen; ni++)
if (curent.d_name[ni] == '/')
curent.d_name[ni] = ':';
curent.d_namlen = namlen;
curent.d_reclen = _DIRENT_SIZE(&curent);
bufoff += curent.d_reclen;
if (bufoff - curent.d_reclen < uio->uio_offset)
continue;
if (uio->uio_resid < curent.d_reclen) {
DPRINTF(("PARTIAL ENTRY\n"));
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
break;
}
curent.d_fileno = children[curchild].file.cnid;
switch (hfs_catalog_keyed_record_vtype(children+curchild)) {
case VREG:
curent.d_type = DT_REG;
break;
case VDIR:
curent.d_type = DT_DIR;
break;
case VBLK:
curent.d_type = DT_BLK;
break;
case VCHR:
curent.d_type = DT_CHR;
break;
case VLNK:
curent.d_type = DT_LNK;
break;
case VSOCK:
curent.d_type = DT_SOCK;
break;
case VFIFO:
curent.d_type = DT_FIFO;
break;
default:
curent.d_type = DT_UNKNOWN;
break;
}
DPRINTF(("curchildname = %s\t\t", curchildname));
for (i = curent.d_namlen;
i < curent.d_reclen - _DIRENT_NAMEOFF(&curent); i++)
curent.d_name[i] = 0;
DPRINTF(("curent.d_name = %s\n", curent.d_name));
if ((error = uiomove(&curent, curent.d_reclen, uio)) != 0)
goto error;
}
error:
if (numchildren > 0) {
if (children != NULL)
free(children, M_TEMP);
if (childnames != NULL)
free(childnames, M_TEMP);
}
if (error) {
DPRINTF(("ERROR = %i\n", error));
}
return error;
}
int
hfs_vop_readlink(void *v) {
struct vop_readlink_args
*ap = v;
return VOP_READ(ap->a_vp, ap->a_uio, 0, ap->a_cred);
}
int
hfs_vop_reclaim(void *v)
{
struct vop_reclaim_v2_args
*ap = v;
struct vnode *vp;
struct hfsnode *hp;
VOP_UNLOCK(ap->a_vp);
DPRINTF(("VOP = hfs_vop_reclaim()\n"));
vp = ap->a_vp;
hp = VTOH(vp);
if (hp->h_devvp) {
vrele(hp->h_devvp);
hp->h_devvp = 0;
}
genfs_node_destroy(vp);
pool_put(&hfs_node_pool, hp);
vp->v_data = NULL;
return 0;
}
int
hfs_vop_print(void *v)
{
struct vop_print_args
*ap = v;
struct vnode *vp;
struct hfsnode *hp;
DPRINTF(("VOP = hfs_vop_print()\n"));
vp = ap->a_vp;
hp = VTOH(vp);
printf("dummy = %X\n", (unsigned)hp->dummy);
printf("\n");
return 0;
}