Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
/*
2
 *      include/linux/bfs_fs.h - BFS data structures on disk.
3
 *      Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com>
4
 */
5
 
6
#ifndef _LINUX_BFS_FS_H
7
#define _LINUX_BFS_FS_H
8
 
9
#define BFS_BSIZE_BITS          9
10
#define BFS_BSIZE               (1<<BFS_BSIZE_BITS)
11
 
12
#define BFS_MAGIC               0x1BADFACE
13
#define BFS_ROOT_INO            2
14
#define BFS_INODES_PER_BLOCK    8
15
 
16
/* SVR4 vnode type values (bfs_inode->i_vtype) */
17
#define BFS_VDIR                2
18
#define BFS_VREG                1
19
 
20
/* BFS inode layout on disk */
21
struct bfs_inode {
22
        __u16 i_ino;
23
        __u16 i_unused;
24
        __u32 i_sblock;
25
        __u32 i_eblock;
26
        __u32 i_eoffset;
27
        __u32 i_vtype;
28
        __u32 i_mode;
29
        __s32 i_uid;
30
        __s32 i_gid;
31
        __u32 i_nlink;
32
        __u32 i_atime;
33
        __u32 i_mtime;
34
        __u32 i_ctime;
35
        __u32 i_padding[4];
36
};
37
 
38
#define BFS_NAMELEN             14      
39
#define BFS_DIRENT_SIZE         16
40
#define BFS_DIRS_PER_BLOCK      32
41
 
42
struct bfs_dirent {
43
        __u16 ino;
44
        char name[BFS_NAMELEN];
45
};
46
 
47
/* BFS superblock layout on disk */
48
struct bfs_super_block {
49
        __u32 s_magic;
50
        __u32 s_start;
51
        __u32 s_end;
52
        __s32 s_from;
53
        __s32 s_to;
54
        __s32 s_bfrom;
55
        __s32 s_bto;
56
        char  s_fsname[6];
57
        char  s_volume[6];
58
        __u32 s_padding[118];
59
};
60
 
61
#define BFS_NZFILESIZE(ip) \
62
        (((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE)
63
 
64
#define BFS_FILESIZE(ip) \
65
        ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
66
 
67
#define BFS_FILEBLOCKS(ip) \
68
        ((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock)
69
 
70
#define BFS_OFF2INO(offset) \
71
        ((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
72
 
73
#define BFS_INO2OFF(ino) \
74
        ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
75
 
76
#define BFS_UNCLEAN(bfs_sb, sb) \
77
        ((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY))
78
 
79
#endif  /* _LINUX_BFS_FS_H */