summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cfs/cformat.h
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/cfs/cformat.h
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/cfs/cformat.h')
-rwxr-xr-xsys/src/cmd/cfs/cformat.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/sys/src/cmd/cfs/cformat.h b/sys/src/cmd/cfs/cformat.h
new file mode 100755
index 000000000..b69e3ee8b
--- /dev/null
+++ b/sys/src/cmd/cfs/cformat.h
@@ -0,0 +1,75 @@
+/*
+ * format of cache on disk
+ */
+typedef struct Dptr Dptr;
+typedef struct Dahdr Dahdr;
+typedef struct Dalloc Dalloc;
+typedef struct Fphdr Fphdr;
+typedef struct Fptr Fptr;
+typedef struct Inode Inode;
+typedef struct Dihdr Dihdr;
+typedef struct Dinode Dinode;
+
+enum
+{
+ Amagic= 0xbebeefed, /* allocation block magic */
+ Imagic= 0xbadc00ce, /* inode block magic */
+ BtoUL= 8*sizeof(ulong),/* bits in a ulong */
+ CACHENAMELEN= 128
+};
+#define Indbno 0x80000000 /* indirect block */
+#define Notabno 0xFFFFFFFF /* not a block number */
+
+/*
+ * Allocation blocks at the begining of the disk. There are
+ * enough of these blocks to supply 1 bit for each block on the
+ * disk;
+ */
+struct Dahdr
+{
+ ulong magic;
+ ulong bsize; /* logical block size */
+ char name[CACHENAMELEN];
+ short nab; /* number of allocation blocks */
+};
+struct Dalloc
+{
+ Dahdr;
+ ulong bits[1];
+};
+
+/*
+ * A pointer to disk data
+ */
+struct Dptr
+{
+ ulong fbno; /* file block number */
+ ulong bno; /* disk block number */
+ ushort start; /* offset into block of valid data */
+ ushort end; /* offset into block after valid data */
+};
+
+/*
+ * A file descriptor.
+ */
+struct Inode
+{
+ Qid qid;
+ vlong length;
+ Dptr ptr; /* pointer page */
+ char inuse;
+};
+
+/*
+ * inode blocks (after allocation blocks)
+ */
+struct Dihdr
+{
+ ulong magic;
+ ulong nino; /* number of inodes */
+};
+struct Dinode
+{
+ Dihdr;
+ Inode inode[1];
+};