bfs_fs.h 1.8 KB

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