1 #ifndef __UDF_DECL_H 2 #define __UDF_DECL_H 3 4 #include <linux/udf_fs.h> 5 #include "ecma_167.h" 6 #include "osta_udf.h" 7 8 #include <linux/fs.h> 9 #include <linux/config.h> 10 #include <linux/types.h> 11 12 #ifndef LINUX_VERSION_CODE 13 #include <linux/version.h> 14 #endif 15 16 #if !defined(CONFIG_UDF_FS) && !defined(CONFIG_UDF_FS_MODULE) 17 #define CONFIG_UDF_FS_MODULE 18 #include <linux/udf_fs_i.h> 19 #include <linux/udf_fs_sb.h> 20 #endif 21 22 #include "udfend.h" 23 24 #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) 25 #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) 26 27 #define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF 28 #define UDF_EXTENT_FLAG_MASK 0xC0000000 29 30 #define UDF_NAME_PAD 4 31 #define UDF_NAME_LEN 255 32 #define UDF_PATH_LEN 1023 33 34 #define CURRENT_UTIME (xtime.tv_usec) 35 36 #define udf_file_entry_alloc_offset(inode)\ 37 ((UDF_I_EXTENDED_FE(inode) ?\ 38 sizeof(struct extendedFileEntry) :\ 39 sizeof(struct fileEntry)) + UDF_I_LENEATTR(inode)) 40 41 #define udf_ext0_offset(inode)\ 42 (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB ?\ 43 udf_file_entry_alloc_offset(inode) : 0) 44 45 #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset)) 46 47 struct dentry; 48 struct inode; 49 struct task_struct; 50 struct buffer_head; 51 struct super_block; 52 53 extern struct inode_operations udf_dir_inode_operations; 54 extern struct file_operations udf_dir_operations; 55 extern struct inode_operations udf_file_inode_operations; 56 extern struct file_operations udf_file_operations; 57 extern struct address_space_operations udf_aops; 58 extern struct address_space_operations udf_adinicb_aops; 59 extern struct address_space_operations udf_symlink_aops; 60 61 struct udf_fileident_bh 62 { 63 struct buffer_head *sbh; 64 struct buffer_head *ebh; 65 int soffset; 66 int eoffset; 67 }; 68 69 struct udf_directory_record 70 { 71 uint32_t d_parent; 72 uint32_t d_inode; 73 uint32_t d_name[255]; 74 }; 75 76 struct udf_vds_record 77 { 78 uint32_t block; 79 uint32_t volDescSeqNum; 80 }; 81 82 struct generic_desc 83 { 84 tag descTag; 85 uint32_t volDescSeqNum; 86 }; 87 88 struct ustr 89 { 90 uint8_t u_cmpID; 91 uint8_t u_name[UDF_NAME_LEN]; 92 uint8_t u_len; 93 }; 94 95 /* super.c */ 96 extern void udf_error(struct super_block *, const char *, const char *, ...); 97 extern void udf_warning(struct super_block *, const char *, const char *, ...); 98 99 /* namei.c */ 100 extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, struct fileIdentDesc *, struct udf_fileident_bh *, uint8_t *, uint8_t *); 101 102 /* file.c */ 103 extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 104 105 /* inode.c */ 106 extern struct inode *udf_iget(struct super_block *, lb_addr); 107 extern int udf_sync_inode(struct inode *); 108 extern void udf_expand_file_adinicb(struct inode *, int, int *); 109 extern struct buffer_head * udf_expand_dir_adinicb(struct inode *, int *, int *); 110 extern struct buffer_head * udf_getblk(struct inode *, long, int, int *); 111 extern struct buffer_head * udf_bread(struct inode *, int, int, int *); 112 extern void udf_truncate(struct inode *); 113 extern void udf_read_inode(struct inode *); 114 extern void udf_put_inode(struct inode *); 115 extern void udf_delete_inode(struct inode *); 116 extern void udf_write_inode(struct inode *, int); 117 extern long udf_block_map(struct inode *, long); 118 extern int8_t inode_bmap(struct inode *, int, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); 119 extern int8_t udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, uint32_t, struct buffer_head **, int); 120 extern int8_t udf_write_aext(struct inode *, lb_addr, int *, lb_addr, uint32_t, struct buffer_head *, int); 121 extern int8_t udf_insert_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *); 122 extern int8_t udf_delete_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *); 123 extern int8_t udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int); 124 extern int8_t udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int); 125 extern void udf_discard_prealloc(struct inode *); 126 127 /* misc.c */ 128 extern int udf_read_tagged_data(char *, int size, int fd, int block, int partref); 129 extern struct buffer_head *udf_tgetblk(struct super_block *, int); 130 extern struct buffer_head *udf_tread(struct super_block *, int); 131 extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint32_t, uint8_t, struct buffer_head **); 132 extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t, struct buffer_head **); 133 extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *); 134 extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, uint32_t, uint16_t *); 135 extern void udf_release_data(struct buffer_head *); 136 137 /* lowlevel.c */ 138 extern unsigned int udf_get_last_session(struct super_block *); 139 extern unsigned long udf_get_last_block(struct super_block *); 140 141 /* partition.c */ 142 extern uint32_t udf_get_pblock(struct super_block *, uint32_t, uint16_t, uint32_t); 143 extern uint32_t udf_get_pblock_virt15(struct super_block *, uint32_t, uint16_t, uint32_t); 144 extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t, uint32_t); 145 extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t, uint32_t); 146 extern int udf_relocate_blocks(struct super_block *, long, long *); 147 148 /* unicode.c */ 149 extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int); 150 151 /* ialloc.c */ 152 extern void udf_free_inode(struct inode *); 153 extern struct inode * udf_new_inode (struct inode *, int, int *); 154 155 /* truncate.c */ 156 extern void udf_truncate_extents(struct inode *); 157 158 /* balloc.c */ 159 extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, uint32_t, uint32_t); 160 extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, uint32_t, uint32_t); 161 extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_t, int *); 162 163 /* fsync.c */ 164 extern int udf_fsync_file(struct file *, struct dentry *, int); 165 extern int udf_fsync_inode(struct inode *, int); 166 167 /* directory.c */ 168 extern uint8_t * udf_filead_read(struct inode *, uint8_t *, uint8_t, lb_addr, int *, int *, struct buffer_head **, int *); 169 extern struct fileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct fileIdentDesc *, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **); 170 171 /* unicode.c */ 172 extern int udf_ustr_to_dchars(uint8_t *, const struct ustr *, int); 173 extern int udf_ustr_to_char(uint8_t *, const struct ustr *, int); 174 extern int udf_ustr_to_dstring(dstring *, const struct ustr *, int); 175 extern int udf_dchars_to_ustr(struct ustr *, const uint8_t *, int); 176 extern int udf_char_to_ustr(struct ustr *, const uint8_t *, int); 177 extern int udf_dstring_to_ustr(struct ustr *, const dstring *, int); 178 extern int udf_translate_to_linux(uint8_t *, uint8_t *, int, uint8_t *, int); 179 extern int udf_build_ustr(struct ustr *, dstring *, int); 180 extern int udf_build_ustr_exact(struct ustr *, dstring *, int); 181 extern int udf_CS0toUTF8(struct ustr *, struct ustr *); 182 extern int udf_UTF8toCS0(dstring *, struct ustr *, int); 183 extern int udf_CS0toNLS(struct nls_table *, struct ustr *, struct ustr *); 184 extern int udf_NLStoCS0(struct nls_table *, dstring *, struct ustr *, int); 185 186 /* crc.c */ 187 extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t); 188 189 /* misc.c */ 190 extern uint32_t udf64_low32(uint64_t); 191 extern uint32_t udf64_high32(uint64_t); 192 extern void udf_update_tag(char *, int); 193 extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int); 194 195 /* udftime.c */ 196 extern time_t *udf_stamp_to_time(time_t *, long *, timestamp); 197 extern timestamp *udf_time_to_stamp(timestamp *, time_t, long); 198 199 /* directory.c */ 200 extern struct fileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset); 201 extern extent_ad * udf_get_fileextent(void * buffer, int bufsize, int * offset); 202 extern long_ad * udf_get_filelongad(void * buffer, int bufsize, int * offset, int); 203 extern short_ad * udf_get_fileshortad(void * buffer, int bufsize, int * offset, int); 204 extern uint8_t * udf_get_filead(struct fileEntry *, uint8_t *, int, int, int, int *); 205 206 #endif /* __UDF_DECL_H */ 207