aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/hpfs
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-11-26 23:45:12 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-11-26 23:45:12 +0000
commit8a918adb2b298dd487f95fd06b42ad61cac137f4 (patch)
treecc35821e407f5e488c3289ca14822d7fae38d031 /sys/fs/hpfs
parente68347de238c1b1744d300b048789c71e5beb992 (diff)
Notes
Diffstat (limited to 'sys/fs/hpfs')
-rw-r--r--sys/fs/hpfs/hpfs.h17
-rw-r--r--sys/fs/hpfs/hpfs_vfsops.c199
-rw-r--r--sys/fs/hpfs/hpfs_vnops.c112
3 files changed, 4 insertions, 324 deletions
diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h
index f0253d559e91..f88071559e78 100644
--- a/sys/fs/hpfs/hpfs.h
+++ b/sys/fs/hpfs/hpfs.h
@@ -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;
diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c
index b364a60cfcef..f61529b27071 100644
--- a/sys/fs/hpfs/hpfs_vfsops.c
+++ b/sys/fs/hpfs/hpfs_vfsops.c
@@ -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 @@ failed:
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
diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c
index 09c83d60cde8..340db6ea2c99 100644
--- a/sys/fs/hpfs/hpfs_vnops.c
+++ b/sys/fs/hpfs/hpfs_vnops.c
@@ -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 @@ loop:
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 @@ readdone:
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 @@ readdone:
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