NetBSD 970118 too.
-/* $OpenBSD: adlookup.c,v 1.6 1996/08/23 19:10:57 niklas Exp $ */
-/* $NetBSD: adlookup.c,v 1.13.4.1 1996/05/27 09:53:50 is Exp $ */
+/* $OpenBSD: adlookup.c,v 1.7 1997/01/20 15:49:51 niklas Exp $ */
+/* $NetBSD: adlookup.c,v 1.17 1996/10/25 23:13:58 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
struct vnode *vdp; /* vnode of search dir */
struct anode *adp; /* anode of search dir */
struct ucred *ucp; /* lookup credentials */
- u_long bn, plen, hval, vpid;
- u_char *pelt;
+ u_int32_t plen, hval, vpid;
+ daddr_t bn;
+ char *pelt;
#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
last = flags & ISLASTCN;
lockp = flags & LOCKPARENT;
wantp = flags & (LOCKPARENT | WANTPARENT);
- pelt = (u_char *)cnp->cn_nameptr;
+ pelt = cnp->cn_nameptr;
plen = cnp->cn_namelen;
nocache = 0;
*
*/
VOP_UNLOCK(vdp); /* race */
- if ((error = VFS_VGET(vdp->v_mount,
- (ino_t)adp->pblock, vpp)) != 0)
+ if ((error = VFS_VGET(vdp->v_mount, ABLKTOINO(adp->pblock),
+ vpp)) != 0)
VOP_LOCK(vdp);
else if (last && lockp && (error = VOP_LOCK(vdp)))
vput(*vpp);
bn = adp->tab[hval];
i = min(adp->tabi[hval], 0);
while (bn != 0) {
- if ((error = VFS_VGET(vdp->v_mount, (ino_t)bn, vpp)) != 0) {
+ if ((error = VFS_VGET(vdp->v_mount, ABLKTOINO(bn), vpp)) !=
+ 0) {
#ifdef ADOSFS_DIAGNOSTIC
printf("[aget] %d)", error);
#endif
-/* $OpenBSD: adosfs.h,v 1.5 1996/06/10 07:25:18 deraadt Exp $ */
-/* $NetBSD: adosfs.h,v 1.10.4.2 1996/05/27 10:21:26 is Exp $ */
+/* $OpenBSD: adosfs.h,v 1.6 1997/01/20 15:49:52 niklas Exp $ */
+/* $NetBSD: adosfs.h,v 1.12 1996/10/08 22:18:02 thorpej Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
struct anode {
LIST_ENTRY(anode) link;
enum anode_type type;
- char name[31]; /* (r/d/f) name for object */
+ char name[31]; /* (r/d/f) name for object */
struct datestamp mtimev; /* (r) volume modified */
struct datestamp created; /* (r) volume created */
- struct datestamp mtime; /* (r/d/f) last modified */
+ struct datestamp mtime; /* (r/d/f) last modified */
struct adosfsmount *amp; /* owner file system */
- struct vnode *vp; /* owner vnode */
- u_long fsize; /* (f) size of file in bytes */
- u_long block; /* block num */
- u_long pblock; /* (d/f/e) parent block */
- u_long hashf; /* (d/f) hash forward */
- u_long extb; /* (f/e) extension block number */
- u_long linkto; /* (hd/hf) header this link points at */
- u_long linknext; /* (d/f/hd/hf) next link (or head) in chain */
- u_long lastlindblk; /* (f/hf) last logical indirect block */
- u_long lastindblk; /* (f/hf) last indirect block read */
- u_long *tab; /* (r/d) hash table */
- int *tabi; /* (r/d) table info */
- int ntabent; /* (r/d) number of entries in table */
- int nwords; /* size of blocks in long words */
- int adprot; /* (d/f) amigados protection bits */
- uid_t uid; /* (d/f) uid of directory/file */
- gid_t gid; /* (d/f) gid of directory/file */
- int flags; /* misc flags */
- char *slinkto; /* name of file or dir */
+ struct vnode *vp; /* owner vnode */
+ u_int32_t fsize; /* (f) size of file in bytes */
+ daddr_t block; /* block num */
+ daddr_t pblock; /* (d/f/e) parent block */
+ daddr_t hashf; /* (d/f) hash forward */
+ daddr_t extb; /* (f/e) extension block number */
+ daddr_t linkto; /* (hd/hf) hdr this link points at */
+ daddr_t linknext; /* (d/f/hd/hf) next chain link/head */
+ daddr_t lastlindblk; /* (f/hf) last logical indirect blk */
+ daddr_t lastindblk; /* (f/hf) last indirect block read */
+ daddr_t *tab; /* (r/d) hash table */
+ int *tabi; /* (r/d) table info */
+ int ntabent; /* (r/d) number of entries in table */
+ int nwords; /* size of blocks in 32-bit words */
+ int adprot; /* (d/f) amigados protection bits */
+ uid_t uid; /* (d/f) uid of directory/file */
+ gid_t gid; /* (d/f) gid of directory/file */
+ int flags; /* misc flags */
+ char *slinkto; /* name of file or dir */
};
#define VTOA(vp) ((struct anode *)(vp)->v_data)
#define ATOV(ap) ((ap)->vp)
-#define ANODETABSZ(ap) (((ap)->nwords - 56) * sizeof(long))
#define ANODETABENT(ap) ((ap)->nwords - 56)
#define ANODENDATBLKENT(ap) ((ap)->nwords - 56)
-
+#define ABLKTOINO(bn) ((ino_t)(bn))
+#define AINOTOBLK(bn) ((daddr_t)(bn))
/*
* mount data
*/
LIST_HEAD(anodechain, anode) anodetab[ANODEHASHSZ];
struct mount *mp; /* owner mount */
u_int32_t dostype; /* type of volume */
- u_long rootb; /* root block number */
- u_long secsperblk; /* sectors per block */
- u_long bsize; /* size of blocks */
- u_long nwords; /* size of blocks in long words */
- u_long dbsize; /* data bytes per block */
- uid_t uid; /* uid of mounting user */
- gid_t gid; /* gid of mounting user */
- u_long mask; /* mode mask */
+ daddr_t rootb; /* root block number */
+ int secsperblk; /* sectors per block */
+ int bsize; /* size of blocks */
+ int nwords; /* size of blocks in long words */
+ int dbsize; /* data bytes per block */
+ uid_t uid; /* uid of mounting user */
+ gid_t gid; /* gid of mounting user */
+ mode_t mask; /* mode mask */
struct vnode *devvp; /* blk device mounted on */
struct vnode *rootvp; /* out root vnode */
struct netexport export;
- u_long *bitmap; /* allocation bitmap */
- u_long numblks; /* number of usable blocks */
- u_long freeblks; /* number of free blocks */
+ u_int32_t *bitmap; /* allocation bitmap */
+ u_int32_t numblks; /* number of usable blocks */
+ u_int32_t freeblks; /* number of free blocks */
};
#define VFSTOADOSFS(mp) ((struct adosfsmount *)(mp)->mnt_data)
/*
* utility protos
*/
-#ifndef m68k
-u_int32_t adoswordn __P((struct buf *, int));
-#else
-#define adoswordn(bp,wn) (*((u_int32_t *)(bp)->b_data + (wn)))
-#endif
+#define adoswordn(bp,wn) ntohl(*((u_int32_t *)(bp)->b_data + (wn)))
-u_int32_t adoscksum __P((struct buf *, int));
-int adoscaseequ __P((const u_char *, const u_char *, int, int));
-int adoshash __P((const u_char *, int, int, int));
-int adunixprot __P((int));
-int adosfs_getblktype __P((struct adosfsmount *, struct buf *));
+u_int32_t adoscksum __P((struct buf *, int));
+int adoscaseequ __P((const char *, const char *, int, int));
+int adoshash __P((const char *, int, int, int));
+int adunixprot __P((int));
+int adosfs_getblktype __P((struct adosfsmount *, struct buf *));
-struct vnode *adosfs_ahashget __P((struct mount *, ino_t));
-void adosfs_ainshash __P((struct adosfsmount *, struct anode *));
-void adosfs_aremhash __P((struct anode *));
+struct vnode *adosfs_ahashget __P((struct mount *, ino_t));
+void adosfs_ainshash __P((struct adosfsmount *, struct anode *));
+void adosfs_aremhash __P((struct anode *));
-int adosfs_lookup __P((void *));
+int adosfs_lookup __P((void *));
-int (**adosfs_vnodeop_p) __P((void *));
+int (**adosfs_vnodeop_p) __P((void *));
-/* $OpenBSD: adutil.c,v 1.7 1996/08/10 03:24:36 deraadt Exp $ */
-/* $NetBSD: adutil.c,v 1.10.4.2 1996/05/27 10:21:29 is Exp $ */
+/* $OpenBSD: adutil.c,v 1.8 1997/01/20 15:49:52 niklas Exp $ */
+/* $NetBSD: adutil.c,v 1.15 1996/10/13 02:52:07 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
* look for anode in the mount's hash table, return locked.
*/
#define AHASH(an) ((an) & (ANODEHASHSZ - 1))
-static int CapitalChar __P((int, int));
+
+static __inline char CapitalChar __P((char, int));
struct vnode *
adosfs_ahashget(mp, an)
start_over:
for (ap = hp->lh_first; ap != NULL; ap = ap->link.le_next) {
- if (ap->block != an)
+ if (ABLKTOINO(ap->block) != an)
continue;
if (ap->flags & ALOCKED) {
ap->flags |= AWANT;
struct adosfsmount *amp;
struct anode *ap;
{
- LIST_INSERT_HEAD(&->anodetab[AHASH(ap->block)], ap, link);
+ LIST_INSERT_HEAD(&->anodetab[AHASH(ABLKTOINO(ap->block))], ap,
+ link);
ap->flags |= ALOCKED;
}
if (adoscksum(bp, amp->nwords)) {
#ifdef DIAGNOSTIC
printf("adosfs: aget: cksum of blk %ld failed\n",
- bp->b_blkno / amp->secsperblk);
+ bp->b_blkno / amp->secsperblk);
#endif
return (-1);
}
if (adoswordn(bp, 0) != BPT_SHORT) {
#ifdef DIAGNOSTIC
printf("adosfs: aget: bad primary type blk %ld\n",
- bp->b_blkno / amp->secsperblk);
+ bp->b_blkno / amp->secsperblk);
#endif
return (-1);
}
}
}
-static int
+static __inline char
CapitalChar(ch, inter)
- int ch, inter;
+ char ch;
+ int inter;
{
if ((ch >= 'a' && ch <= 'z') ||
- (inter && ch >= 0xe0 && ch <= 0xfe && ch != 0xf7))
+ (inter && ch >= '\xe0' && ch <= '\xfe' && ch != '\xf7'))
return(ch - ('a' - 'A'));
return(ch);
}
int
adoscaseequ(name1, name2, len, inter)
- const u_char *name1, *name2;
+ const char *name1, *name2;
int len, inter;
{
while (len-- > 0)
int
adoshash(nam, namlen, nelt, inter)
- const u_char *nam;
+ const char *nam;
int namlen, nelt, inter;
{
int val;
val = namlen;
while (namlen--)
- val = ((val * 13) + CapitalChar(*nam++, inter)) & 0x7ff;
+ val = ((val * 13) + (u_char)CapitalChar(*nam++, inter)) &
+ 0x7ff;
return(val % nelt);
}
{
}
#endif
-
-#ifndef m68k
-u_int32_t
-adoswordn(bp, wn)
- struct buf *bp;
- int wn;
-{
- /*
- * ados stored in network (big endian) order
- */
- return(ntohl(*((u_int32_t *)bp->b_data + wn)));
-}
-#endif
-/* $OpenBSD: advfsops.c,v 1.8 1996/08/23 19:11:00 niklas Exp $ */
-/* $NetBSD: advfsops.c,v 1.19.4.1 1996/05/27 10:21:30 is Exp $ */
+/* $OpenBSD: advfsops.c,v 1.9 1997/01/20 15:49:53 niklas Exp $ */
+/* $NetBSD: advfsops.c,v 1.24 1996/12/22 10:10:12 cgd Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
#include <sys/time.h>
#include <sys/malloc.h>
#include <sys/disklabel.h>
-#include <miscfs/specfs/specdev.h> /* XXX */
#include <sys/fcntl.h>
#include <sys/namei.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
#include <sys/buf.h>
+
+#include <miscfs/specfs/specdev.h> /* XXX */
#include <adosfs/adosfs.h>
-void adosfs_init __P((void));
-int adosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
- struct proc *));
-int adosfs_start __P((struct mount *, int, struct proc *));
-int adosfs_unmount __P((struct mount *, int, struct proc *));
-int adosfs_root __P((struct mount *, struct vnode **));
-int adosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
-int adosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
-int adosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
-int adosfs_vget __P((struct mount *, ino_t, struct vnode **));
-int adosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
- struct vnode **, int *, struct ucred **));
-int adosfs_vptofh __P((struct vnode *, struct fid *));
-
-int adosfs_mountfs __P((struct vnode *, struct mount *, struct proc *));
-int adosfs_loadbitmap __P((struct adosfsmount *));
+void adosfs_init __P((void));
+int adosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *,
+ struct proc *));
+int adosfs_start __P((struct mount *, int, struct proc *));
+int adosfs_unmount __P((struct mount *, int, struct proc *));
+int adosfs_root __P((struct mount *, struct vnode **));
+int adosfs_quotactl __P((struct mount *, int, uid_t, caddr_t,
+ struct proc *));
+int adosfs_statfs __P((struct mount *, struct statfs *, struct proc *));
+int adosfs_sync __P((struct mount *, int, struct ucred *, struct proc *));
+int adosfs_vget __P((struct mount *, ino_t, struct vnode **));
+int adosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
+ struct vnode **, int *, struct ucred **));
+int adosfs_vptofh __P((struct vnode *, struct fid *));
+
+int adosfs_mountfs __P((struct vnode *, struct mount *, struct proc *));
+int adosfs_loadbitmap __P((struct adosfsmount *));
int
adosfs_mount(mp, path, data, ndp, p)
parp = &dl.d_partitions[part];
amp = malloc(sizeof(struct adosfsmount), M_ADOSFSMNT, M_WAITOK);
- bzero((char *)amp, (u_long)sizeof(struct adosfsmount));
+ bzero((char *)amp, sizeof(struct adosfsmount));
amp->mp = mp;
if (dl.d_type == DTYPE_FLOPPY) {
amp->bsize = dl.d_secsize;
amp->devvp = devvp;
mp->mnt_data = (qaddr_t)amp;
- mp->mnt_stat.f_fsid.val[0] = (long)devvp->v_rdev;
+ mp->mnt_stat.f_fsid.val[0] = (int32_t)devvp->v_rdev;
mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_ADOSFS);
mp->mnt_flag |= MNT_LOCAL;
devvp->v_specflags |= SI_MOUNTEDON;
struct vnode *nvp;
int error;
- if ((error = VFS_VGET(mp, (ino_t)VFSTOADOSFS(mp)->rootb, &nvp)) != 0)
+ if ((error = VFS_VGET(mp, ABLKTOINO(VFSTOADOSFS(mp)->rootb), &nvp)) !=
+ 0)
return (error);
/* XXX verify it's a root block? */
*vpp = nvp;
bzero(ap, sizeof(struct anode));
ap->vp = vp;
ap->amp = amp;
- ap->block = an;
+ ap->block = AINOTOBLK(an);
ap->nwords = amp->nwords;
adosfs_ainshash(amp, ap);
- if ((error = bread(amp->devvp, an * amp->secsperblk,
- amp->bsize, NOCRED, &bp)) != 0) {
+ if ((error = bread(amp->devvp, an * amp->secsperblk, amp->bsize,
+ NOCRED, &bp)) != 0) {
vput(vp);
return (error);
}
* convert from BCPL string and
* from: "part:dir/file" to: "/part/dir/file"
*/
- nam = bp->b_data + (6 * sizeof(long));
+ nam = bp->b_data + (6 * sizeof(u_int32_t));
namlen = strlen(nam);
tmp = nam;
while (*tmp && *tmp != ':')
if (vp->v_type == VDIR) {
int i;
- ap->tab = malloc(ANODETABSZ(ap) * 2, M_ANODE, M_WAITOK);
ap->ntabent = ANODETABENT(ap);
+ ap->tab = malloc(ap->ntabent * (sizeof(daddr_t) + sizeof(int)),
+ M_ANODE, M_WAITOK);
ap->tabi = (int *)&ap->tab[ap->ntabent];
- bzero(ap->tabi, ANODETABSZ(ap));
+ bzero(ap->tabi, ANODETABENT(ap) * sizeof(int));
for (i = 0; i < ap->ntabent; i++)
- ap->tab[i] = adoswordn(bp, i + 6);
+ ap->tab[i] = (daddr_t)adoswordn(bp, i + 6);
}
/*
* misc.
*/
- ap->pblock = adoswordn(bp, ap->nwords - 3);
- ap->hashf = adoswordn(bp, ap->nwords - 4);
- ap->linknext = adoswordn(bp, ap->nwords - 10);
- ap->linkto = adoswordn(bp, ap->nwords - 11);
+ ap->pblock = (daddr_t)adoswordn(bp, ap->nwords - 3);
+ ap->hashf = (daddr_t)adoswordn(bp, ap->nwords - 4);
+ ap->linknext = (daddr_t)adoswordn(bp, ap->nwords - 10);
+ ap->linkto = (daddr_t)adoswordn(bp, ap->nwords - 11);
/*
* setup last indirect block cache.
struct adosfsmount *amp;
{
struct buf *bp, *mapbp;
- u_long bits, bn, n;
- int blkix, endix, mapix;
- int bmsize;
+ u_int32_t bits;
+ daddr_t bn;
+ int blkix, endix, mapix, bmsize, n;
int error;
bp = mapbp = NULL;
if (adoscksum(mapbp, amp->nwords)) {
#ifdef DIAGNOSTIC
printf("adosfs: loadbitmap - cksum of blk %d failed\n",
- adoswordn(bp, blkix));
+ adoswordn(bp, blkix));
#endif
/* XXX Force read-only? Set free space 0? */
break;
}
++blkix;
if (mapix < bmsize && blkix == endix) {
- bn = adoswordn(bp, blkix);
+ bn = (daddr_t)adoswordn(bp, blkix);
brelse(bp);
if ((error = bread(amp->devvp, bn * amp->secsperblk,
amp->bsize, NOCRED, &bp)) != 0)
* - check that the generation number matches
*/
+/*
+ * This is using the same layout as struct fid from mount.h for the first two
+ * fields.
+ */
struct ifid {
- ushort ifid_len;
- ushort ifid_pad;
- int ifid_ino;
- long ifid_start;
+ u_short ifid_len;
+ u_short ifid_pad;
+ ino_t ifid_ino;
+ daddr_t ifid_start;
};
int
ifhp = (struct ifid *)fhp;
ifhp->ifid_len = sizeof(struct ifid);
- ifhp->ifid_ino = ap->block;
+ ifhp->ifid_ino = ABLKTOINO(ap->block);
ifhp->ifid_start = ap->block;
#ifdef ADOSFS_DIAGNOSTIC
-/* $OpenBSD: advnops.c,v 1.7 1996/10/13 21:17:39 niklas Exp $ */
-/* $NetBSD: advnops.c,v 1.28 1996/04/23 05:18:32 veego Exp $ */
+/* $OpenBSD: advnops.c,v 1.8 1997/01/20 15:49:54 niklas Exp $ */
+/* $NetBSD: advnops.c,v 1.32 1996/10/13 02:52:09 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
#include <sys/stat.h>
#include <sys/unistd.h>
#include <sys/proc.h>
+
#include <miscfs/specfs/specdev.h>
#include <adosfs/adosfs.h>
#define adosfs_valloc adenotsup
struct vnodeopv_entry_desc adosfs_vnodeop_entries[] = {
- { &vop_default_desc, vn_default_error },
- { &vop_lookup_desc, adosfs_lookup }, /* lookup */
- { &vop_create_desc, adosfs_create }, /* create */
- { &vop_mknod_desc, adosfs_mknod }, /* mknod */
- { &vop_open_desc, adosfs_open }, /* open */
- { &vop_close_desc, adosfs_close }, /* close */
- { &vop_access_desc, adosfs_access }, /* access */
- { &vop_getattr_desc, adosfs_getattr }, /* getattr */
- { &vop_setattr_desc, adosfs_setattr }, /* setattr */
- { &vop_read_desc, adosfs_read }, /* read */
- { &vop_write_desc, adosfs_write }, /* write */
- { &vop_lease_desc, adosfs_lease_check }, /* lease */
- { &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
- { &vop_select_desc, adosfs_select }, /* select */
- { &vop_mmap_desc, adosfs_mmap }, /* mmap */
- { &vop_fsync_desc, adosfs_fsync }, /* fsync */
- { &vop_seek_desc, adosfs_seek }, /* seek */
- { &vop_remove_desc, adosfs_remove }, /* remove */
- { &vop_link_desc, adosfs_link }, /* link */
- { &vop_rename_desc, adosfs_rename }, /* rename */
- { &vop_mkdir_desc, adosfs_mkdir }, /* mkdir */
- { &vop_rmdir_desc, adosfs_rmdir }, /* rmdir */
- { &vop_symlink_desc, adosfs_symlink }, /* symlink */
- { &vop_readdir_desc, adosfs_readdir }, /* readdir */
- { &vop_readlink_desc, adosfs_readlink }, /* readlink */
- { &vop_abortop_desc, adosfs_abortop }, /* abortop */
- { &vop_inactive_desc, adosfs_inactive }, /* inactive */
- { &vop_reclaim_desc, adosfs_reclaim }, /* reclaim */
- { &vop_lock_desc, adosfs_lock }, /* lock */
- { &vop_unlock_desc, adosfs_unlock }, /* unlock */
- { &vop_bmap_desc, adosfs_bmap }, /* bmap */
- { &vop_strategy_desc, adosfs_strategy }, /* strategy */
- { &vop_print_desc, adosfs_print }, /* print */
- { &vop_islocked_desc, adosfs_islocked }, /* islocked */
- { &vop_pathconf_desc, adosfs_pathconf }, /* pathconf */
- { &vop_advlock_desc, adosfs_advlock }, /* advlock */
- { &vop_blkatoff_desc, adosfs_blkatoff }, /* blkatoff */
- { &vop_valloc_desc, adosfs_valloc }, /* valloc */
- { &vop_vfree_desc, adosfs_vfree }, /* vfree */
- { &vop_truncate_desc, adosfs_truncate }, /* truncate */
- { &vop_update_desc, adosfs_update }, /* update */
- { &vop_bwrite_desc, adosfs_bwrite }, /* bwrite */
+ { &vop_default_desc, vn_default_error },
+ { &vop_lookup_desc, adosfs_lookup }, /* lookup */
+ { &vop_create_desc, adosfs_create }, /* create */
+ { &vop_mknod_desc, adosfs_mknod }, /* mknod */
+ { &vop_open_desc, adosfs_open }, /* open */
+ { &vop_close_desc, adosfs_close }, /* close */
+ { &vop_access_desc, adosfs_access }, /* access */
+ { &vop_getattr_desc, adosfs_getattr }, /* getattr */
+ { &vop_setattr_desc, adosfs_setattr }, /* setattr */
+ { &vop_read_desc, adosfs_read }, /* read */
+ { &vop_write_desc, adosfs_write }, /* write */
+ { &vop_lease_desc, adosfs_lease_check }, /* lease */
+ { &vop_ioctl_desc, adosfs_ioctl }, /* ioctl */
+ { &vop_select_desc, adosfs_select }, /* select */
+ { &vop_mmap_desc, adosfs_mmap }, /* mmap */
+ { &vop_fsync_desc, adosfs_fsync }, /* fsync */
+ { &vop_seek_desc, adosfs_seek }, /* seek */
+ { &vop_remove_desc, adosfs_remove }, /* remove */
+ { &vop_link_desc, adosfs_link }, /* link */
+ { &vop_rename_desc, adosfs_rename }, /* rename */
+ { &vop_mkdir_desc, adosfs_mkdir }, /* mkdir */
+ { &vop_rmdir_desc, adosfs_rmdir }, /* rmdir */
+ { &vop_symlink_desc, adosfs_symlink }, /* symlink */
+ { &vop_readdir_desc, adosfs_readdir }, /* readdir */
+ { &vop_readlink_desc, adosfs_readlink }, /* readlink */
+ { &vop_abortop_desc, adosfs_abortop }, /* abortop */
+ { &vop_inactive_desc, adosfs_inactive }, /* inactive */
+ { &vop_reclaim_desc, adosfs_reclaim }, /* reclaim */
+ { &vop_lock_desc, adosfs_lock }, /* lock */
+ { &vop_unlock_desc, adosfs_unlock }, /* unlock */
+ { &vop_bmap_desc, adosfs_bmap }, /* bmap */
+ { &vop_strategy_desc, adosfs_strategy }, /* strategy */
+ { &vop_print_desc, adosfs_print }, /* print */
+ { &vop_islocked_desc, adosfs_islocked }, /* islocked */
+ { &vop_pathconf_desc, adosfs_pathconf }, /* pathconf */
+ { &vop_advlock_desc, adosfs_advlock }, /* advlock */
+ { &vop_blkatoff_desc, adosfs_blkatoff }, /* blkatoff */
+ { &vop_valloc_desc, adosfs_valloc }, /* valloc */
+ { &vop_vfree_desc, adosfs_vfree }, /* vfree */
+ { &vop_truncate_desc, adosfs_truncate }, /* truncate */
+ { &vop_update_desc, adosfs_update }, /* update */
+ { &vop_bwrite_desc, adosfs_bwrite }, /* bwrite */
{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
};
struct vattr *vap;
struct adosfsmount *amp;
struct anode *ap;
- u_long fblks;
+ u_int32_t fblks;
#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
vap->va_gen = 0;
vap->va_flags = 0;
vap->va_rdev = NODEV;
- vap->va_fileid = ap->block;
+ vap->va_fileid = (long)ap->block;
vap->va_type = sp->a_vp->v_type;
vap->va_mode = amp->mask & adunixprot(ap->adprot);
if (sp->a_vp->v_type == VDIR) {
fblks = howmany(ap->fsize, amp->dbsize);
fblks += howmany(fblks, ANODENDATBLKENT(ap));
vap->va_bytes = fblks * amp->dbsize;
- vap->va_size = ap->fsize;
+ vap->va_size = (off_t)ap->fsize;
vap->va_blocksize = amp->dbsize;
}
struct uio *uio;
struct buf *bp;
daddr_t lbn;
- int size, diff, error;
- long n, on;
+ int size, error, n, on;
+ u_int32_t off;
+ int64_t diff;
#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
}
if (uio->uio_resid == 0)
goto reterr;
- if (uio->uio_offset < 0) {
+ if (uio->uio_offset < 0 || uio->uio_offset > UINT_MAX) { /* XXX */
error = EINVAL;
goto reterr;
}
+ off = (u_int32_t)uio->uio_offset;
/*
* to expensive to let general algorithm figure out that
* we are beyond the file. Do it now.
*/
- if (uio->uio_offset >= ap->fsize)
+ if (off >= ap->fsize)
goto reterr;
/*
* (which have data blocks without headers)
*/
size = amp->dbsize;
- lbn = uio->uio_offset / size;
- on = uio->uio_offset % size;
- n = min((u_int)(size - on), uio->uio_resid);
- diff = ap->fsize - uio->uio_offset;
+ lbn = off / size;
+ on = off % size;
+ n = min((u_int32_t)(size - on), uio->uio_resid);
+ diff = ap->fsize - off;
/*
* check for EOF
*/
if (diff <= 0)
return(0);
if (diff < n)
- n = diff;
+ n = (int)diff;
/*
* read ahead could possibly be worth something
* but not much as ados makes little attempt to
* make things contigous
*/
- error = bread(sp->a_vp, lbn * amp->secsperblk,
- amp->bsize, NOCRED, &bp);
+ error = bread(sp->a_vp, lbn * amp->secsperblk, amp->bsize,
+ NOCRED, &bp);
sp->a_vp->v_lastr = lbn;
if (!IS_FFS(amp)) {
else if (adoswordn(bp, 0) != BPT_DATA) {
#ifdef DIAGNOSTIC
printf("adosfs: bad primary type blk %ld\n",
- bp->b_blkno / amp->secsperblk);
+ bp->b_blkno / amp->secsperblk);
#endif
error=EINVAL;
}
- else if ( adoscksum(bp, ap->nwords)) {
+ else if (adoscksum(bp, ap->nwords)) {
#ifdef DIAGNOSTIC
- printf("adosfs: blk %ld failed cksum.\n",
- bp->b_blkno / amp->secsperblk);
+ printf("adosfs: blk %u failed cksum.\n",
+ bp->b_blkno / amp->secsperblk);
#endif
error=EINVAL;
}
goto reterr;
}
#ifdef ADOSFS_DIAGNOSTIC
- printf(" %d+%d-%d+%d", lbn, on, lbn, n);
+ printf(" %u+%u-%u+%u", lbn, on, lbn, n);
#endif
- n = min(n, (u_int)size - bp->b_resid);
- error = uiomove(bp->b_un.b_addr + on +
- amp->bsize - amp->dbsize, (int)n, uio);
+ n = min(n, size - bp->b_resid); /* XXX check types */
+ error = uiomove(bp->b_un.b_addr + on + amp->bsize -
+ amp->dbsize, n, uio);
brelse(bp);
+ off = (u_int32_t)uio->uio_offset;
} while (error == 0 && uio->uio_resid > 0 && n != 0);
reterr:
#ifdef ADOSFS_DIAGNOSTIC
goto reterr;
}
}
- if ((long)bp->b_blkno == -1) {
+#if 0
+ if (bp->b_blkno == UINT_MAX) { /* XXX huh? (was (long)... == -1 */
biodone(bp);
error = 0;
goto reterr;
}
+#endif
vp = ap->amp->devvp;
bp->b_dev = vp->v_rdev;
VOCALL(vp->v_op, VOFFSET(vop_strategy), sp);
} */ *sp = v;
struct anode *ap;
struct buf *flbp;
- long nb, fcnt, flblk, flblkoff;
- daddr_t *bnp;
- daddr_t bn;
- int error;
+ daddr_t *bnp, bn, nb, flblk, fcnt;
+ int error, flblkoff;
#ifdef ADOSFS_DIAGNOSTIC
advopprint(sp);
/*
* check last indirect block cache
*/
- if (flblk < (long)ap->lastlindblk)
+ if (flblk < ap->lastlindblk)
fcnt = 0;
else {
flblk -= ap->lastlindblk;
fcnt = ap->lastlindblk;
nb = ap->lastindblk;
}
- while (flblk >= 0) {
+ while (1) {
if (flbp)
brelse(flbp);
if (nb == 0) {
goto reterr;
if (adoscksum(flbp, ap->nwords)) {
#ifdef DIAGNOSTIC
- printf("adosfs: blk %ld failed cksum.\n", nb);
+ printf("adosfs: blk %u failed cksum.\n", nb);
#endif
brelse(flbp);
error = EINVAL;
ap->lastlindblk = fcnt++;
ap->lastindblk = nb;
- nb = adoswordn(flbp, ap->nwords - 2);
+ nb = (daddr_t)adoswordn(flbp, ap->nwords - 2);
+ if (flblk == 0)
+ break;
flblk--;
}
/*
* valid table entries stored at offset ADBI_NBLKTABENT.
*/
flblkoff = bn % ANODENDATBLKENT(ap);
- if (flblkoff < (long)adoswordn(flbp, 2 /* ADBI_NBLKTABENT */)) {
+ if (flblkoff < adoswordn(flbp, 2 /* ADBI_NBLKTABENT */)) {
flblkoff = (ap->nwords - 51) - flblkoff;
*bnp = adoswordn(flbp, flblkoff) * ap->amp->secsperblk;
} else {
#ifdef DIAGNOSTIC
- printf("flblk offset %ld too large in lblk %ld blk %d\n",
- flblkoff, bn / ap->amp->secsperblk , flbp->b_blkno);
+ printf("flblk offset %d too large in lblk %u blk %u\n",
+ flblkoff, bn / ap->amp->secsperblk, flbp->b_blkno);
#endif
error = EINVAL;
}
reterr:
#ifdef ADOSFS_DIAGNOSTIC
if (error == 0 && bnp)
- printf(" %d => %d", bn, *bnp);
+ printf(" %u => %u", bn, *bnp);
printf(" %d)", error);
#endif
return(error);
return(0);
}
+/* This is laid out like a standard dirent, except that it is shorter. */
struct adirent {
- u_long fileno;
- u_short reclen;
- char type;
- char namlen;
- char name[32]; /* maxlen of 30 plus 2 NUL's */
+ u_int32_t fileno;
+ u_int16_t reclen;
+ u_int8_t type;
+ u_int8_t namlen;
+ char name[32]; /* maxlen of 30 plus 2 NUL's */
};
-
-int
+
+/* XXX look over the off_t usage below wrt type safety */
+int
adosfs_readdir(v)
void *v;
{
struct adosfsmount *amp;
struct vnode *vp;
struct uio *uio;
- u_long nextbn;
+ daddr_t nextbn;
off_t uoff;
#ifdef ADOSFS_DIAGNOSTIC
*/
ap = NULL;
do {
- error = VFS_VGET(amp->mp, (ino_t)nextbn, &vp);
+ error = VFS_VGET(amp->mp, ABLKTOINO(nextbn), &vp);
if (error)
goto reterr;
ap = VTOA(vp);
* Fill in dirent record
*/
bzero(adp, sizeof(struct adirent));
- adp->fileno = ap->block;
+ adp->fileno = (u_int32_t)ap->block;
/*
* this deserves an function in kern/vfs_subr.c
*/
bcopy(ap->name, adp->name, adp->namlen);
vput(vp);
- error = uiomove((caddr_t) adp, sizeof(struct adirent), uio);
+ error = uiomove((caddr_t)adp, sizeof(struct adirent), uio);
if (error)
break;
if (sp->a_cookies) {
- *sp->a_cookies++ = uoff;
+ *sp->a_cookies++ = (u_long)uoff;
sp->a_ncookies--;
}
uoff += sizeof(struct adirent);