blob: 5f57f93b284f1db41f0594160a4f74bea7b84dc4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __LINUX_ROMFS_FS_H
2#define __LINUX_ROMFS_FS_H
3
Mike Frysinger8d0a1de2011-01-12 17:01:12 -08004#include <linux/types.h>
5#include <linux/fs.h>
6
Linus Torvalds1da177e2005-04-16 15:20:36 -07007/* The basic structures of the romfs filesystem */
8
9#define ROMBSIZE BLOCK_SIZE
10#define ROMBSBITS BLOCK_SIZE_BITS
11#define ROMBMASK (ROMBSIZE-1)
12#define ROMFS_MAGIC 0x7275
13
14#define ROMFS_MAXFN 128
15
16#define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff))
17#define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff))
18#define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d)))
19#define ROMSB_WORD0 __mk4('-','r','o','m')
20#define ROMSB_WORD1 __mk4('1','f','s','-')
21
22/* On-disk "super block" */
23
24struct romfs_super_block {
25 __be32 word0;
26 __be32 word1;
27 __be32 size;
28 __be32 checksum;
29 char name[0]; /* volume name */
30};
31
32/* On disk inode */
33
34struct romfs_inode {
35 __be32 next; /* low 4 bits see ROMFH_ */
36 __be32 spec;
37 __be32 size;
38 __be32 checksum;
39 char name[0];
40};
41
42#define ROMFH_TYPE 7
43#define ROMFH_HRD 0
44#define ROMFH_DIR 1
45#define ROMFH_REG 2
46#define ROMFH_SYM 3
47#define ROMFH_BLK 4
48#define ROMFH_CHR 5
49#define ROMFH_SCK 6
50#define ROMFH_FIF 7
51#define ROMFH_EXEC 8
52
53/* Alignment */
54
55#define ROMFH_SIZE 16
56#define ROMFH_PAD (ROMFH_SIZE-1)
57#define ROMFH_MASK (~ROMFH_PAD)
58
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#endif