Annotation of src/sys/adosfs/adosfs.h, Revision 1.17.16.1
1.17.16.1! thorpej 1: /* $NetBSD: adosfs.h,v 1.19 2001/09/15 22:44:09 chs Exp $ */
1.4 cgd 2:
1.1 chopps 3: /*
4: * Copyright (c) 1994 Christian E. Hopps
1.10 mhitch 5: * Copyright (c) 1996 Matthias Scheler
1.1 chopps 6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by Christian E. Hopps.
19: * 4. The name of the author may not be used to endorse or promote products
20: * derived from this software without specific prior written permission
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32: */
33:
34: /*
1.13 fvdl 35: * Arguments to mount amigados filesystems.
36: */
37: struct adosfs_args {
38: char *fspec; /* blocks special holding the fs to mount */
39: struct export_args export; /* network export information */
1.14 kleink 40: uid_t uid; /* uid that owns adosfs files */
41: gid_t gid; /* gid that owns adosfs files */
42: mode_t mask; /* mask to be applied for adosfs perms */
1.13 fvdl 43: };
44:
45: #ifdef _KERNEL
1.17.16.1! thorpej 46: #include <miscfs/genfs/genfs_node.h>
! 47:
1.13 fvdl 48: /*
1.1 chopps 49: * Amigados datestamp. (from 1/1/1978 00:00:00 local)
50: */
51: struct datestamp {
1.12 thorpej 52: u_int32_t days;
53: u_int32_t mins;
54: u_int32_t ticks; /* 20000 * (ticks % 50) = useconds */
1.1 chopps 55: /* ticks / 50 = seconds */
56: };
57:
58: enum anode_type { AROOT, ADIR, AFILE, ALDIR, ALFILE, ASLINK };
59:
60: /*
61: * similar to inode's, we use to represent:
62: * the root dir, reg dirs, reg files and extension blocks
63: * note the ``tab'' is a hash table for r/d, and a data block
64: * table for f/e. it is always ANODETABSZ(ap) bytes in size.
65: */
66: struct anode {
1.17.16.1! thorpej 67: struct genfs_node gnode;
1.1 chopps 68: LIST_ENTRY(anode) link;
69: enum anode_type type;
70: char name[31]; /* (r/d/f) name for object */
71: struct datestamp mtimev; /* (r) volume modified */
72: struct datestamp created; /* (r) volume created */
73: struct datestamp mtime; /* (r/d/f) last modified */
1.7 mycroft 74: struct adosfsmount *amp; /* owner file system */
1.1 chopps 75: struct vnode *vp; /* owner vnode */
76: u_long fsize; /* (f) size of file in bytes */
77: u_long block; /* block num */
78: u_long pblock; /* (d/f/e) parent block */
79: u_long hashf; /* (d/f) hash forward */
80: u_long extb; /* (f/e) extension block number */
81: u_long linkto; /* (hd/hf) header this link points at */
82: u_long linknext; /* (d/f/hd/hf) next link (or head) in chain */
1.5 chopps 83: u_long lastlindblk; /* (f/hf) last logical indirect block */
84: u_long lastindblk; /* (f/hf) last indirect block read */
1.1 chopps 85: u_long *tab; /* (r/d) hash table */
86: int *tabi; /* (r/d) table info */
87: int ntabent; /* (r/d) number of entries in table */
88: int nwords; /* size of blocks in long words */
89: int adprot; /* (d/f) amigados protection bits */
1.6 chopps 90: uid_t uid; /* (d/f) uid of directory/file */
91: gid_t gid; /* (d/f) gid of directory/file */
1.1 chopps 92: int flags; /* misc flags */
93: char *slinkto; /* name of file or dir */
94: };
1.10 mhitch 95: #define VTOA(vp) ((struct anode *)(vp)->v_data)
96: #define ATOV(ap) ((ap)->vp)
97: #define ANODETABSZ(ap) (((ap)->nwords - 56) * sizeof(long))
98: #define ANODETABENT(ap) ((ap)->nwords - 56)
1.1 chopps 99: #define ANODENDATBLKENT(ap) ((ap)->nwords - 56)
100:
101: /*
102: * mount data
103: */
104: #define ANODEHASHSZ (512)
105:
1.7 mycroft 106: struct adosfsmount {
1.1 chopps 107: LIST_HEAD(anodechain, anode) anodetab[ANODEHASHSZ];
108: struct mount *mp; /* owner mount */
1.12 thorpej 109: u_int32_t dostype; /* type of volume */
1.1 chopps 110: u_long rootb; /* root block number */
1.10 mhitch 111: u_long secsperblk; /* sectors per block */
1.1 chopps 112: u_long bsize; /* size of blocks */
113: u_long nwords; /* size of blocks in long words */
1.10 mhitch 114: u_long dbsize; /* data bytes per block */
1.1 chopps 115: uid_t uid; /* uid of mounting user */
116: gid_t gid; /* gid of mounting user */
117: u_long mask; /* mode mask */
118: struct vnode *devvp; /* blk device mounted on */
119: struct vnode *rootvp; /* out root vnode */
1.8 chopps 120: struct netexport export;
1.10 mhitch 121: u_long *bitmap; /* allocation bitmap */
122: u_long numblks; /* number of usable blocks */
123: u_long freeblks; /* number of free blocks */
1.1 chopps 124: };
1.13 fvdl 125:
1.7 mycroft 126: #define VFSTOADOSFS(mp) ((struct adosfsmount *)(mp)->mnt_data)
1.1 chopps 127:
1.10 mhitch 128: #define IS_FFS(amp) ((amp)->dostype & 1)
129: #define IS_INTER(amp) (((amp)->dostype & 7) > 1)
130:
1.1 chopps 131: /*
132: * AmigaDOS block stuff.
133: */
1.10 mhitch 134: #define BBOFF (0)
135:
1.12 thorpej 136: #define BPT_SHORT ((u_int32_t)2)
137: #define BPT_DATA ((u_int32_t)8)
138: #define BPT_LIST ((u_int32_t)16)
139:
140: #define BST_RDIR ((u_int32_t)1)
141: #define BST_UDIR ((u_int32_t)2)
142: #define BST_SLINK ((u_int32_t)3)
143: #define BST_LDIR ((u_int32_t)4)
144: #define BST_FILE ((u_int32_t)-3)
145: #define BST_LFILE ((u_int32_t)-4)
1.1 chopps 146:
1.10 mhitch 147: #define OFS_DATA_OFFSET (24)
1.15 thorpej 148:
149: extern struct pool adosfs_node_pool;
1.10 mhitch 150:
1.1 chopps 151: /*
152: * utility protos
153: */
1.16 kleink 154: #if BYTE_ORDER != BIG_ENDIAN
1.12 thorpej 155: u_int32_t adoswordn __P((struct buf *, int));
1.10 mhitch 156: #else
1.12 thorpej 157: #define adoswordn(bp,wn) (*((u_int32_t *)(bp)->b_data + (wn)))
1.10 mhitch 158: #endif
159:
1.12 thorpej 160: u_int32_t adoscksum __P((struct buf *, int));
1.11 is 161: int adoscaseequ __P((const u_char *, const u_char *, int, int));
1.10 mhitch 162: int adoshash __P((const u_char *, int, int, int));
1.9 christos 163: int adunixprot __P((int));
164: int adosfs_getblktype __P((struct adosfsmount *, struct buf *));
1.1 chopps 165:
1.2 chopps 166: struct vnode *adosfs_ahashget __P((struct mount *, ino_t));
1.7 mycroft 167: void adosfs_ainshash __P((struct adosfsmount *, struct anode *));
1.2 chopps 168: void adosfs_aremhash __P((struct anode *));
1.1 chopps 169:
1.9 christos 170: int adosfs_lookup __P((void *));
1.2 chopps 171:
1.9 christos 172: int (**adosfs_vnodeop_p) __P((void *));
1.13 fvdl 173: #endif /* _KERNEL */
CVSweb <webmaster@jp.NetBSD.org>