udfdecl.h 6.8 KB

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