udfdecl.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #ifndef __UDF_DECL_H
  2. #define __UDF_DECL_H
  3. #include "ecma_167.h"
  4. #include "osta_udf.h"
  5. #include <linux/fs.h>
  6. #include <linux/types.h>
  7. #include <linux/buffer_head.h>
  8. #include <linux/udf_fs_i.h>
  9. #include "udf_sb.h"
  10. #include "udfend.h"
  11. #define UDF_PREALLOCATE
  12. #define UDF_DEFAULT_PREALLOC_BLOCKS 8
  13. #undef UDFFS_DEBUG
  14. #ifdef UDFFS_DEBUG
  15. #define udf_debug(f, a...) \
  16. do { \
  17. printk(KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
  18. __FILE__, __LINE__, __func__); \
  19. printk(f, ##a); \
  20. } while (0)
  21. #else
  22. #define udf_debug(f, a...) /**/
  23. #endif
  24. #define udf_info(f, a...) \
  25. printk(KERN_INFO "UDF-fs INFO " f, ##a);
  26. #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
  27. #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
  28. #define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF
  29. #define UDF_EXTENT_FLAG_MASK 0xC0000000
  30. #define UDF_NAME_PAD 4
  31. #define UDF_NAME_LEN 256
  32. #define UDF_PATH_LEN 1023
  33. #define udf_file_entry_alloc_offset(inode)\
  34. (UDF_I(inode)->i_use ?\
  35. sizeof(struct unallocSpaceEntry) :\
  36. ((UDF_I(inode)->i_efe ?\
  37. sizeof(struct extendedFileEntry) :\
  38. sizeof(struct fileEntry)) + UDF_I(inode)->i_lenEAttr))
  39. #define udf_ext0_offset(inode)\
  40. (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ?\
  41. udf_file_entry_alloc_offset(inode) : 0)
  42. #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
  43. /* computes tag checksum */
  44. u8 udf_tag_checksum(const tag *t);
  45. struct dentry;
  46. struct inode;
  47. struct task_struct;
  48. struct buffer_head;
  49. struct super_block;
  50. extern const struct inode_operations udf_dir_inode_operations;
  51. extern const struct file_operations udf_dir_operations;
  52. extern const struct inode_operations udf_file_inode_operations;
  53. extern const struct file_operations udf_file_operations;
  54. extern const struct address_space_operations udf_aops;
  55. extern const struct address_space_operations udf_adinicb_aops;
  56. extern const struct address_space_operations udf_symlink_aops;
  57. struct udf_fileident_bh {
  58. struct buffer_head *sbh;
  59. struct buffer_head *ebh;
  60. int soffset;
  61. int eoffset;
  62. };
  63. struct udf_vds_record {
  64. uint32_t block;
  65. uint32_t volDescSeqNum;
  66. };
  67. struct generic_desc {
  68. tag descTag;
  69. __le32 volDescSeqNum;
  70. };
  71. struct ustr {
  72. uint8_t u_cmpID;
  73. uint8_t u_name[UDF_NAME_LEN - 2];
  74. uint8_t u_len;
  75. };
  76. struct extent_position {
  77. struct buffer_head *bh;
  78. uint32_t offset;
  79. kernel_lb_addr block;
  80. };
  81. /* super.c */
  82. extern void udf_warning(struct super_block *, const char *, const char *, ...);
  83. /* namei.c */
  84. extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
  85. struct fileIdentDesc *, struct udf_fileident_bh *,
  86. uint8_t *, uint8_t *);
  87. /* file.c */
  88. extern int udf_ioctl(struct inode *, struct file *, unsigned int,
  89. unsigned long);
  90. /* inode.c */
  91. extern struct inode *udf_iget(struct super_block *, kernel_lb_addr);
  92. extern int udf_sync_inode(struct inode *);
  93. extern void udf_expand_file_adinicb(struct inode *, int, int *);
  94. extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *);
  95. extern struct buffer_head *udf_bread(struct inode *, int, int, int *);
  96. extern void udf_truncate(struct inode *);
  97. extern void udf_read_inode(struct inode *);
  98. extern void udf_delete_inode(struct inode *);
  99. extern void udf_clear_inode(struct inode *);
  100. extern int udf_write_inode(struct inode *, int);
  101. extern long udf_block_map(struct inode *, sector_t);
  102. extern int udf_extend_file(struct inode *, struct extent_position *,
  103. kernel_long_ad *, sector_t);
  104. extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *,
  105. kernel_lb_addr *, uint32_t *, sector_t *);
  106. extern int8_t udf_add_aext(struct inode *, struct extent_position *,
  107. kernel_lb_addr, uint32_t, int);
  108. extern int8_t udf_write_aext(struct inode *, struct extent_position *,
  109. kernel_lb_addr, uint32_t, int);
  110. extern int8_t udf_delete_aext(struct inode *, struct extent_position,
  111. kernel_lb_addr, uint32_t);
  112. extern int8_t udf_next_aext(struct inode *, struct extent_position *,
  113. kernel_lb_addr *, uint32_t *, int);
  114. extern int8_t udf_current_aext(struct inode *, struct extent_position *,
  115. kernel_lb_addr *, uint32_t *, int);
  116. /* misc.c */
  117. extern struct buffer_head *udf_tgetblk(struct super_block *, int);
  118. extern struct buffer_head *udf_tread(struct super_block *, int);
  119. extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t,
  120. uint32_t, uint8_t);
  121. extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t,
  122. uint8_t);
  123. extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t,
  124. uint32_t, uint16_t *);
  125. extern struct buffer_head *udf_read_ptagged(struct super_block *,
  126. kernel_lb_addr, uint32_t,
  127. uint16_t *);
  128. extern void udf_update_tag(char *, int);
  129. extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int);
  130. /* lowlevel.c */
  131. extern unsigned int udf_get_last_session(struct super_block *);
  132. extern unsigned long udf_get_last_block(struct super_block *);
  133. /* partition.c */
  134. extern uint32_t udf_get_pblock(struct super_block *, uint32_t, uint16_t,
  135. uint32_t);
  136. extern uint32_t udf_get_pblock_virt15(struct super_block *, uint32_t, uint16_t,
  137. uint32_t);
  138. extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t,
  139. uint32_t);
  140. extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t,
  141. uint32_t);
  142. extern int udf_relocate_blocks(struct super_block *, long, long *);
  143. /* unicode.c */
  144. extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int);
  145. extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *,
  146. int);
  147. extern int udf_build_ustr(struct ustr *, dstring *, int);
  148. extern int udf_CS0toUTF8(struct ustr *, const struct ustr *);
  149. /* ialloc.c */
  150. extern void udf_free_inode(struct inode *);
  151. extern struct inode *udf_new_inode(struct inode *, int, int *);
  152. /* truncate.c */
  153. extern void udf_truncate_tail_extent(struct inode *);
  154. extern void udf_discard_prealloc(struct inode *);
  155. extern void udf_truncate_extents(struct inode *);
  156. /* balloc.c */
  157. extern void udf_free_blocks(struct super_block *, struct inode *,
  158. kernel_lb_addr, uint32_t, uint32_t);
  159. extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t,
  160. uint32_t, uint32_t);
  161. extern int udf_new_block(struct super_block *, struct inode *, uint16_t,
  162. uint32_t, int *);
  163. /* fsync.c */
  164. extern int udf_fsync_file(struct file *, struct dentry *, int);
  165. /* directory.c */
  166. extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *,
  167. struct udf_fileident_bh *,
  168. struct fileIdentDesc *,
  169. struct extent_position *,
  170. kernel_lb_addr *, uint32_t *,
  171. sector_t *);
  172. extern struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize,
  173. int *offset);
  174. extern long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int);
  175. extern short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int);
  176. /* crc.c */
  177. extern uint16_t udf_crc(const uint8_t *, uint32_t, uint16_t);
  178. /* udftime.c */
  179. extern time_t *udf_stamp_to_time(time_t *, long *, kernel_timestamp);
  180. extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *, struct timespec);
  181. #endif /* __UDF_DECL_H */