GC non-FreeBSD code that didn't work anyways.
This commit is contained in:
parent
e68347de23
commit
8a918adb2b
@ -310,9 +310,6 @@ struct cpisec {
|
||||
struct hpfsmount {
|
||||
struct sublock hpm_su;
|
||||
struct spblock hpm_sp;
|
||||
#if !defined(__FreeBSD__)
|
||||
struct netexport hpm_export;
|
||||
#endif
|
||||
struct mount * hpm_mp;
|
||||
struct vnode * hpm_devvp;
|
||||
dev_t hpm_dev;
|
||||
@ -389,26 +386,12 @@ MALLOC_DECLARE(M_HPFSNO);
|
||||
#define HPTOV(h) ((struct vnode *)((h)->h_vp))
|
||||
#define FID(f) (*((lsn_t *)(f)->fid_data))
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#define MALLOC_DEFINE(a, b, c)
|
||||
#define M_HPFSMNT M_TEMP
|
||||
#define M_HPFSNO M_TEMP
|
||||
typedef int (vop_t) __P((void *));
|
||||
#define HASHINIT(a, b, c, d) hashinit((a), (b), (c), (d))
|
||||
#define bqrelse(bp) brelse(bp)
|
||||
#define VOP__LOCK(a, b, c) VOP_LOCK((a), (b) ? LK_EXCLUSIVE : LK_SHARED)
|
||||
#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), 0)
|
||||
#define VGET(a, b, c) vget((a), LK_EXCLUSIVE)
|
||||
#define VN_LOCK(a, b, c) vn_lock((a), LK_EXCLUSIVE)
|
||||
#define LOCKMGR(a, b, c, d) lockmgr((a), (b), (c))
|
||||
#else /* defined(__FreeBSD__) */
|
||||
#define HASHINIT(a, b, c, d) hashinit((a), (b), (d))
|
||||
#define VOP__LOCK(a, b, c) VOP_LOCK((a), (b), (c))
|
||||
#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), (b), (c))
|
||||
#define VGET(a, b, c) vget((a), (b), (c))
|
||||
#define VN_LOCK(a, b, c) vn_lock((a), (b), (c))
|
||||
#define LOCKMGR(a, b, c, d) lockmgr((a), (b), (c), (d))
|
||||
#endif
|
||||
|
||||
extern vop_t ** hpfs_vnodeop_p;
|
||||
|
||||
|
@ -42,29 +42,23 @@
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#if defined(__NetBSD__)
|
||||
#include <vm/vm_prot.h>
|
||||
#endif
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#endif
|
||||
|
||||
#include <fs/hpfs/hpfs.h>
|
||||
#include <fs/hpfs/hpfsmount.h>
|
||||
#include <fs/hpfs/hpfs_subr.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
MALLOC_DEFINE(M_HPFSMNT, "HPFS mount", "HPFS mount structure");
|
||||
MALLOC_DEFINE(M_HPFSNO, "HPFS node", "HPFS node structure");
|
||||
|
||||
/* XXXKSE */
|
||||
#define a_p a_td
|
||||
#define cn_proc cn_thread
|
||||
#define proc thread
|
||||
#endif
|
||||
|
||||
struct sockaddr;
|
||||
|
||||
static int hpfs_root __P((struct mount *, struct vnode **));
|
||||
static int hpfs_statfs __P((struct mount *, struct statfs *,
|
||||
@ -77,97 +71,21 @@ static int hpfs_mountfs __P((register struct vnode *, struct mount *,
|
||||
static int hpfs_vptofh __P((struct vnode *, struct fid *));
|
||||
static int hpfs_fhtovp __P((struct mount *, struct fid *,
|
||||
struct vnode **));
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int hpfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
|
||||
struct proc *));
|
||||
static int hpfs_start __P((struct mount *, int, struct proc *));
|
||||
static int hpfs_sync __P((struct mount *, int, struct ucred *,
|
||||
struct proc *));
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
struct sockaddr;
|
||||
static int hpfs_mount __P((struct mount *, char *, caddr_t,
|
||||
struct nameidata *, struct thread *));
|
||||
static int hpfs_init __P((struct vfsconf *));
|
||||
static int hpfs_uninit __P((struct vfsconf *));
|
||||
#else /* defined(__NetBSD__) */
|
||||
static int hpfs_mount __P((struct mount *, const char *, void *,
|
||||
struct nameidata *, struct proc *));
|
||||
static void hpfs_init __P((void));
|
||||
static int hpfs_mountroot __P((void));
|
||||
static int hpfs_sysctl __P((int *, u_int, void *, size_t *, void *,
|
||||
size_t, struct proc *));
|
||||
static int hpfs_checkexp __P((struct mount *, struct mbuf *,
|
||||
int *, struct ucred **));
|
||||
#endif
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
hpfs_checkexp(mp, nam, exflagsp, credanonp)
|
||||
register struct mount *mp;
|
||||
struct mbuf *nam;
|
||||
int *exflagsp;
|
||||
struct ucred **credanonp;
|
||||
{
|
||||
register struct netcred *np;
|
||||
register struct hpfsmount *hpm = VFSTOHPFS(mp);
|
||||
|
||||
/*
|
||||
* Get the export permission structure for this <mp, client> tuple.
|
||||
*/
|
||||
np = vfs_export_lookup(mp, &hpm->hpm_export, nam);
|
||||
if (np == NULL)
|
||||
return (EACCES);
|
||||
|
||||
*exflagsp = np->netc_exflags;
|
||||
*credanonp = &np->netc_anon;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
hpfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
struct proc *p;
|
||||
{
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
static int
|
||||
hpfs_mountroot()
|
||||
{
|
||||
return (EINVAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static int
|
||||
hpfs_init (
|
||||
struct vfsconf *vcp )
|
||||
#else /* defined(__NetBSD__) */
|
||||
static void
|
||||
hpfs_init ()
|
||||
#endif
|
||||
{
|
||||
dprintf(("hpfs_init():\n"));
|
||||
|
||||
hpfs_hphashinit();
|
||||
#if defined(__FreeBSD__)
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static int
|
||||
hpfs_uninit (vfsp)
|
||||
struct vfsconf *vfsp;
|
||||
@ -175,18 +93,12 @@ hpfs_uninit (vfsp)
|
||||
hpfs_hphashdestroy();
|
||||
return 0;;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
hpfs_mount (
|
||||
struct mount *mp,
|
||||
#if defined(__FreeBSD__)
|
||||
char *path,
|
||||
caddr_t data,
|
||||
#else /* defined(__NetBSD__) */
|
||||
const char *path,
|
||||
void *data,
|
||||
#endif
|
||||
struct nameidata *ndp,
|
||||
struct proc *p )
|
||||
{
|
||||
@ -219,11 +131,7 @@ hpfs_mount (
|
||||
|
||||
if (args.fspec == 0) {
|
||||
dprintf(("export 0x%x\n",args.export.ex_flags));
|
||||
#if defined(__FreeBSD__)
|
||||
err = vfs_export(mp, &args.export);
|
||||
#else /* defined(__NetBSD__) */
|
||||
err = vfs_export(mp, &hpmp->hpm_export, &args.export);
|
||||
#endif
|
||||
if (err) {
|
||||
printf("hpfs_mount: vfs_export failed %d\n",
|
||||
err);
|
||||
@ -250,19 +158,8 @@ hpfs_mount (
|
||||
|
||||
devvp = ndp->ni_vp;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (!vn_isdisk(devvp, &err))
|
||||
goto error_2;
|
||||
#else /* defined(__NetBSD__) */
|
||||
if (devvp->v_type != VBLK) {
|
||||
err = ENOTBLK;
|
||||
goto error_2;
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev) {
|
||||
err = ENXIO;
|
||||
goto error_2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
********************
|
||||
@ -341,20 +238,14 @@ hpfs_mountfs(devvp, mp, argsp, p)
|
||||
if (error)
|
||||
return (error);
|
||||
ncount = vcount(devvp);
|
||||
#if defined(__FreeBSD__)
|
||||
if (devvp->v_object)
|
||||
ncount -= 1;
|
||||
#endif
|
||||
if (ncount > 1 && devvp != rootvp)
|
||||
return (EBUSY);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, p);
|
||||
error = vinvalbuf(devvp, V_SAVE, p->td_proc->p_ucred, p, 0, 0);
|
||||
VOP__UNLOCK(devvp, 0, p);
|
||||
#else
|
||||
error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0);
|
||||
#endif
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -426,13 +317,8 @@ hpfs_mountfs(devvp, mp, argsp, p)
|
||||
|
||||
vput(vp);
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
mp->mnt_stat.f_fsid.val[0] = (long)dev2udev(dev);
|
||||
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
|
||||
#else
|
||||
mp->mnt_stat.f_fsid.val[0] = (long)dev;
|
||||
mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_HPFS);
|
||||
#endif
|
||||
mp->mnt_maxsymlinklen = 0;
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
devvp->v_rdev->si_mountpoint = mp;
|
||||
@ -442,26 +328,11 @@ hpfs_mountfs(devvp, mp, argsp, p)
|
||||
if (bp)
|
||||
brelse (bp);
|
||||
mp->mnt_data = (qaddr_t)NULL;
|
||||
#if defined(__FreeBSD__)
|
||||
devvp->v_rdev->si_mountpoint = NULL;
|
||||
#else
|
||||
devvp->v_specflags &= ~SI_MOUNTEDON;
|
||||
#endif
|
||||
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
|
||||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
hpfs_start (
|
||||
struct mount *mp,
|
||||
int flags,
|
||||
struct proc *p )
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
hpfs_unmount(
|
||||
struct mount *mp,
|
||||
@ -487,11 +358,7 @@ hpfs_unmount(
|
||||
return (error);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
hpmp->hpm_devvp->v_rdev->si_mountpoint = NULL;
|
||||
#else
|
||||
hpmp->hpm_devvp->v_specflags &= ~SI_MOUNTEDON;
|
||||
#endif
|
||||
|
||||
vinvalbuf(hpmp->hpm_devvp, V_SAVE, NOCRED, p, 0, 0);
|
||||
error = VOP_CLOSE(hpmp->hpm_devvp, ronly ? FREAD : FREAD|FWRITE,
|
||||
@ -538,11 +405,7 @@ hpfs_statfs(
|
||||
dprintf(("hpfs_statfs(): HPFS%d.%d\n",
|
||||
hpmp->hpm_su.su_hpfsver, hpmp->hpm_su.su_fnctver));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
sbp->f_type = mp->mnt_vfc->vfc_typenum;
|
||||
#else /* defined(__NetBSD__) */
|
||||
sbp->f_type = 0;
|
||||
#endif
|
||||
sbp->f_bsize = DEV_BSIZE;
|
||||
sbp->f_iosize = DEV_BSIZE;
|
||||
sbp->f_blocks = hpmp->hpm_su.su_btotal;
|
||||
@ -560,30 +423,6 @@ hpfs_statfs(
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
hpfs_sync (
|
||||
struct mount *mp,
|
||||
int waitfor,
|
||||
struct ucred *cred,
|
||||
struct proc *p)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
hpfs_quotactl (
|
||||
struct mount *mp,
|
||||
int cmds,
|
||||
uid_t uid,
|
||||
caddr_t arg,
|
||||
struct proc *p)
|
||||
{
|
||||
printf("hpfs_quotactl():\n");
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
hpfs_fhtovp(
|
||||
@ -632,11 +471,7 @@ hpfs_vget(
|
||||
struct vnode *vp;
|
||||
struct hpfsnode *hp;
|
||||
struct buf *bp;
|
||||
#if defined(__FreeBSD__)
|
||||
struct thread *p = curthread; /* XXX */
|
||||
#else
|
||||
struct proc *p = curproc; /* XXX */
|
||||
#endif
|
||||
int error;
|
||||
|
||||
dprintf(("hpfs_vget(0x%x): ",ino));
|
||||
@ -735,7 +570,6 @@ hpfs_vget(
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static struct vfsops hpfs_vfsops = {
|
||||
hpfs_mount,
|
||||
vfs_stdstart,
|
||||
@ -753,30 +587,3 @@ static struct vfsops hpfs_vfsops = {
|
||||
vfs_stdextattrctl,
|
||||
};
|
||||
VFS_SET(hpfs_vfsops, hpfs, 0);
|
||||
#else /* defined(__NetBSD__) */
|
||||
extern struct vnodeopv_desc hpfs_vnodeop_opv_desc;
|
||||
|
||||
struct vnodeopv_desc *hpfs_vnodeopv_descs[] = {
|
||||
&hpfs_vnodeop_opv_desc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct vfsops hpfs_vfsops = {
|
||||
MOUNT_HPFS,
|
||||
hpfs_mount,
|
||||
hpfs_start,
|
||||
hpfs_unmount,
|
||||
hpfs_root,
|
||||
hpfs_quotactl,
|
||||
hpfs_statfs,
|
||||
hpfs_sync,
|
||||
hpfs_vget,
|
||||
hpfs_fhtovp,
|
||||
hpfs_vptofh,
|
||||
hpfs_init,
|
||||
hpfs_sysctl,
|
||||
hpfs_mountroot,
|
||||
hpfs_checkexp,
|
||||
hpfs_vnodeopv_descs,
|
||||
};
|
||||
#endif
|
||||
|
@ -43,23 +43,13 @@
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#if !defined(__FreeBSD__)
|
||||
#include <vm/vm_prot.h>
|
||||
#endif
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_pager.h>
|
||||
#include <vm/vm_zone.h>
|
||||
#if defined(__FreeBSD__)
|
||||
#include <vm/vnode_pager.h>
|
||||
#endif
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#endif
|
||||
|
||||
#include <sys/unistd.h> /* for pathconf(2) constants */
|
||||
|
||||
#include <fs/hpfs/hpfs.h>
|
||||
@ -67,11 +57,10 @@
|
||||
#include <fs/hpfs/hpfs_subr.h>
|
||||
#include <fs/hpfs/hpfs_ioctl.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/* XXXKSE */
|
||||
#define a_p a_td
|
||||
#define cn_proc cn_thread
|
||||
#define proc thread
|
||||
#endif
|
||||
|
||||
static int hpfs_de_uiomove __P((struct hpfsmount *, struct hpfsdirent *,
|
||||
struct uio *));
|
||||
@ -93,15 +82,9 @@ static int hpfs_lookup __P((struct vop_lookup_args *ap));
|
||||
static int hpfs_create __P((struct vop_create_args *));
|
||||
static int hpfs_remove __P((struct vop_remove_args *));
|
||||
static int hpfs_bmap __P((struct vop_bmap_args *ap));
|
||||
#if defined(__FreeBSD__)
|
||||
static int hpfs_fsync __P((struct vop_fsync_args *ap));
|
||||
#else
|
||||
static int hpfs_abortop __P((struct vop_abortop_args *));
|
||||
#endif
|
||||
static int hpfs_pathconf __P((struct vop_pathconf_args *ap));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
|
||||
static int
|
||||
hpfs_fsync(ap)
|
||||
struct vop_fsync_args /* {
|
||||
@ -149,8 +132,6 @@ hpfs_fsync(ap)
|
||||
return hpfs_update(VTOHP(vp));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
hpfs_ioctl (
|
||||
struct vop_ioctl_args /* {
|
||||
@ -304,10 +285,8 @@ hpfs_bmap(ap)
|
||||
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = hp->h_devvp;
|
||||
#if defined(__FreeBSD__)
|
||||
if (ap->a_runb != NULL)
|
||||
*ap->a_runb = 0;
|
||||
#endif
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
@ -481,11 +460,7 @@ hpfs_getattr(ap)
|
||||
|
||||
dprintf(("hpfs_getattr(0x%x):\n", hp->h_no));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
vap->va_fsid = dev2udev(hp->h_dev);
|
||||
#else /* defined(__NetBSD__) */
|
||||
vap->va_fsid = ip->i_dev;
|
||||
#endif
|
||||
vap->va_fileid = hp->h_no;
|
||||
vap->va_mode = hp->h_mode;
|
||||
vap->va_nlink = 1;
|
||||
@ -569,11 +544,7 @@ hpfs_setattr(ap)
|
||||
if (vp->v_mount->mnt_flag & MNT_RDONLY)
|
||||
return (EROFS);
|
||||
if (cred->cr_uid != hp->h_uid &&
|
||||
#if defined(__FreeBSD__)
|
||||
(error = suser_xxx(cred, p->td_proc, PRISON_ROOT)) &&
|
||||
#else
|
||||
(error = suser_xxx(cred, p, PRISON_ROOT)) &&
|
||||
#endif
|
||||
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
|
||||
(error = VOP_ACCESS(vp, VWRITE, cred, p))))
|
||||
return (error);
|
||||
@ -599,21 +570,15 @@ hpfs_setattr(ap)
|
||||
}
|
||||
|
||||
if (vap->va_size < hp->h_fn.fn_size) {
|
||||
#if defined(__FreeBSD__)
|
||||
error = vtruncbuf(vp, cred, p, vap->va_size, DEV_BSIZE);
|
||||
if (error)
|
||||
return (error);
|
||||
#else /* defined(__NetBSD__) */
|
||||
#error Need alternation for vtruncbuf()
|
||||
#endif
|
||||
error = hpfs_truncate(hp, vap->va_size);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
} else if (vap->va_size > hp->h_fn.fn_size) {
|
||||
#if defined(__FreeBSD__)
|
||||
vnode_pager_setsize(vp, vap->va_size);
|
||||
#endif
|
||||
error = hpfs_extend(hp, vap->va_size);
|
||||
if (error)
|
||||
return (error);
|
||||
@ -657,11 +622,7 @@ hpfs_inactive(ap)
|
||||
|
||||
if (hp->h_flag & H_INVAL) {
|
||||
VOP__UNLOCK(vp,0,ap->a_p);
|
||||
#if defined(__FreeBSD__)
|
||||
vrecycle(vp, NULL, ap->a_td);
|
||||
#else /* defined(__NetBSD__) */
|
||||
vgone(vp);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1078,13 +1039,8 @@ hpfs_readdir(ap)
|
||||
if (!error && ap->a_ncookies != NULL) {
|
||||
struct dirent* dpStart;
|
||||
struct dirent* dp;
|
||||
#if defined(__FreeBSD__)
|
||||
u_long *cookies;
|
||||
u_long *cookiep;
|
||||
#else /* defined(__NetBSD__) */
|
||||
off_t *cookies;
|
||||
off_t *cookiep;
|
||||
#endif
|
||||
|
||||
dprintf(("%d cookies, ",ncookies));
|
||||
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
|
||||
@ -1092,13 +1048,8 @@ hpfs_readdir(ap)
|
||||
dpStart = (struct dirent *)
|
||||
((caddr_t)uio->uio_iov->iov_base -
|
||||
(uio->uio_offset - off));
|
||||
#if defined(__FreeBSD__)
|
||||
MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
|
||||
M_TEMP, M_WAITOK);
|
||||
#else /* defined(__NetBSD__) */
|
||||
MALLOC(cookies, off_t *, ncookies * sizeof(off_t),
|
||||
M_TEMP, M_WAITOK);
|
||||
#endif
|
||||
for (dp = dpStart, cookiep = cookies, i=0;
|
||||
i < ncookies;
|
||||
dp = (struct dirent *)((caddr_t) dp + dp->d_reclen), i++) {
|
||||
@ -1308,14 +1259,6 @@ hpfs_pathconf(ap)
|
||||
case _PC_NO_TRUNC:
|
||||
*ap->a_retval = 0;
|
||||
return (0);
|
||||
#if defined(__NetBSD__)
|
||||
case _PC_SYNC_IO:
|
||||
*ap->a_retval = 1;
|
||||
return (0);
|
||||
case _PC_FILESIZEBITS:
|
||||
*ap->a_retval = 32;
|
||||
return (0);
|
||||
#endif
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -1327,7 +1270,6 @@ hpfs_pathconf(ap)
|
||||
* Global vfs data structures
|
||||
*/
|
||||
vop_t **hpfs_vnodeop_p;
|
||||
#if defined(__FreeBSD__)
|
||||
struct vnodeopv_entry_desc hpfs_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, (vop_t *)hpfs_bypass },
|
||||
|
||||
@ -1364,55 +1306,3 @@ struct vnodeopv_desc hpfs_vnodeop_opv_desc =
|
||||
{ &hpfs_vnodeop_p, hpfs_vnodeop_entries };
|
||||
|
||||
VNODEOP_SET(hpfs_vnodeop_opv_desc);
|
||||
#else /* defined(__NetBSD__) */
|
||||
struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, (vop_t *) hpfs_bypass },
|
||||
{ &vop_lookup_desc, (vop_t *) hpfs_lookup }, /* lookup */
|
||||
{ &vop_create_desc, genfs_eopnotsupp }, /* create */
|
||||
{ &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */
|
||||
{ &vop_open_desc, (vop_t *) hpfs_open }, /* open */
|
||||
{ &vop_close_desc,(vop_t *) hpfs_close }, /* close */
|
||||
{ &vop_access_desc, (vop_t *) hpfs_access }, /* access */
|
||||
{ &vop_getattr_desc, (vop_t *) hpfs_getattr }, /* getattr */
|
||||
{ &vop_setattr_desc, genfs_eopnotsupp }, /* setattr */
|
||||
{ &vop_read_desc, (vop_t *) hpfs_read }, /* read */
|
||||
{ &vop_write_desc, (vop_t *) hpfs_write }, /* write */
|
||||
{ &vop_lease_desc, genfs_lease_check }, /* lease */
|
||||
{ &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
|
||||
{ &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
|
||||
{ &vop_poll_desc, genfs_poll }, /* poll */
|
||||
{ &vop_revoke_desc, genfs_revoke }, /* revoke */
|
||||
{ &vop_fsync_desc, genfs_fsync }, /* fsync */
|
||||
{ &vop_seek_desc, genfs_seek }, /* seek */
|
||||
{ &vop_remove_desc, genfs_eopnotsupp }, /* remove */
|
||||
{ &vop_link_desc, genfs_eopnotsupp }, /* link */
|
||||
{ &vop_rename_desc, genfs_eopnotsupp }, /* rename */
|
||||
{ &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */
|
||||
{ &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */
|
||||
{ &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */
|
||||
{ &vop_readdir_desc, (vop_t *) hpfs_readdir }, /* readdir */
|
||||
{ &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */
|
||||
{ &vop_abortop_desc, genfs_abortop }, /* abortop */
|
||||
{ &vop_inactive_desc, (vop_t *) hpfs_inactive }, /* inactive */
|
||||
{ &vop_reclaim_desc, (vop_t *) hpfs_reclaim }, /* reclaim */
|
||||
{ &vop_lock_desc, genfs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, genfs_unlock }, /* unlock */
|
||||
{ &vop_bmap_desc, (vop_t *) hpfs_bmap }, /* bmap */
|
||||
{ &vop_strategy_desc, (vop_t *) hpfs_strategy }, /* strategy */
|
||||
{ &vop_print_desc, (vop_t *) hpfs_print }, /* print */
|
||||
{ &vop_islocked_desc, genfs_islocked }, /* islocked */
|
||||
{ &vop_pathconf_desc, hpfs_pathconf }, /* pathconf */
|
||||
{ &vop_advlock_desc, genfs_nullop }, /* advlock */
|
||||
{ &vop_blkatoff_desc, genfs_eopnotsupp }, /* blkatoff */
|
||||
{ &vop_valloc_desc, genfs_eopnotsupp }, /* valloc */
|
||||
{ &vop_reallocblks_desc, genfs_eopnotsupp }, /* reallocblks */
|
||||
{ &vop_vfree_desc, genfs_eopnotsupp }, /* vfree */
|
||||
{ &vop_truncate_desc, genfs_eopnotsupp }, /* truncate */
|
||||
{ &vop_update_desc, genfs_eopnotsupp }, /* update */
|
||||
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
|
||||
{ (struct vnodeop_desc *)NULL, (int (*) __P((void *)))NULL }
|
||||
};
|
||||
struct vnodeopv_desc ntfs_vnodeop_opv_desc =
|
||||
{ &ntfs_vnodeop_p, ntfs_vnodeop_entries };
|
||||
|
||||
#endif
|
||||
|
@ -29,9 +29,6 @@
|
||||
*/
|
||||
|
||||
/*#define NTFS_DEBUG 1*/
|
||||
#if defined(__NetBSD__) && defined(_KERNEL) && !defined(_LKM)
|
||||
#include "opt_ntfs.h"
|
||||
#endif
|
||||
|
||||
typedef u_int64_t cn_t;
|
||||
typedef u_int16_t wchar;
|
||||
@ -255,9 +252,6 @@ struct ntfsmount {
|
||||
cn_t ntm_cfree;
|
||||
struct ntvattrdef *ntm_ad;
|
||||
int ntm_adnum;
|
||||
#if !defined(__FreeBSD__)
|
||||
struct netexport ntm_export; /* export information */
|
||||
#endif
|
||||
wchar * ntm_82u; /* 8bit to Unicode */
|
||||
char ** ntm_u28; /* Unicode to 8 bit */
|
||||
};
|
||||
@ -295,31 +289,11 @@ MALLOC_DECLARE(M_NTFSDIR);
|
||||
MALLOC_DECLARE(M_NTFSNTHASH);
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#define MALLOC_DEFINE(a, b, c)
|
||||
#define M_NTFSNTHASH M_NTFS
|
||||
#define M_NTFSNTVATTR M_NTFS
|
||||
#define M_NTFSRDATA M_NTFS
|
||||
#define M_NTFSRUN M_NTFS
|
||||
#define M_NTFSDECOMP M_NTFS
|
||||
#define M_NTFSMNT M_NTFS
|
||||
#define M_NTFSNTNODE M_NTFS
|
||||
#define M_NTFSFNODE M_NTFS
|
||||
#define M_NTFSDIR M_NTFS
|
||||
typedef int (vop_t) __P((void *));
|
||||
#define HASHINIT(a, b, c, d) hashinit((a), (b), (c), (d))
|
||||
#define bqrelse(bp) brelse(bp)
|
||||
#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), (b))
|
||||
#define VGET(a, b, c) vget((a), (b))
|
||||
#define VN_LOCK(a, b, c) vn_lock((a), (b))
|
||||
#define LOCKMGR(a, b, c) lockmgr((a), (b), (c))
|
||||
#else /* !NetBSD */
|
||||
#define HASHINIT(a, b, c, d) hashinit((a), (b), (d))
|
||||
#define VOP__UNLOCK(a, b, c) VOP_UNLOCK((a), (b), (c))
|
||||
#define VGET(a, b, c) vget((a), (b), (c))
|
||||
#define VN_LOCK(a, b, c) vn_lock((a), (b), (c))
|
||||
#define LOCKMGR(a, b, c) lockmgr((a), (b), (c), NULL)
|
||||
#endif /* NetBSD */
|
||||
|
||||
#if defined(NTFS_DEBUG)
|
||||
#define dprintf(a) printf a
|
||||
|
@ -35,10 +35,6 @@
|
||||
#include <sys/mount.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#endif
|
||||
|
||||
#include <fs/ntfs/ntfs.h>
|
||||
#include <fs/ntfs/ntfs_compr.h>
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
*/
|
||||
|
||||
/* These flags are kept in i_flag. */
|
||||
#if defined(__FreeBSD__)
|
||||
#define IN_ACCESS 0x0001 /* Access time update request. */
|
||||
#define IN_CHANGE 0x0002 /* Inode change time update request. */
|
||||
#define IN_UPDATE 0x0004 /* Modification time update request. */
|
||||
@ -38,20 +37,6 @@
|
||||
#define IN_SHLOCK 0x0020 /* File has shared lock. */
|
||||
#define IN_EXLOCK 0x0040 /* File has exclusive lock. */
|
||||
#define IN_LAZYMOD 0x0080 /* Modified, but don't write yet. */
|
||||
#else /* defined(__NetBSD__) */
|
||||
#define IN_ACCESS 0x0001 /* Access time update request. */
|
||||
#define IN_CHANGE 0x0002 /* Inode change time update request. */
|
||||
#define IN_EXLOCK 0x0004 /* File has exclusive lock. */
|
||||
#define IN_LOCKED 0x0008 /* Inode lock. */
|
||||
#define IN_LWAIT 0x0010 /* Process waiting on file lock. */
|
||||
#define IN_MODIFIED 0x0020 /* Inode has been modified. */
|
||||
#define IN_RENAME 0x0040 /* Inode is being renamed. */
|
||||
#define IN_SHLOCK 0x0080 /* File has shared lock. */
|
||||
#define IN_UPDATE 0x0100 /* Modification time update request. */
|
||||
#define IN_WANTED 0x0200 /* Inode is wanted by a process. */
|
||||
#define IN_RECURSE 0x0400 /* Recursion expected */
|
||||
#endif
|
||||
|
||||
#define IN_HASHED 0x0800 /* Inode is on hash list */
|
||||
#define IN_LOADED 0x8000 /* ntvattrs loaded */
|
||||
#define IN_PRELOADED 0x4000 /* loaded from directory entry */
|
||||
@ -84,9 +69,7 @@ struct ntnode {
|
||||
#define FN_VALID 0x0002
|
||||
#define FN_AATTRNAME 0x0004 /* space allocated for f_attrname */
|
||||
struct fnode {
|
||||
#ifdef __FreeBSD__
|
||||
struct lock f_lock; /* fnode lock >Keep this first< */
|
||||
#endif
|
||||
|
||||
LIST_ENTRY(fnode) f_fnlist;
|
||||
struct vnode *f_vp; /* Associatied vnode */
|
||||
|
@ -41,10 +41,6 @@
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/lock.h>
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#endif
|
||||
|
||||
/* #define NTFS_DEBUG 1 */
|
||||
#include <fs/ntfs/ntfs.h>
|
||||
#include <fs/ntfs/ntfsmount.h>
|
||||
@ -54,12 +50,10 @@
|
||||
#include <fs/ntfs/ntfs_compr.h>
|
||||
#include <fs/ntfs/ntfs_ihash.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
MALLOC_DEFINE(M_NTFSNTVATTR, "NTFS vattr", "NTFS file attribute information");
|
||||
MALLOC_DEFINE(M_NTFSRDATA, "NTFS res data", "NTFS resident data");
|
||||
MALLOC_DEFINE(M_NTFSRUN, "NTFS vrun", "NTFS vrun storage");
|
||||
MALLOC_DEFINE(M_NTFSDECOMP, "NTFS decomp", "NTFS decompression temporary");
|
||||
#endif
|
||||
|
||||
static int ntfs_ntlookupattr __P((struct ntfsmount *, const char *, int, int *, char **));
|
||||
static int ntfs_findvattr __P((struct ntfsmount *, struct ntnode *, struct ntvattr **, struct ntvattr **, u_int32_t, const char *, size_t, cn_t));
|
||||
@ -781,9 +775,7 @@ ntfs_frele(
|
||||
FREE(fp->f_attrname, M_TEMP);
|
||||
if (fp->f_dirblbuf)
|
||||
FREE(fp->f_dirblbuf, M_NTFSDIR);
|
||||
#ifdef __FreeBSD__
|
||||
lockdestroy(&fp->f_lock);
|
||||
#endif
|
||||
FREE(fp, M_NTFSFNODE);
|
||||
ntfs_ntrele(ip);
|
||||
}
|
||||
@ -1448,14 +1440,8 @@ ntfs_writentvattr_plain(
|
||||
off = ntfs_btocnoff(off);
|
||||
|
||||
while (left && ccl) {
|
||||
#if defined(__FreeBSD__)
|
||||
tocopy = min(left,
|
||||
min(ntfs_cntob(ccl) - off, MAXBSIZE - off));
|
||||
#else
|
||||
/* under NetBSD, bread() can read
|
||||
* maximum one block worth of data */
|
||||
tocopy = min(left, ntmp->ntm_bps - off);
|
||||
#endif
|
||||
cl = ntfs_btocl(tocopy + off);
|
||||
ddprintf(("ntfs_writentvattr_plain: write: " \
|
||||
"cn: 0x%x cl: %d, off: %d len: %d, left: %d\n",
|
||||
@ -1552,16 +1538,9 @@ ntfs_readntvattr_plain(
|
||||
off = ntfs_btocnoff(off);
|
||||
|
||||
while (left && ccl) {
|
||||
#if defined(__FreeBSD__)
|
||||
tocopy = min(left,
|
||||
min(ntfs_cntob(ccl) - off,
|
||||
MAXBSIZE - off));
|
||||
#else
|
||||
/* under NetBSD, bread() can read
|
||||
* maximum one block worth of data */
|
||||
tocopy = min(left,
|
||||
ntmp->ntm_bps - off);
|
||||
#endif
|
||||
cl = ntfs_btocl(tocopy + off);
|
||||
ddprintf(("ntfs_readntvattr_plain: " \
|
||||
"read: cn: 0x%x cl: %d, " \
|
||||
|
@ -42,23 +42,13 @@
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#if defined(__NetBSD__)
|
||||
#include <sys/device.h>
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#if defined(__NetBSD__)
|
||||
#include <vm/vm_prot.h>
|
||||
#endif
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#endif
|
||||
|
||||
/*#define NTFS_DEBUG 1*/
|
||||
#include <fs/ntfs/ntfs.h>
|
||||
#include <fs/ntfs/ntfs_inode.h>
|
||||
@ -67,12 +57,12 @@
|
||||
#include <fs/ntfs/ntfs_ihash.h>
|
||||
#include <fs/ntfs/ntfsmount.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
MALLOC_DEFINE(M_NTFSMNT, "NTFS mount", "NTFS mount structure");
|
||||
MALLOC_DEFINE(M_NTFSNTNODE,"NTFS ntnode", "NTFS ntnode information");
|
||||
MALLOC_DEFINE(M_NTFSFNODE,"NTFS fnode", "NTFS fnode information");
|
||||
MALLOC_DEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer");
|
||||
#endif
|
||||
|
||||
struct sockaddr;
|
||||
|
||||
static int ntfs_root __P((struct mount *, struct vnode **));
|
||||
static int ntfs_statfs __P((struct mount *, struct statfs *,
|
||||
@ -85,125 +75,9 @@ static int ntfs_mountfs __P((register struct vnode *, struct mount *,
|
||||
static int ntfs_vptofh __P((struct vnode *, struct fid *));
|
||||
static int ntfs_fhtovp __P((struct mount *, struct fid *,
|
||||
struct vnode **));
|
||||
|
||||
#if !defined (__FreeBSD__)
|
||||
static int ntfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
|
||||
struct thread *));
|
||||
static int ntfs_start __P((struct mount *, int, struct thread *));
|
||||
static int ntfs_sync __P((struct mount *, int, struct ucred *,
|
||||
struct thread *));
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
struct sockaddr;
|
||||
static int ntfs_mount __P((struct mount *, char *, caddr_t,
|
||||
struct nameidata *, struct thread *));
|
||||
static int ntfs_init __P((struct vfsconf *));
|
||||
#elif defined(__NetBSD__)
|
||||
static int ntfs_mount __P((struct mount *, const char *, void *,
|
||||
struct nameidata *, struct thread *));
|
||||
static void ntfs_init __P((void));
|
||||
static int ntfs_mountroot __P((void));
|
||||
static int ntfs_sysctl __P((int *, u_int, void *, size_t *, void *,
|
||||
size_t, struct thread *));
|
||||
static int ntfs_checkexp __P((struct mount *, struct mbuf *,
|
||||
int *, struct ucred **));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Verify a remote client has export rights and return these rights via.
|
||||
* exflagsp and credanonp.
|
||||
*/
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
ntfs_checkexp(mp, nam, exflagsp, credanonp)
|
||||
register struct mount *mp;
|
||||
struct mbuf *nam;
|
||||
int *exflagsp;
|
||||
struct ucred **credanonp;
|
||||
{
|
||||
register struct netcred *np;
|
||||
register struct ntfsmount *ntm = VFSTONTFS(mp);
|
||||
|
||||
/*
|
||||
* Get the export permission structure for this <mp, client> tuple.
|
||||
*/
|
||||
np = vfs_export_lookup(mp, &ntm->ntm_export, nam);
|
||||
if (np == NULL)
|
||||
return (EACCES);
|
||||
*exflagsp = np->netc_exflags;
|
||||
*credanonp = &np->netc_anon;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
ntfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
int *name;
|
||||
u_int namelen;
|
||||
void *oldp;
|
||||
size_t *oldlenp;
|
||||
void *newp;
|
||||
size_t newlen;
|
||||
struct proc *p;
|
||||
{
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
static int
|
||||
ntfs_mountroot()
|
||||
{
|
||||
struct mount *mp;
|
||||
extern struct vnode *rootvp;
|
||||
struct proc *p = curproc; /* XXX */
|
||||
int error;
|
||||
struct ntfs_args args;
|
||||
|
||||
if (root_device->dv_class != DV_DISK)
|
||||
return (ENODEV);
|
||||
|
||||
/*
|
||||
* Get vnodes for rootdev.
|
||||
*/
|
||||
if (bdevvp(rootdev, &rootvp))
|
||||
panic("ntfs_mountroot: can't setup rootvp");
|
||||
|
||||
if ((error = vfs_rootmountalloc(MOUNT_NTFS, "root_device", &mp))) {
|
||||
vrele(rootvp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
args.flag = 0;
|
||||
args.uid = 0;
|
||||
args.gid = 0;
|
||||
args.mode = 0777;
|
||||
|
||||
if ((error = ntfs_mountfs(rootvp, mp, &args, td)) != 0) {
|
||||
mp->mnt_op->vfs_refcount--;
|
||||
vfs_unbusy(mp);
|
||||
free(mp, M_MOUNT);
|
||||
vrele(rootvp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
mtx_lock(&mountlist_mtx);
|
||||
TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
(void)ntfs_statfs(mp, &mp->mnt_stat, td);
|
||||
vfs_unbusy(mp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
ntfs_init ()
|
||||
{
|
||||
ntfs_nthashinit();
|
||||
ntfs_toupper_init();
|
||||
}
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
static int
|
||||
ntfs_init (
|
||||
@ -223,18 +97,11 @@ ntfs_uninit (
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NetBSD */
|
||||
|
||||
static int
|
||||
ntfs_mount (
|
||||
struct mount *mp,
|
||||
#if defined(__FreeBSD__)
|
||||
char *path,
|
||||
caddr_t data,
|
||||
#else
|
||||
const char *path,
|
||||
void *data,
|
||||
#endif
|
||||
struct nameidata *ndp,
|
||||
struct thread *td )
|
||||
{
|
||||
@ -243,7 +110,6 @@ ntfs_mount (
|
||||
struct vnode *devvp;
|
||||
struct ntfs_args args;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/*
|
||||
* Use NULL path to flag a root mount
|
||||
*/
|
||||
@ -274,7 +140,6 @@ ntfs_mount (
|
||||
goto dostatfs; /* success*/
|
||||
|
||||
}
|
||||
#endif /* FreeBSD */
|
||||
|
||||
/*
|
||||
***
|
||||
@ -298,12 +163,7 @@ ntfs_mount (
|
||||
* Process export requests. Jumping to "success"
|
||||
* will return the vfs_export() error code.
|
||||
*/
|
||||
#if defined(__FreeBSD__)
|
||||
err = vfs_export(mp, &args.export);
|
||||
#else /* defined(__NetBSD__) */
|
||||
struct ntfsmount *ntm = VFSTONTFS(mp);
|
||||
err = vfs_export(mp, &ntm->ntm_export, &args.export);
|
||||
#endif
|
||||
goto success;
|
||||
}
|
||||
|
||||
@ -325,19 +185,8 @@ ntfs_mount (
|
||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
||||
devvp = ndp->ni_vp;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
if (!vn_isdisk(devvp, &err))
|
||||
goto error_2;
|
||||
#else
|
||||
if (devvp->v_type != VBLK) {
|
||||
err = ENOTBLK;
|
||||
goto error_2;
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev) {
|
||||
err = ENXIO;
|
||||
goto error_2;
|
||||
}
|
||||
#endif
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
#if 0
|
||||
/*
|
||||
@ -391,9 +240,7 @@ ntfs_mount (
|
||||
goto error_2;
|
||||
}
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
dostatfs:
|
||||
#endif
|
||||
/*
|
||||
* Initialize FS stat information in mount struct; uses both
|
||||
* mp->mnt_stat.f_mntonname and mp->mnt_stat.f_mntfromname
|
||||
@ -442,19 +289,13 @@ ntfs_mountfs(devvp, mp, argsp, td)
|
||||
if (error)
|
||||
return (error);
|
||||
ncount = vcount(devvp);
|
||||
#if defined(__FreeBSD__)
|
||||
if (devvp->v_object)
|
||||
ncount -= 1;
|
||||
#endif
|
||||
if (ncount > 1 && devvp != rootvp)
|
||||
return (EBUSY);
|
||||
#if defined(__FreeBSD__)
|
||||
VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0);
|
||||
VOP__UNLOCK(devvp, 0, td);
|
||||
#else
|
||||
error = vinvalbuf(devvp, V_SAVE, td->td_proc->p_ucred, td, 0, 0);
|
||||
#endif
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -598,13 +439,8 @@ ntfs_mountfs(devvp, mp, argsp, td)
|
||||
vput(vp);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
|
||||
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
|
||||
#else
|
||||
mp->mnt_stat.f_fsid.val[0] = dev;
|
||||
mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_NTFS);
|
||||
#endif
|
||||
mp->mnt_maxsymlinklen = 0;
|
||||
mp->mnt_flag |= MNT_LOCAL;
|
||||
devvp->v_rdev->si_mountpoint = mp;
|
||||
@ -622,29 +458,11 @@ ntfs_mountfs(devvp, mp, argsp, td)
|
||||
if (bp)
|
||||
brelse(bp);
|
||||
|
||||
#if defined __NetBSD__
|
||||
/* lock the device vnode before calling VOP_CLOSE() */
|
||||
VN_LOCK(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td);
|
||||
VOP__UNLOCK(devvp, 0, td);
|
||||
#else
|
||||
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td);
|
||||
#endif
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
ntfs_start (
|
||||
struct mount *mp,
|
||||
int flags,
|
||||
struct thread *td )
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ntfs_unmount(
|
||||
struct mount *mp,
|
||||
@ -691,16 +509,8 @@ ntfs_unmount(
|
||||
|
||||
vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, td, 0, 0);
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/* lock the device vnode before calling VOP_CLOSE() */
|
||||
VOP_LOCK(ntmp->ntm_devvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
|
||||
NOCRED, td);
|
||||
VOP__UNLOCK(ntmp->ntm_devvp, 0, td);
|
||||
#else
|
||||
error = VOP_CLOSE(ntmp->ntm_devvp, ronly ? FREAD : FREAD|FWRITE,
|
||||
NOCRED, td);
|
||||
#endif
|
||||
|
||||
vrele(ntmp->ntm_devvp);
|
||||
|
||||
@ -737,20 +547,6 @@ ntfs_root(
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
ntfs_quotactl (
|
||||
struct mount *mp,
|
||||
int cmds,
|
||||
uid_t uid,
|
||||
caddr_t arg,
|
||||
struct thread *td)
|
||||
{
|
||||
printf("\nntfs_quotactl():\n");
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ntfs_calccfree(
|
||||
struct ntfsmount *ntmp,
|
||||
@ -797,13 +593,7 @@ ntfs_statfs(
|
||||
mftsize = VTOF(ntmp->ntm_sysvn[NTFS_MFTINO])->f_size;
|
||||
mftallocated = VTOF(ntmp->ntm_sysvn[NTFS_MFTINO])->f_allocated;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
sbp->f_type = mp->mnt_vfc->vfc_typenum;
|
||||
#elif defined(__NetBSD__)
|
||||
sbp->f_type = 0;
|
||||
#else
|
||||
sbp->f_type = MOUNT_NTFS;
|
||||
#endif
|
||||
sbp->f_bsize = ntmp->ntm_bps;
|
||||
sbp->f_iosize = ntmp->ntm_bps * ntmp->ntm_spc;
|
||||
sbp->f_blocks = ntmp->ntm_bootfile.bf_spv;
|
||||
@ -818,25 +608,9 @@ ntfs_statfs(
|
||||
(caddr_t)&sbp->f_mntfromname[0], MNAMELEN);
|
||||
}
|
||||
sbp->f_flags = mp->mnt_flag;
|
||||
#ifdef __NetBSD__
|
||||
strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN);
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
static int
|
||||
ntfs_sync (
|
||||
struct mount *mp,
|
||||
int waitfor,
|
||||
struct ucred *cred,
|
||||
struct thread *td)
|
||||
{
|
||||
/*dprintf(("ntfs_sync():\n"));*/
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
@ -967,9 +741,7 @@ ntfs_vgetex(
|
||||
}
|
||||
dprintf(("ntfs_vget: vnode: %p for ntnode: %d\n", vp,ino));
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
lockinit(&fp->f_lock, PINOD, "fnode", 0, 0);
|
||||
#endif
|
||||
fp->f_vp = vp;
|
||||
vp->v_data = fp;
|
||||
vp->v_type = f_type;
|
||||
@ -1002,7 +774,6 @@ ntfs_vget(
|
||||
LK_EXCLUSIVE | LK_RETRY, 0, curthread, vpp);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static struct vfsops ntfs_vfsops = {
|
||||
ntfs_mount,
|
||||
vfs_stdstart,
|
||||
@ -1020,47 +791,3 @@ static struct vfsops ntfs_vfsops = {
|
||||
vfs_stdextattrctl,
|
||||
};
|
||||
VFS_SET(ntfs_vfsops, ntfs, 0);
|
||||
#elif defined(__NetBSD__)
|
||||
extern struct vnodeopv_desc ntfs_vnodeop_opv_desc;
|
||||
|
||||
struct vnodeopv_desc *ntfs_vnodeopv_descs[] = {
|
||||
&ntfs_vnodeop_opv_desc,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct vfsops ntfs_vfsops = {
|
||||
MOUNT_NTFS,
|
||||
ntfs_mount,
|
||||
ntfs_start,
|
||||
ntfs_unmount,
|
||||
ntfs_root,
|
||||
ntfs_quotactl,
|
||||
ntfs_statfs,
|
||||
ntfs_sync,
|
||||
ntfs_vget,
|
||||
ntfs_fhtovp,
|
||||
ntfs_vptofh,
|
||||
ntfs_init,
|
||||
ntfs_sysctl,
|
||||
ntfs_mountroot,
|
||||
ntfs_checkexp,
|
||||
ntfs_vnodeopv_descs,
|
||||
};
|
||||
#else /* !NetBSD && !FreeBSD */
|
||||
static struct vfsops ntfs_vfsops = {
|
||||
ntfs_mount,
|
||||
ntfs_start,
|
||||
ntfs_unmount,
|
||||
ntfs_root,
|
||||
ntfs_quotactl,
|
||||
ntfs_statfs,
|
||||
ntfs_sync,
|
||||
ntfs_vget,
|
||||
ntfs_fhtovp,
|
||||
ntfs_vptofh,
|
||||
ntfs_init,
|
||||
};
|
||||
VFS_SET(ntfs_vfsops, ntfs, MOUNT_NTFS, 0);
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -55,15 +55,10 @@
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#if defined(__NetBSD__)
|
||||
#include <vm/vm_prot.h>
|
||||
#endif
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_object.h>
|
||||
#include <vm/vm_pager.h>
|
||||
#if defined(__FreeBSD__)
|
||||
#include <vm/vnode_pager.h>
|
||||
#endif
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
@ -72,10 +67,6 @@
|
||||
#include <fs/ntfs/ntfs.h>
|
||||
#include <fs/ntfs/ntfs_inode.h>
|
||||
#include <fs/ntfs/ntfs_subr.h>
|
||||
#if defined(__NetBSD__)
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
#include <miscfs/genfs/genfs.h>
|
||||
#endif
|
||||
|
||||
#include <sys/unistd.h> /* for pathconf(2) constants */
|
||||
|
||||
@ -91,42 +82,11 @@ static int ntfs_open __P((struct vop_open_args *ap));
|
||||
static int ntfs_close __P((struct vop_close_args *ap));
|
||||
static int ntfs_readdir __P((struct vop_readdir_args *ap));
|
||||
static int ntfs_lookup __P((struct vop_lookup_args *ap));
|
||||
#if defined(__FreeBSD__)
|
||||
static int ntfs_fsync __P((struct vop_fsync_args *ap));
|
||||
#else
|
||||
static int ntfs_bmap __P((struct vop_bmap_args *ap));
|
||||
static int ntfs_bypass __P((struct vop_generic_args *ap));
|
||||
#endif
|
||||
static int ntfs_pathconf __P((void *));
|
||||
|
||||
int ntfs_prtactive = 1; /* 1 => print out reclaim of active vnodes */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
/*
|
||||
* This is a noop, simply returning what one has been given.
|
||||
*/
|
||||
int
|
||||
ntfs_bmap(ap)
|
||||
struct vop_bmap_args /* {
|
||||
struct vnode *a_vp;
|
||||
daddr_t a_bn;
|
||||
struct vnode **a_vpp;
|
||||
daddr_t *a_bnp;
|
||||
int *a_runp;
|
||||
int *a_runb;
|
||||
} */ *ap;
|
||||
{
|
||||
dprintf(("ntfs_bmap: vn: %p, blk: %d\n", ap->a_vp,(u_int32_t)ap->a_bn));
|
||||
if (ap->a_vpp != NULL)
|
||||
*ap->a_vpp = ap->a_vp;
|
||||
if (ap->a_bnp != NULL)
|
||||
*ap->a_bnp = ap->a_bn;
|
||||
if (ap->a_runp != NULL)
|
||||
*ap->a_runp = 0;
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ntfs_read(ap)
|
||||
struct vop_read_args /* {
|
||||
@ -169,22 +129,6 @@ ntfs_read(ap)
|
||||
return (0);
|
||||
}
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
|
||||
static int
|
||||
ntfs_bypass(ap)
|
||||
struct vop_generic_args /* {
|
||||
struct vnodeop_desc *a_desc;
|
||||
<other random data follows, presumably>
|
||||
} */ *ap;
|
||||
{
|
||||
int error = ENOTTY;
|
||||
dprintf(("ntfs_bypass: %s\n", ap->a_desc->vdesc_name));
|
||||
return (error);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int
|
||||
ntfs_getattr(ap)
|
||||
struct vop_getattr_args /* {
|
||||
@ -201,11 +145,7 @@ ntfs_getattr(ap)
|
||||
|
||||
dprintf(("ntfs_getattr: %d, flags: %d\n",ip->i_number,ip->i_flag));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
vap->va_fsid = dev2udev(ip->i_dev);
|
||||
#else /* NetBSD */
|
||||
vap->va_fsid = ip->i_dev;
|
||||
#endif
|
||||
vap->va_fileid = ip->i_number;
|
||||
vap->va_mode = ip->i_mp->ntm_mode;
|
||||
vap->va_nlink = ip->i_nlink;
|
||||
@ -311,15 +251,9 @@ ntfs_strategy(ap)
|
||||
struct ntfsmount *ntmp = ip->i_mp;
|
||||
int error;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
dprintf(("ntfs_strategy: offset: %d, blkno: %d, lblkno: %d\n",
|
||||
(u_int32_t)bp->b_offset,(u_int32_t)bp->b_blkno,
|
||||
(u_int32_t)bp->b_lblkno));
|
||||
#else
|
||||
dprintf(("ntfs_strategy: blkno: %d, lblkno: %d\n",
|
||||
(u_int32_t)bp->b_blkno,
|
||||
(u_int32_t)bp->b_lblkno));
|
||||
#endif
|
||||
|
||||
dprintf(("strategy: bcount: %d flags: 0x%lx\n",
|
||||
(u_int32_t)bp->b_bcount,bp->b_flags));
|
||||
@ -615,13 +549,8 @@ ntfs_readdir(ap)
|
||||
if (!error && ap->a_ncookies != NULL) {
|
||||
struct dirent* dpStart;
|
||||
struct dirent* dp;
|
||||
#if defined(__FreeBSD__)
|
||||
u_long *cookies;
|
||||
u_long *cookiep;
|
||||
#else /* defined(__NetBSD__) */
|
||||
off_t *cookies;
|
||||
off_t *cookiep;
|
||||
#endif
|
||||
|
||||
ddprintf(("ntfs_readdir: %d cookies\n",ncookies));
|
||||
if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1)
|
||||
@ -629,13 +558,8 @@ ntfs_readdir(ap)
|
||||
dpStart = (struct dirent *)
|
||||
((caddr_t)uio->uio_iov->iov_base -
|
||||
(uio->uio_offset - off));
|
||||
#if defined(__FreeBSD__)
|
||||
MALLOC(cookies, u_long *, ncookies * sizeof(u_long),
|
||||
M_TEMP, M_WAITOK);
|
||||
#else /* defined(__NetBSD__) */
|
||||
MALLOC(cookies, off_t *, ncookies * sizeof(off_t),
|
||||
M_TEMP, M_WAITOK);
|
||||
#endif
|
||||
for (dp = dpStart, cookiep = cookies, i=0;
|
||||
i < ncookies;
|
||||
dp = (struct dirent *)((caddr_t) dp + dp->d_reclen), i++) {
|
||||
@ -683,19 +607,6 @@ ntfs_lookup(ap)
|
||||
(cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
|
||||
return (EROFS);
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/*
|
||||
* We now have a segment name to search for, and a directory
|
||||
* to search.
|
||||
*
|
||||
* Before tediously performing a linear scan of the directory,
|
||||
* check the name cache to see if the directory/name pair
|
||||
* we are looking for is known already.
|
||||
*/
|
||||
if ((error = cache_lookup(ap->a_dvp, ap->a_vpp, cnp)) >= 0)
|
||||
return (error);
|
||||
#endif
|
||||
|
||||
if(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
|
||||
dprintf(("ntfs_lookup: faking . directory in %d\n",
|
||||
dip->i_number));
|
||||
@ -755,7 +666,6 @@ ntfs_lookup(ap)
|
||||
return (error);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/*
|
||||
* Flush the blocks of a file to disk.
|
||||
*
|
||||
@ -773,7 +683,6 @@ ntfs_fsync(ap)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return POSIX pathconf information applicable to NTFS filesystem
|
||||
@ -804,14 +713,6 @@ ntfs_pathconf(v)
|
||||
case _PC_NO_TRUNC:
|
||||
*ap->a_retval = 0;
|
||||
return (0);
|
||||
#if defined(__NetBSD__)
|
||||
case _PC_SYNC_IO:
|
||||
*ap->a_retval = 1;
|
||||
return (0);
|
||||
case _PC_FILESIZEBITS:
|
||||
*ap->a_retval = 64;
|
||||
return (0);
|
||||
#endif
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
@ -822,7 +723,6 @@ ntfs_pathconf(v)
|
||||
* Global vfs data structures
|
||||
*/
|
||||
vop_t **ntfs_vnodeop_p;
|
||||
#if defined(__FreeBSD__)
|
||||
static
|
||||
struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, (vop_t *)vop_defaultop },
|
||||
@ -857,57 +757,3 @@ struct vnodeopv_desc ntfs_vnodeop_opv_desc =
|
||||
{ &ntfs_vnodeop_p, ntfs_vnodeop_entries };
|
||||
|
||||
VNODEOP_SET(ntfs_vnodeop_opv_desc);
|
||||
|
||||
#else /* !FreeBSD */
|
||||
|
||||
struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = {
|
||||
{ &vop_default_desc, (vop_t *) ntfs_bypass },
|
||||
{ &vop_lookup_desc, (vop_t *) ntfs_lookup }, /* lookup */
|
||||
{ &vop_create_desc, genfs_eopnotsupp }, /* create */
|
||||
{ &vop_mknod_desc, genfs_eopnotsupp }, /* mknod */
|
||||
{ &vop_open_desc, (vop_t *) ntfs_open }, /* open */
|
||||
{ &vop_close_desc,(vop_t *) ntfs_close }, /* close */
|
||||
{ &vop_access_desc, (vop_t *) ntfs_access }, /* access */
|
||||
{ &vop_getattr_desc, (vop_t *) ntfs_getattr }, /* getattr */
|
||||
{ &vop_setattr_desc, genfs_eopnotsupp }, /* setattr */
|
||||
{ &vop_read_desc, (vop_t *) ntfs_read }, /* read */
|
||||
{ &vop_write_desc, (vop_t *) ntfs_write }, /* write */
|
||||
{ &vop_lease_desc, genfs_lease_check }, /* lease */
|
||||
{ &vop_fcntl_desc, genfs_fcntl }, /* fcntl */
|
||||
{ &vop_ioctl_desc, genfs_enoioctl }, /* ioctl */
|
||||
{ &vop_poll_desc, genfs_poll }, /* poll */
|
||||
{ &vop_revoke_desc, genfs_revoke }, /* revoke */
|
||||
{ &vop_fsync_desc, genfs_fsync }, /* fsync */
|
||||
{ &vop_seek_desc, genfs_seek }, /* seek */
|
||||
{ &vop_remove_desc, genfs_eopnotsupp }, /* remove */
|
||||
{ &vop_link_desc, genfs_eopnotsupp }, /* link */
|
||||
{ &vop_rename_desc, genfs_eopnotsupp }, /* rename */
|
||||
{ &vop_mkdir_desc, genfs_eopnotsupp }, /* mkdir */
|
||||
{ &vop_rmdir_desc, genfs_eopnotsupp }, /* rmdir */
|
||||
{ &vop_symlink_desc, genfs_eopnotsupp }, /* symlink */
|
||||
{ &vop_readdir_desc, (vop_t *) ntfs_readdir }, /* readdir */
|
||||
{ &vop_readlink_desc, genfs_eopnotsupp }, /* readlink */
|
||||
{ &vop_abortop_desc, genfs_abortop }, /* abortop */
|
||||
{ &vop_inactive_desc, (vop_t *) ntfs_inactive }, /* inactive */
|
||||
{ &vop_reclaim_desc, (vop_t *) ntfs_reclaim }, /* reclaim */
|
||||
{ &vop_lock_desc, genfs_lock }, /* lock */
|
||||
{ &vop_unlock_desc, genfs_unlock }, /* unlock */
|
||||
{ &vop_bmap_desc, (vop_t *) ntfs_bmap }, /* bmap */
|
||||
{ &vop_strategy_desc, (vop_t *) ntfs_strategy }, /* strategy */
|
||||
{ &vop_print_desc, (vop_t *) ntfs_print }, /* print */
|
||||
{ &vop_islocked_desc, genfs_islocked }, /* islocked */
|
||||
{ &vop_pathconf_desc, ntfs_pathconf }, /* pathconf */
|
||||
{ &vop_advlock_desc, genfs_nullop }, /* advlock */
|
||||
{ &vop_blkatoff_desc, genfs_eopnotsupp }, /* blkatoff */
|
||||
{ &vop_valloc_desc, genfs_eopnotsupp }, /* valloc */
|
||||
{ &vop_reallocblks_desc, genfs_eopnotsupp }, /* reallocblks */
|
||||
{ &vop_vfree_desc, genfs_eopnotsupp }, /* vfree */
|
||||
{ &vop_truncate_desc, genfs_eopnotsupp }, /* truncate */
|
||||
{ &vop_update_desc, genfs_eopnotsupp }, /* update */
|
||||
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
|
||||
{ (struct vnodeop_desc *)NULL, (int (*) __P((void *)))NULL }
|
||||
};
|
||||
struct vnodeopv_desc ntfs_vnodeop_opv_desc =
|
||||
{ &ntfs_vnodeop_p, ntfs_vnodeop_entries };
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user