Commit 58a618cf authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] udf endianness annotations

That one was slightly messier than ext2 - several data structures had
been used both in little-endian (on-disk) and host-endian (in-core)
situations.  They had to be split, the rest was trivial annotations. 

Gets UDF sparse-clean with -Wbitwise.  Note that here we just annotate -
bug fixes from the original version of that patch had already been
merged.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 380768f5
......@@ -44,7 +44,7 @@
#define xleNUM_to_cpup(x,y) (le ## x ## _to_cpup(y))
#define uintBPL_t uint(BITS_PER_LONG)
#define uint(x) xuint(x)
#define xuint(x) uint ## x ## _t
#define xuint(x) __le ## x
extern inline int find_next_one_bit (void * addr, int size, int offset)
{
......@@ -91,7 +91,7 @@ static int read_block_bitmap(struct super_block * sb,
{
struct buffer_head *bh = NULL;
int retval = 0;
lb_addr loc;
kernel_lb_addr loc;
loc.logicalBlockNum = bitmap->s_extPosition;
loc.partitionReferenceNum = UDF_SB_PARTITION(sb);
......@@ -145,7 +145,8 @@ static inline int load_block_bitmap(struct super_block * sb,
static void udf_bitmap_free_blocks(struct super_block * sb,
struct inode * inode,
struct udf_bitmap *bitmap, lb_addr bloc, uint32_t offset, uint32_t count)
struct udf_bitmap *bitmap,
kernel_lb_addr bloc, uint32_t offset, uint32_t count)
{
struct buffer_head * bh = NULL;
unsigned long block;
......@@ -424,11 +425,12 @@ static int udf_bitmap_new_block(struct super_block * sb,
static void udf_table_free_blocks(struct super_block * sb,
struct inode * inode,
struct inode * table, lb_addr bloc, uint32_t offset, uint32_t count)
struct inode * table,
kernel_lb_addr bloc, uint32_t offset, uint32_t count)
{
uint32_t start, end;
uint32_t nextoffset, oextoffset, elen;
lb_addr nbloc, obloc, eloc;
kernel_lb_addr nbloc, obloc, eloc;
struct buffer_head *obh, *nbh;
int8_t etype;
int i;
......@@ -678,7 +680,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
{
int alloc_count = 0;
uint32_t extoffset, elen, adsize;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
struct buffer_head *bh;
int8_t etype = -1;
......@@ -748,7 +750,7 @@ static int udf_table_new_block(struct super_block * sb,
uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
uint32_t newblock = 0, adsize;
uint32_t extoffset, goal_extoffset, elen, goal_elen = 0;
lb_addr bloc, goal_bloc, eloc, goal_eloc;
kernel_lb_addr bloc, goal_bloc, eloc, goal_eloc;
struct buffer_head *bh, *goal_bh;
int8_t etype;
......@@ -854,7 +856,7 @@ static int udf_table_new_block(struct super_block * sb,
inline void udf_free_blocks(struct super_block * sb,
struct inode * inode,
lb_addr bloc, uint32_t offset, uint32_t count)
kernel_lb_addr bloc, uint32_t offset, uint32_t count)
{
uint16_t partition = bloc.partitionReferenceNum;
......
......@@ -117,7 +117,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
uint8_t lfi;
loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
struct buffer_head * bh = NULL, * tmp, * bha[16];
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t extoffset, elen, offset;
int i, num;
unsigned int dt_type;
......@@ -237,7 +237,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
}
else
{
lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);
kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);
iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0);
flen = udf_get_filename(dir->i_sb, nameptr, fname, lfi);
......
......@@ -26,7 +26,7 @@
#if 0
static uint8_t *
udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
lb_addr fe_loc, int *pos, int *offset,
kernel_lb_addr fe_loc, int *pos, int *offset,
struct buffer_head **bh, int *error)
{
int loffset = *offset;
......@@ -80,8 +80,8 @@ struct fileIdentDesc *
udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct udf_fileident_bh *fibh,
struct fileIdentDesc *cfi,
lb_addr *bloc, uint32_t *extoffset,
lb_addr *eloc, uint32_t *elen,
kernel_lb_addr *bloc, uint32_t *extoffset,
kernel_lb_addr *eloc, uint32_t *elen,
uint32_t *offset, struct buffer_head **bh)
{
struct fileIdentDesc *fi;
......
This diff is collapsed.
This diff is collapsed.
......@@ -273,7 +273,7 @@ udf_read_tagged(struct super_block *sb, uint32_t block, uint32_t location, uint1
}
struct buffer_head *
udf_read_ptagged(struct super_block *sb, lb_addr loc, uint32_t offset, uint16_t *ident)
udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc, uint32_t offset, uint16_t *ident)
{
return udf_read_tagged(sb, udf_get_lb_pblock(sb, loc, offset),
loc.logicalBlockNum + offset, ident);
......@@ -293,8 +293,8 @@ void udf_update_tag(char *data, int length)
length -= sizeof(tag);
tptr->tagChecksum = 0;
tptr->descCRCLength = le16_to_cpu(length);
tptr->descCRC = le16_to_cpu(udf_crc(data + sizeof(tag), length, 0));
tptr->descCRCLength = cpu_to_le16(length);
tptr->descCRC = cpu_to_le16(udf_crc(data + sizeof(tag), length, 0));
for (i=0; i<16; i++)
if (i != 4)
......@@ -305,9 +305,9 @@ void udf_new_tag(char *data, uint16_t ident, uint16_t version, uint16_t snum,
uint32_t loc, int length)
{
tag *tptr = (tag *)data;
tptr->tagIdent = le16_to_cpu(ident);
tptr->descVersion = le16_to_cpu(version);
tptr->tagSerialNum = le16_to_cpu(snum);
tptr->tagLocation = le32_to_cpu(loc);
tptr->tagIdent = cpu_to_le16(ident);
tptr->descVersion = cpu_to_le16(version);
tptr->tagSerialNum = cpu_to_le16(snum);
tptr->tagLocation = cpu_to_le32(loc);
udf_update_tag(data, length);
}
......@@ -160,7 +160,7 @@ udf_find_entry(struct inode *dir, struct dentry *dentry,
uint8_t lfi;
uint16_t liu;
loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t extoffset, elen, offset;
struct buffer_head *bh = NULL;
......@@ -314,7 +314,7 @@ udf_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
/* temporary shorthand for specifying files by inode number */
if (!strncmp(dentry->d_name.name, ".B=", 3) )
{
lb_addr lb = { 0, simple_strtoul(dentry->d_name.name+3, NULL, 0) };
kernel_lb_addr lb = { 0, simple_strtoul(dentry->d_name.name+3, NULL, 0) };
inode = udf_iget(dir->i_sb, lb);
if (!inode)
{
......@@ -360,7 +360,7 @@ udf_add_entry(struct inode *dir, struct dentry *dentry,
uint8_t lfi;
uint16_t liu;
int block;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t extoffset, elen, offset;
struct buffer_head *bh = NULL;
......@@ -655,7 +655,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, struct
}
cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
......@@ -698,7 +698,7 @@ static int udf_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t
}
cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
......@@ -746,7 +746,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
inode->i_nlink = 2;
cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(dir));
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(UDF_I_UNIQUE(dir) & 0x00000000FFFFFFFFUL);
cfi.fileCharacteristics = FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
......@@ -765,7 +765,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
}
cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
......@@ -788,7 +788,7 @@ static int empty_dir(struct inode *dir)
loff_t f_pos;
loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
int block;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t extoffset, elen, offset;
struct buffer_head *bh = NULL;
......@@ -861,7 +861,7 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
struct inode * inode = dentry->d_inode;
struct udf_fileident_bh fibh;
struct fileIdentDesc *fi, cfi;
lb_addr tloc;
kernel_lb_addr tloc;
retval = -ENOENT;
lock_kernel();
......@@ -906,7 +906,7 @@ static int udf_unlink(struct inode * dir, struct dentry * dentry)
struct udf_fileident_bh fibh;
struct fileIdentDesc *fi;
struct fileIdentDesc cfi;
lb_addr tloc;
kernel_lb_addr tloc;
retval = -ENOENT;
lock_kernel();
......@@ -971,7 +971,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
if (UDF_I_ALLOCTYPE(inode) != ICBTAG_FLAG_AD_IN_ICB)
{
struct buffer_head *bh = NULL;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t elen, extoffset;
block = udf_new_block(inode->i_sb, inode,
......@@ -1085,7 +1085,7 @@ static int udf_symlink(struct inode * dir, struct dentry * dentry, const char *
uint64_t uniqueID;
lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
uniqueID = le64_to_cpu(lvhd->uniqueID);
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
if (!(++uniqueID & 0x00000000FFFFFFFFUL))
uniqueID += 16;
......@@ -1142,7 +1142,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
uint64_t uniqueID;
lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
uniqueID = le64_to_cpu(lvhd->uniqueID);
*(uint32_t *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
*(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
cpu_to_le32(uniqueID & 0x00000000FFFFFFFFUL);
if (!(++uniqueID & 0x00000000FFFFFFFFUL))
uniqueID += 16;
......@@ -1178,7 +1178,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
struct fileIdentDesc *ofi = NULL, *nfi = NULL, *dir_fi = NULL, ocfi, ncfi;
struct buffer_head *dir_bh = NULL;
int retval = -ENOENT;
lb_addr tloc;
kernel_lb_addr tloc;
lock_kernel();
if ((ofi = udf_find_entry(old_dir, old_dentry, &ofibh, &ocfi)))
......@@ -1231,7 +1231,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
}
if (!dir_fi)
goto end_rename;
tloc = cpu_to_lelb(dir_fi->icb.extLocation);
tloc = lelb_to_cpu(dir_fi->icb.extLocation);
if (udf_get_lb_pblock(old_inode->i_sb, tloc, 0)
!= old_dir->i_ino)
goto end_rename;
......@@ -1277,9 +1277,9 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
if (dir_fi)
{
dir_fi->icb.extLocation = lelb_to_cpu(UDF_I_LOCATION(new_dir));
dir_fi->icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(new_dir));
udf_update_tag((char *)dir_fi, (sizeof(struct fileIdentDesc) +
cpu_to_le16(dir_fi->lengthOfImpUse) + 3) & ~3);
le16_to_cpu(dir_fi->lengthOfImpUse) + 3) & ~3);
if (UDF_I_ALLOCTYPE(old_inode) == ICBTAG_FLAG_AD_IN_ICB)
{
mark_inode_dirty(old_inode);
......
......@@ -67,7 +67,7 @@
struct UDFIdentSuffix
{
uint16_t UDFRevision;
__le16 UDFRevision;
uint8_t OSClass;
uint8_t OSIdentifier;
uint8_t reserved[4];
......@@ -90,11 +90,11 @@ struct appIdentSuffix
struct logicalVolIntegrityDescImpUse
{
regid impIdent;
uint32_t numFiles;
uint32_t numDirs;
uint16_t minUDFReadRev;
uint16_t minUDFWriteRev;
uint16_t maxUDFWriteRev;
__le32 numFiles;
__le32 numDirs;
__le16 minUDFReadRev;
__le16 minUDFWriteRev;
__le16 maxUDFWriteRev;
uint8_t impUse[0];
} __attribute__ ((packed));
......@@ -117,8 +117,8 @@ struct udfPartitionMap2
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
__le16 volSeqNum;
__le16 partitionNum;
} __attribute__ ((packed));
/* Virtual Partition Map (UDF 2.50 2.2.8) */
......@@ -128,8 +128,8 @@ struct virtualPartitionMap
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
__le16 volSeqNum;
__le16 partitionNum;
uint8_t reserved2[24];
} __attribute__ ((packed));
......@@ -140,13 +140,13 @@ struct sparablePartitionMap
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
uint16_t packetLength;
__le16 volSeqNum;
__le16 partitionNum;
__le16 packetLength;
uint8_t numSparingTables;
uint8_t reserved2[1];
uint32_t sizeSparingTable;
uint32_t locSparingTable[4];
__le32 sizeSparingTable;
__le32 locSparingTable[4];
} __attribute__ ((packed));
/* Metadata Partition Map (UDF 2.4.0 2.2.10) */
......@@ -156,13 +156,13 @@ struct metadataPartitionMap
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
uint32_t metadataFileLoc;
uint32_t metadataMirrorFileLoc;
uint32_t metadataBitmapFileLoc;
uint32_t allocUnitSize;
uint16_t alignUnitSize;
__le16 volSeqNum;
__le16 partitionNum;
__le32 metadataFileLoc;
__le32 metadataMirrorFileLoc;
__le32 metadataBitmapFileLoc;
__le32 allocUnitSize;
__le16 alignUnitSize;
uint8_t flags;
uint8_t reserved2[5];
} __attribute__ ((packed));
......@@ -170,9 +170,9 @@ struct metadataPartitionMap
/* Virtual Allocation Table (UDF 1.5 2.2.10) */
struct virtualAllocationTable15
{
uint32_t VirtualSector[0];
__le32 VirtualSector[0];
regid vatIdent;
uint32_t previousVATICBLoc;
__le32 previousVATICBLoc;
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT15 0x00U
......@@ -180,18 +180,18 @@ struct virtualAllocationTable15
/* Virtual Allocation Table (UDF 2.50 2.2.11) */
struct virtualAllocationTable20
{
uint16_t lengthHeader;
uint16_t lengthImpUse;
__le16 lengthHeader;
__le16 lengthImpUse;
dstring logicalVolIdent[128];
uint32_t previousVATICBLoc;
uint32_t numFiles;
uint32_t numDirs;
uint16_t minReadRevision;
uint16_t minWriteRevision;
uint16_t maxWriteRevision;
uint16_t reserved;
__le32 previousVATICBLoc;
__le32 numFiles;
__le32 numDirs;
__le16 minReadRevision;
__le16 minWriteRevision;
__le16 maxWriteRevision;
__le16 reserved;
uint8_t impUse[0];
uint32_t vatEntry[0];
__le32 vatEntry[0];
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT20 0xF8U
......@@ -199,17 +199,17 @@ struct virtualAllocationTable20
/* Sparing Table (UDF 2.50 2.2.12) */
struct sparingEntry
{
uint32_t origLocation;
uint32_t mappedLocation;
__le32 origLocation;
__le32 mappedLocation;
} __attribute__ ((packed));
struct sparingTable
{
tag descTag;
regid sparingIdent;
uint16_t reallocationTableLen;
uint16_t reserved;
uint32_t sequenceNum;
__le16 reallocationTableLen;
__le16 reserved;
__le32 sequenceNum;
struct sparingEntry
mapEntry[0];
} __attribute__ ((packed));
......@@ -222,7 +222,7 @@ struct sparingTable
/* struct long_ad ICB - ADImpUse (UDF 2.50 2.2.4.3) */
struct allocDescImpUse
{
uint16_t flags;
__le16 flags;
uint8_t impUse[4];
} __attribute__ ((packed));
......@@ -235,14 +235,14 @@ struct allocDescImpUse
/* FreeEASpace (UDF 2.50 3.3.4.5.1.1) */
struct freeEaSpace
{
uint16_t headerChecksum;
__le16 headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
/* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */
struct DVDCopyrightImpUse
{
uint16_t headerChecksum;
__le16 headerChecksum;
uint8_t CGMSInfo;
uint8_t dataType;
uint8_t protectionSystemInfo[4];
......@@ -252,7 +252,7 @@ struct DVDCopyrightImpUse
/* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */
struct freeAppEASpace
{
uint16_t headerChecksum;
__le16 headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
......
......@@ -84,7 +84,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t
return 0xFFFFFFFF;
}
loc = le32_to_cpu(((uint32_t *)bh->b_data)[index]);
loc = le32_to_cpu(((__le32 *)bh->b_data)[index]);
udf_release_data(bh);
......
......@@ -85,13 +85,13 @@ static void udf_write_super(struct super_block *);
static int udf_remount_fs(struct super_block *, int *, char *);
static int udf_check_valid(struct super_block *, int, int);
static int udf_vrs(struct super_block *sb, int silent);
static int udf_load_partition(struct super_block *, lb_addr *);
static int udf_load_logicalvol(struct super_block *, struct buffer_head *, lb_addr *);
static void udf_load_logicalvolint(struct super_block *, extent_ad);
static int udf_load_partition(struct super_block *, kernel_lb_addr *);
static int udf_load_logicalvol(struct super_block *, struct buffer_head *, kernel_lb_addr *);
static void udf_load_logicalvolint(struct super_block *, kernel_extent_ad);
static void udf_find_anchor(struct super_block *);
static int udf_find_fileset(struct super_block *, lb_addr *, lb_addr *);
static int udf_find_fileset(struct super_block *, kernel_lb_addr *, kernel_lb_addr *);
static void udf_load_pvoldesc(struct super_block *, struct buffer_head *);
static void udf_load_fileset(struct super_block *, struct buffer_head *, lb_addr *);
static void udf_load_fileset(struct super_block *, struct buffer_head *, kernel_lb_addr *);
static void udf_load_partdesc(struct super_block *, struct buffer_head *);
static void udf_open_lvid(struct super_block *);
static void udf_close_lvid(struct super_block *);
......@@ -769,7 +769,7 @@ udf_find_anchor(struct super_block *sb)
}
static int
udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr *root)
{
struct buffer_head *bh = NULL;
long lastblock;
......@@ -792,7 +792,7 @@ udf_find_fileset(struct super_block *sb, lb_addr *fileset, lb_addr *root)
if (!bh) /* Search backwards through the partitions */
{
lb_addr newfileset;
kernel_lb_addr newfileset;
return 1;
......@@ -874,7 +874,7 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
if ( udf_stamp_to_time(&recording, &recording_usec,
lets_to_cpu(pvoldesc->recordingDateAndTime)) )
{
timestamp ts;
kernel_timestamp ts;
ts = lets_to_cpu(pvoldesc->recordingDateAndTime);
udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n",
recording, recording_usec,
......@@ -901,7 +901,7 @@ udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
}
static void
udf_load_fileset(struct super_block *sb, struct buffer_head *bh, lb_addr *root)
udf_load_fileset(struct super_block *sb, struct buffer_head *bh, kernel_lb_addr *root)
{
struct fileSetDesc *fset;
......@@ -948,7 +948,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
phd = (struct partitionHeaderDesc *)(p->partitionContentsUse);
if (phd->unallocSpaceTable.extLength)
{
lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i };
kernel_lb_addr loc = { le32_to_cpu(phd->unallocSpaceTable.extPosition), i };
UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
udf_iget(sb, loc);
......@@ -974,7 +974,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
udf_debug("partitionIntegrityTable (part %d)\n", i);
if (phd->freedSpaceTable.extLength)
{
lb_addr loc = { le32_to_cpu(phd->freedSpaceTable.extPosition), i };
kernel_lb_addr loc = { le32_to_cpu(phd->freedSpaceTable.extPosition), i };
UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table =
udf_iget(sb, loc);
......@@ -1013,7 +1013,7 @@ udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
}
static int
udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fileset)
udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, kernel_lb_addr *fileset)
{
struct logicalVolDesc *lvd;
int i, j, offset;
......@@ -1041,12 +1041,12 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi
struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]);
if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL)))
{
if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0150)
if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150)
{
UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP15;
UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt15;
}
else if (le16_to_cpu(((uint16_t *)upm2->partIdent.identSuffix)[0]) == 0x0200)
else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200)
{
UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP20;
UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt20;
......@@ -1110,7 +1110,7 @@ udf_load_logicalvol(struct super_block *sb, struct buffer_head * bh, lb_addr *fi
*
*/
static void
udf_load_logicalvolint(struct super_block *sb, extent_ad loc)
udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
{
struct buffer_head *bh = NULL;
uint16_t ident;
......@@ -1150,7 +1150,7 @@ udf_load_logicalvolint(struct super_block *sb, extent_ad loc)
* Written, tested, and released.
*/
static int
udf_process_sequence(struct super_block *sb, long block, long lastblock, lb_addr *fileset)
udf_process_sequence(struct super_block *sb, long block, long lastblock, kernel_lb_addr *fileset)
{
struct buffer_head *bh = NULL;
struct udf_vds_record vds[VDS_POS_LENGTH];
......@@ -1293,7 +1293,7 @@ udf_check_valid(struct super_block *sb, int novrs, int silent)
}
static int
udf_load_partition(struct super_block *sb, lb_addr *fileset)
udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
{
struct anchorVolDescPtr *anchor;
uint16_t ident;
......@@ -1350,7 +1350,7 @@ udf_load_partition(struct super_block *sb, lb_addr *fileset)
case UDF_VIRTUAL_MAP15:
case UDF_VIRTUAL_MAP20:
{
lb_addr ino;
kernel_lb_addr ino;
if (!UDF_SB_LASTBLOCK(sb))
{
......@@ -1415,7 +1415,7 @@ static void udf_open_lvid(struct super_block *sb)
if (UDF_SB_LVIDBH(sb))
{
int i;
timestamp cpu_time;
kernel_timestamp cpu_time;
UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
......@@ -1443,7 +1443,7 @@ static void udf_close_lvid(struct super_block *sb)
UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN)
{
int i;
timestamp cpu_time;
kernel_timestamp cpu_time;
UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
......@@ -1492,7 +1492,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
int i;
struct inode *inode=NULL;
struct udf_options uopt;
lb_addr rootdir, fileset;
kernel_lb_addr rootdir, fileset;
struct udf_sb_info *sbi;
uopt.flags = (1 << UDF_FLAG_USE_AD_IN_ICB) | (1 << UDF_FLAG_STRICT);
......@@ -1616,7 +1616,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
if (!silent)
{
timestamp ts;
kernel_timestamp ts;
udf_time_to_stamp(&ts, UDF_SB_RECORDTIME(sb));
udf_info("UDF %s (%s) Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n",
UDFFS_VERSION, UDFFS_DATE,
......@@ -1799,7 +1799,7 @@ udf_count_free_bitmap(struct super_block *sb, struct udf_bitmap *bitmap)
unsigned int accum = 0;
int index;
int block = 0, newblock;
lb_addr loc;
kernel_lb_addr loc;
uint32_t bytes;
uint8_t value;
uint8_t *ptr;
......@@ -1866,7 +1866,7 @@ udf_count_free_table(struct super_block *sb, struct inode * table)
{
unsigned int accum = 0;
uint32_t extoffset, elen;
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
int8_t etype;
struct buffer_head *bh = NULL;
......
......@@ -33,10 +33,10 @@
#include "udf_i.h"
#include "udf_sb.h"
static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
lb_addr eloc, int8_t etype, uint32_t elen, struct buffer_head *bh, uint32_t nelen)
static void extent_trunc(struct inode * inode, kernel_lb_addr bloc, int extoffset,
kernel_lb_addr eloc, int8_t etype, uint32_t elen, struct buffer_head *bh, uint32_t nelen)
{
lb_addr neloc = { 0, 0 };
kernel_lb_addr neloc = { 0, 0 };
int last_block = (elen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
int first_block = (nelen + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits;
......@@ -68,7 +68,7 @@ static void extent_trunc(struct inode * inode, lb_addr bloc, int extoffset,
void udf_discard_prealloc(struct inode * inode)
{
lb_addr bloc, eloc;
kernel_lb_addr bloc, eloc;
uint32_t extoffset = 0, elen, nelen;
uint64_t lbcount = 0;
int8_t etype = -1, netype;
......@@ -129,7 +129,7 @@ void udf_discard_prealloc(struct inode * inode)
void udf_truncate_extents(struct inode * inode)
{
lb_addr bloc, eloc, neloc = { 0, 0 };
kernel_lb_addr bloc, eloc, neloc = { 0, 0 };
uint32_t extoffset, elen, offset, nelen = 0, lelen = 0, lenalloc;
int8_t etype;
int first_block = inode->i_size >> inode->i_sb->s_blocksize_bits;
......@@ -254,7 +254,7 @@ void udf_truncate_extents(struct inode * inode)
}
else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
{
lb_addr neloc = { 0, 0 };
kernel_lb_addr neloc = { 0, 0 };
extoffset -= adsize;
nelen = EXT_NOT_RECORDED_NOT_ALLOCATED |
((elen + offset + inode->i_sb->s_blocksize - 1) &
......@@ -272,7 +272,7 @@ void udf_truncate_extents(struct inode * inode)
~(inode->i_sb->s_blocksize - 1));
udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1);
}
memset(&eloc, 0x00, sizeof(lb_addr));
memset(&eloc, 0x00, sizeof(kernel_lb_addr));
elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset;
udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
}
......
......@@ -68,7 +68,7 @@ struct udf_vds_record
struct generic_desc
{
tag descTag;
uint32_t volDescSeqNum;
__le32 volDescSeqNum;
};
struct ustr
......@@ -89,7 +89,7 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, struct file
extern int udf_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
/* inode.c */
extern struct inode *udf_iget(struct super_block *, lb_addr);
extern struct inode *udf_iget(struct super_block *, kernel_lb_addr);
extern int udf_sync_inode(struct inode *);
extern void udf_expand_file_adinicb(struct inode *, int, int *);
extern struct buffer_head * udf_expand_dir_adinicb(struct inode *, int *, int *);
......@@ -101,12 +101,12 @@ extern void udf_delete_inode(struct inode *);
extern void udf_clear_inode(struct inode *);
extern void udf_write_inode(struct inode *, int);
extern long udf_block_map(struct inode *, long);
extern int8_t inode_bmap(struct inode *, int, lb_addr *, uint32_t *, lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
extern int8_t udf_add_aext(struct inode *, lb_addr *, int *, lb_addr, uint32_t, struct buffer_head **, int);
extern int8_t udf_write_aext(struct inode *, lb_addr, int *, lb_addr, uint32_t, struct buffer_head *, int);
extern int8_t udf_delete_aext(struct inode *, lb_addr, int, lb_addr, uint32_t, struct buffer_head *);
extern int8_t udf_next_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int);
extern int8_t udf_current_aext(struct inode *, lb_addr *, int *, lb_addr *, uint32_t *, struct buffer_head **, int);
extern int8_t inode_bmap(struct inode *, int, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
extern int8_t udf_add_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr, uint32_t, struct buffer_head **, int);
extern int8_t udf_write_aext(struct inode *, kernel_lb_addr, int *, kernel_lb_addr, uint32_t, struct buffer_head *, int);
extern int8_t udf_delete_aext(struct inode *, kernel_lb_addr, int, kernel_lb_addr, uint32_t, struct buffer_head *);
extern int8_t udf_next_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr *, uint32_t *, struct buffer_head **, int);
extern int8_t udf_current_aext(struct inode *, kernel_lb_addr *, int *, kernel_lb_addr *, uint32_t *, struct buffer_head **, int);
/* misc.c */
extern struct buffer_head *udf_tgetblk(struct super_block *, int);
......@@ -114,7 +114,7 @@ extern struct buffer_head *udf_tread(struct super_block *, int);
extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, uint32_t, uint8_t);
extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, uint8_t);
extern struct buffer_head *udf_read_tagged(struct super_block *, uint32_t, uint32_t, uint16_t *);
extern struct buffer_head *udf_read_ptagged(struct super_block *, lb_addr, uint32_t, uint16_t *);
extern struct buffer_head *udf_read_ptagged(struct super_block *, kernel_lb_addr, uint32_t, uint16_t *);
extern void udf_release_data(struct buffer_head *);
extern void udf_update_tag(char *, int);
extern void udf_new_tag(char *, uint16_t, uint16_t, uint16_t, uint32_t, int);
......@@ -145,7 +145,7 @@ extern void udf_discard_prealloc(struct inode *);
extern void udf_truncate_extents(struct inode *);
/* balloc.c */
extern void udf_free_blocks(struct super_block *, struct inode *, lb_addr, uint32_t, uint32_t);
extern void udf_free_blocks(struct super_block *, struct inode *, kernel_lb_addr, uint32_t, uint32_t);
extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, uint32_t, uint32_t);
extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_t, int *);
......@@ -153,7 +153,7 @@ extern int udf_new_block(struct super_block *, struct inode *, uint16_t, uint32_
extern int udf_fsync_file(struct file *, struct dentry *, int);
/* directory.c */
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 **);
extern struct fileIdentDesc * udf_fileident_read(struct inode *, loff_t *, struct udf_fileident_bh *, struct fileIdentDesc *, kernel_lb_addr *, uint32_t *, kernel_lb_addr *, uint32_t *, uint32_t *, struct buffer_head **);
extern struct fileIdentDesc * udf_get_fileident(void * buffer, int bufsize, int * offset);
extern long_ad * udf_get_filelongad(uint8_t *, int, int *, int);
extern short_ad * udf_get_fileshortad(uint8_t *, int, int *, int);
......@@ -162,7 +162,7 @@ extern short_ad * udf_get_fileshortad(uint8_t *, int, int *, int);
extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t);
/* udftime.c */
extern time_t *udf_stamp_to_time(time_t *, long *, timestamp);
extern timestamp *udf_time_to_stamp(timestamp *, struct timespec);
extern time_t *udf_stamp_to_time(time_t *, long *, kernel_timestamp);
extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *, struct timespec);
#endif /* __UDF_DECL_H */
......@@ -4,15 +4,15 @@
#include <asm/byteorder.h>
#include <linux/string.h>
static inline lb_addr lelb_to_cpu(lb_addr in)
static inline kernel_lb_addr lelb_to_cpu(lb_addr in)
{
lb_addr out;
kernel_lb_addr out;
out.logicalBlockNum = le32_to_cpu(in.logicalBlockNum);
out.partitionReferenceNum = le16_to_cpu(in.partitionReferenceNum);
return out;
}
static inline lb_addr cpu_to_lelb(lb_addr in)
static inline lb_addr cpu_to_lelb(kernel_lb_addr in)
{
lb_addr out;
out.logicalBlockNum = cpu_to_le32(in.logicalBlockNum);
......@@ -20,9 +20,9 @@ static inline lb_addr cpu_to_lelb(lb_addr in)
return out;
}
static inline timestamp lets_to_cpu(timestamp in)
static inline kernel_timestamp lets_to_cpu(timestamp in)
{
timestamp out;
kernel_timestamp out;
memcpy(&out, &in, sizeof(timestamp));
out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone);
out.year = le16_to_cpu(in.year);
......@@ -45,15 +45,15 @@ static inline short_ad cpu_to_lesa(short_ad in)
return out;
}
static inline long_ad lela_to_cpu(long_ad in)
static inline kernel_long_ad lela_to_cpu(long_ad in)
{
long_ad out;
kernel_long_ad out;
out.extLength = le32_to_cpu(in.extLength);
out.extLocation = lelb_to_cpu(in.extLocation);
return out;
}
static inline long_ad cpu_to_lela(long_ad in)
static inline long_ad cpu_to_lela(kernel_long_ad in)
{
long_ad out;
out.extLength = cpu_to_le32(in.extLength);
......@@ -61,15 +61,15 @@ static inline long_ad cpu_to_lela(long_ad in)
return out;
}
static inline extent_ad leea_to_cpu(extent_ad in)
static inline kernel_extent_ad leea_to_cpu(extent_ad in)
{
extent_ad out;
kernel_extent_ad out;
out.extLength = le32_to_cpu(in.extLength);
out.extLocation = le32_to_cpu(in.extLocation);
return out;
}
static inline timestamp cpu_to_lets(timestamp in)
static inline timestamp cpu_to_lets(kernel_timestamp in)
{
timestamp out;
memcpy(&out, &in, sizeof(timestamp));
......
......@@ -85,7 +85,7 @@ extern struct timezone sys_tz;
#define SECS_PER_DAY (SECS_PER_HOUR * 24)
time_t *
udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src)
udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src)
{
int yday;
uint8_t type = src.typeAndTimezone >> 12;
......@@ -120,8 +120,8 @@ udf_stamp_to_time(time_t *dest, long *dest_usec, timestamp src)
}
timestamp *
udf_time_to_stamp(timestamp *dest, struct timespec ts)
kernel_timestamp *
udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts)
{
long int days, rem, y;
const unsigned short int *ip;
......
......@@ -45,7 +45,7 @@ struct udf_inode_info
{
struct timespec i_crtime;
/* Physical address of inode */
lb_addr i_location;
kernel_lb_addr i_location;
__u64 i_unique;
__u32 i_lenEAttr;
__u32 i_lenAlloc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment