^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __UDF_DECL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __UDF_DECL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #define pr_fmt(fmt) "UDF-fs: " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include "ecma_167.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "osta_udf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/udf_fs_i.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "udf_sb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "udfend.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "udf_i.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define UDF_DEFAULT_PREALLOC_BLOCKS 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) extern __printf(3, 4) void _udf_err(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) const char *function, const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define udf_err(sb, fmt, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) _udf_err(sb, __func__, fmt, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) extern __printf(3, 4) void _udf_warn(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) const char *function, const char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define udf_warn(sb, fmt, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) _udf_warn(sb, __func__, fmt, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define udf_info(fmt, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) pr_info("INFO " fmt, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define udf_debug(fmt, ...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) pr_debug("%s:%d:%s: " fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define UDF_EXTENT_FLAG_MASK 0xC0000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define UDF_INVALID_ID ((uint32_t)-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define UDF_NAME_PAD 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define UDF_NAME_LEN 254
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define UDF_NAME_LEN_CS0 255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static inline size_t udf_file_entry_alloc_offset(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) struct udf_inode_info *iinfo = UDF_I(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) if (iinfo->i_use)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) return sizeof(struct unallocSpaceEntry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) else if (iinfo->i_efe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) return sizeof(struct extendedFileEntry) + iinfo->i_lenEAttr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) return sizeof(struct fileEntry) + iinfo->i_lenEAttr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static inline size_t udf_ext0_offset(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) return udf_file_entry_alloc_offset(inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) /* computes tag checksum */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) u8 udf_tag_checksum(const struct tag *t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) typedef uint32_t udf_pblk_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct task_struct;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct buffer_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) struct super_block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) extern const struct export_operations udf_export_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) extern const struct inode_operations udf_dir_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) extern const struct file_operations udf_dir_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) extern const struct inode_operations udf_file_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) extern const struct file_operations udf_file_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) extern const struct inode_operations udf_symlink_inode_operations;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) extern const struct address_space_operations udf_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) extern const struct address_space_operations udf_adinicb_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) extern const struct address_space_operations udf_symlink_aops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct udf_fileident_bh {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct buffer_head *sbh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct buffer_head *ebh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) int soffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) int eoffset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct udf_vds_record {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) uint32_t block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) uint32_t volDescSeqNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct generic_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct tag descTag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __le32 volDescSeqNum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* super.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) static inline void udf_updated_lvid(struct super_block *sb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct buffer_head *bh = UDF_SB(sb)->s_lvid_bh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) BUG_ON(!bh);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) WARN_ON_ONCE(((struct logicalVolIntegrityDesc *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) bh->b_data)->integrityType !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) UDF_SB(sb)->s_lvid_dirty = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) extern u64 lvid_get_unique_id(struct super_block *sb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct inode *udf_find_metadata_inode_efe(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) u32 meta_file_loc, u32 partition_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /* namei.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) struct fileIdentDesc *, struct udf_fileident_bh *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) uint8_t *, uint8_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) static inline unsigned int udf_dir_entry_len(struct fileIdentDesc *cfi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) return ALIGN(sizeof(struct fileIdentDesc) +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) le16_to_cpu(cfi->lengthOfImpUse) + cfi->lengthFileIdent,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) UDF_NAME_PAD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) /* file.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern long udf_ioctl(struct file *, unsigned int, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) /* inode.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) extern struct inode *__udf_iget(struct super_block *, struct kernel_lb_addr *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) bool hidden_inode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) static inline struct inode *udf_iget_special(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct kernel_lb_addr *ino)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) return __udf_iget(sb, ino, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) static inline struct inode *udf_iget(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) struct kernel_lb_addr *ino)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return __udf_iget(sb, ino, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) extern int udf_expand_file_adinicb(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) extern struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) udf_pblk_t *block, int *err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) int create, int *err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) extern int udf_setsize(struct inode *, loff_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) extern void udf_evict_inode(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) extern int udf_write_inode(struct inode *, struct writeback_control *wbc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) extern udf_pblk_t udf_block_map(struct inode *inode, sector_t block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct kernel_lb_addr *, uint32_t *, sector_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) extern int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) struct extent_position *epos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) extern int __udf_add_aext(struct inode *inode, struct extent_position *epos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct kernel_lb_addr *eloc, uint32_t elen, int inc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) extern int udf_add_aext(struct inode *, struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct kernel_lb_addr *, uint32_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) extern void udf_write_aext(struct inode *, struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct kernel_lb_addr *, uint32_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) extern int8_t udf_delete_aext(struct inode *, struct extent_position);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) extern int8_t udf_next_aext(struct inode *, struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct kernel_lb_addr *, uint32_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) extern int8_t udf_current_aext(struct inode *, struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct kernel_lb_addr *, uint32_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) extern void udf_update_extra_perms(struct inode *inode, umode_t mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /* misc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) extern struct buffer_head *udf_tgetblk(struct super_block *sb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) udf_pblk_t block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) extern struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) uint32_t, uint8_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) uint8_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) uint32_t, uint16_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) extern struct buffer_head *udf_read_ptagged(struct super_block *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct kernel_lb_addr *, uint32_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) uint16_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) extern void udf_update_tag(char *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /* lowlevel.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) extern unsigned int udf_get_last_session(struct super_block *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) extern unsigned long udf_get_last_block(struct super_block *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /* partition.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) extern uint32_t udf_get_pblock(struct super_block *, uint32_t, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) extern uint32_t udf_get_pblock_virt15(struct super_block *, uint32_t, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) extern uint32_t udf_get_pblock_meta25(struct super_block *, uint32_t, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) extern int udf_relocate_blocks(struct super_block *, long, long *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static inline uint32_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) udf_get_lb_pblock(struct super_block *sb, struct kernel_lb_addr *loc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) uint32_t offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) return udf_get_pblock(sb, loc->logicalBlockNum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) loc->partitionReferenceNum, offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /* unicode.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) extern int udf_get_filename(struct super_block *, const uint8_t *, int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) uint8_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) extern int udf_put_filename(struct super_block *, const uint8_t *, int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) uint8_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) extern int udf_dstrCS0toChar(struct super_block *, uint8_t *, int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) const uint8_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /* ialloc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) extern void udf_free_inode(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) extern struct inode *udf_new_inode(struct inode *, umode_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* truncate.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) extern void udf_truncate_tail_extent(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) extern void udf_discard_prealloc(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) extern int udf_truncate_extents(struct inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /* balloc.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) extern void udf_free_blocks(struct super_block *, struct inode *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct kernel_lb_addr *, uint32_t, uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) uint32_t, uint32_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) extern udf_pblk_t udf_new_block(struct super_block *sb, struct inode *inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) uint16_t partition, uint32_t goal, int *err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) /* directory.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) struct udf_fileident_bh *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) struct fileIdentDesc *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct extent_position *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct kernel_lb_addr *, uint32_t *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) sector_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) extern struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) int *offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) extern struct long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) extern struct short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /* udftime.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) extern void udf_disk_stamp_to_time(struct timespec64 *dest,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) struct timestamp src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) extern void udf_time_to_disk_stamp(struct timestamp *dest, struct timespec64 src);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) #endif /* __UDF_DECL_H */