bfs_fs.h 1.8 KB

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