blob: 7886518e2705cd2edc107e2393d2b9cdf9e6d491 [file] [log] [blame]
rsc056fe1b2003-11-23 18:19:58 +00001#include <u.h>
2#include <libc.h>
3#include <venti.h>
4
5enum {
6 OVtErrType, /* illegal */
7
8 OVtRootType,
9 OVtDirType,
10 OVtPointerType0,
11 OVtPointerType1,
12 OVtPointerType2,
13 OVtPointerType3,
14 OVtPointerType4,
15 OVtPointerType5,
16 OVtPointerType6,
17 OVtPointerType7, /* not used */
18 OVtPointerType8, /* not used */
19 OVtPointerType9, /* not used */
20 OVtDataType,
21
22 OVtMaxType
23};
24
25
26uint todisk[] = {
27 OVtDataType,
28 OVtPointerType0,
29 OVtPointerType1,
30 OVtPointerType2,
31 OVtPointerType3,
32 OVtPointerType4,
33 OVtPointerType5,
34 OVtPointerType6,
35 OVtDirType,
36 OVtPointerType0,
37 OVtPointerType1,
38 OVtPointerType2,
39 OVtPointerType3,
40 OVtPointerType4,
41 OVtPointerType5,
42 OVtPointerType6,
43 OVtRootType,
44};
45
46uint fromdisk[] = {
rsc6cc81552004-06-14 21:43:01 +000047 VtCorruptType,
rsc056fe1b2003-11-23 18:19:58 +000048 VtRootType,
49 VtDirType,
50 VtDirType+1,
51 VtDirType+2,
52 VtDirType+3,
53 VtDirType+4,
54 VtDirType+5,
55 VtDirType+6,
56 VtDirType+7,
rsc6cc81552004-06-14 21:43:01 +000057 VtCorruptType,
58 VtCorruptType,
59 VtCorruptType,
rsc056fe1b2003-11-23 18:19:58 +000060 VtDataType,
61};
62
63uint
64vttodisktype(uint n)
65{
66 if(n >= nelem(todisk))
rsc6cc81552004-06-14 21:43:01 +000067 return VtCorruptType;
rsc056fe1b2003-11-23 18:19:58 +000068 return todisk[n];
69}
70
71uint
72vtfromdisktype(uint n)
73{
74 if(n >= nelem(fromdisk))
rsc6cc81552004-06-14 21:43:01 +000075 return VtCorruptType;
rsc056fe1b2003-11-23 18:19:58 +000076 return fromdisk[n];
77}
78