efs.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 1999 Al Smith
  3. *
  4. * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
  5. * Portions derived from IRIX header files (c) 1988 Silicon Graphics
  6. */
  7. #ifndef _EFS_EFS_H_
  8. #define _EFS_EFS_H_
  9. #include <linux/fs.h>
  10. #include <asm/uaccess.h>
  11. #define EFS_VERSION "1.0a"
  12. static const char cprt[] = "EFS: "EFS_VERSION" - (c) 1999 Al Smith <Al.Smith@aeschi.ch.eu.org>";
  13. /* 1 block is 512 bytes */
  14. #define EFS_BLOCKSIZE_BITS 9
  15. #define EFS_BLOCKSIZE (1 << EFS_BLOCKSIZE_BITS)
  16. typedef int32_t efs_block_t;
  17. typedef uint32_t efs_ino_t;
  18. #define EFS_DIRECTEXTENTS 12
  19. /*
  20. * layout of an extent, in memory and on disk. 8 bytes exactly.
  21. */
  22. typedef union extent_u {
  23. unsigned char raw[8];
  24. struct extent_s {
  25. unsigned int ex_magic:8; /* magic # (zero) */
  26. unsigned int ex_bn:24; /* basic block */
  27. unsigned int ex_length:8; /* numblocks in this extent */
  28. unsigned int ex_offset:24; /* logical offset into file */
  29. } cooked;
  30. } efs_extent;
  31. typedef struct edevs {
  32. __be16 odev;
  33. __be32 ndev;
  34. } efs_devs;
  35. /*
  36. * extent based filesystem inode as it appears on disk. The efs inode
  37. * is exactly 128 bytes long.
  38. */
  39. struct efs_dinode {
  40. __be16 di_mode; /* mode and type of file */
  41. __be16 di_nlink; /* number of links to file */
  42. __be16 di_uid; /* owner's user id */
  43. __be16 di_gid; /* owner's group id */
  44. __be32 di_size; /* number of bytes in file */
  45. __be32 di_atime; /* time last accessed */
  46. __be32 di_mtime; /* time last modified */
  47. __be32 di_ctime; /* time created */
  48. __be32 di_gen; /* generation number */
  49. __be16 di_numextents; /* # of extents */
  50. u_char di_version; /* version of inode */
  51. u_char di_spare; /* spare - used by AFS */
  52. union di_addr {
  53. efs_extent di_extents[EFS_DIRECTEXTENTS];
  54. efs_devs di_dev; /* device for IFCHR/IFBLK */
  55. } di_u;
  56. };
  57. /* efs inode storage in memory */
  58. struct efs_inode_info {
  59. int numextents;
  60. int lastextent;
  61. efs_extent extents[EFS_DIRECTEXTENTS];
  62. struct inode vfs_inode;
  63. };
  64. #include <linux/efs_fs_sb.h>
  65. #define EFS_DIRBSIZE_BITS EFS_BLOCKSIZE_BITS
  66. #define EFS_DIRBSIZE (1 << EFS_DIRBSIZE_BITS)
  67. struct efs_dentry {
  68. __be32 inode;
  69. unsigned char namelen;
  70. char name[3];
  71. };
  72. #define EFS_DENTSIZE (sizeof(struct efs_dentry) - 3 + 1)
  73. #define EFS_MAXNAMELEN ((1 << (sizeof(char) * 8)) - 1)
  74. #define EFS_DIRBLK_HEADERSIZE 4
  75. #define EFS_DIRBLK_MAGIC 0xbeef /* moo */
  76. struct efs_dir {
  77. __be16 magic;
  78. unsigned char firstused;
  79. unsigned char slots;
  80. unsigned char space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE];
  81. };
  82. #define EFS_MAXENTS \
  83. ((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / \
  84. (EFS_DENTSIZE + sizeof(char)))
  85. #define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot])
  86. #define EFS_REALOFF(offset) ((offset << 1))
  87. static inline struct efs_inode_info *INODE_INFO(struct inode *inode)
  88. {
  89. return container_of(inode, struct efs_inode_info, vfs_inode);
  90. }
  91. static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
  92. {
  93. return sb->s_fs_info;
  94. }
  95. struct statfs;
  96. struct fid;
  97. extern const struct inode_operations efs_dir_inode_operations;
  98. extern const struct file_operations efs_dir_operations;
  99. extern const struct address_space_operations efs_symlink_aops;
  100. extern struct inode *efs_iget(struct super_block *, unsigned long);
  101. extern efs_block_t efs_map_block(struct inode *, efs_block_t);
  102. extern int efs_get_block(struct inode *, sector_t, struct buffer_head *, int);
  103. extern struct dentry *efs_lookup(struct inode *, struct dentry *, struct nameidata *);
  104. extern struct dentry *efs_fh_to_dentry(struct super_block *sb, struct fid *fid,
  105. int fh_len, int fh_type);
  106. extern struct dentry *efs_fh_to_parent(struct super_block *sb, struct fid *fid,
  107. int fh_len, int fh_type);
  108. extern struct dentry *efs_get_parent(struct dentry *);
  109. extern int efs_bmap(struct inode *, int);
  110. #endif /* _EFS_EFS_H_ */