#include <linux/string.h>
#include <linux/crc-itu-t.h>
struct buffer_head *udf_tgetblk(struct super_block *sb, udf_pblk_t block)
if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
return sb_getblk(sb, udf_fixed_to_variable(block));
return sb_getblk(sb, block);
struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block)
if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
return sb_bread(sb, udf_fixed_to_variable(block));
return sb_bread(sb, block);
struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
uint32_t type, uint8_t loc)
uint8_t *ea = NULL, *ad = NULL;
struct udf_inode_info *iinfo = UDF_I(inode);
ea = iinfo->i_ext.i_data;
ad = iinfo->i_ext.i_data + iinfo->i_lenEAttr;
size += sizeof(struct extendedAttrHeaderDesc);
offset = inode->i_sb->s_blocksize - udf_file_entry_alloc_offset(inode) -
if (loc & 0x01 && offset >= size) {
struct extendedAttrHeaderDesc *eahd;
eahd = (struct extendedAttrHeaderDesc *)ea;
memmove(&ad[size], ad, iinfo->i_lenAlloc);
if (eahd->descTag.tagIdent !=
cpu_to_le16(TAG_IDENT_EAHD) ||
le32_to_cpu(eahd->descTag.tagLocation) !=
iinfo->i_location.logicalBlockNum)
struct udf_sb_info *sbi = UDF_SB(inode->i_sb);
size -= sizeof(struct extendedAttrHeaderDesc);
sizeof(struct extendedAttrHeaderDesc);
eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD);
if (sbi->s_udfrev >= 0x0200)
eahd->descTag.descVersion = cpu_to_le16(3);
eahd->descTag.descVersion = cpu_to_le16(2);