UDF: coding style conversion - lindent fixups

This patch fixes up sources after conversion by Lindent.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Cyrill Gorcunov
2007-07-21 04:37:18 -07:00
committed by Linus Torvalds
parent 71133027fe
commit 28de7948a8
23 changed files with 1912 additions and 2704 deletions
+161 -259
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -111,7 +111,7 @@ int main(void)
return 0;
}
#endif /* defined(TEST) */
#endif /* defined(TEST) */
/****************************************************************************/
#if defined(GENERATE)
@@ -169,4 +169,4 @@ int main(int argc, char **argv)
return 0;
}
#endif /* defined(GENERATE) */
#endif /* defined(GENERATE) */
+24 -36
View File
@@ -43,10 +43,10 @@ static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
/* readdir and lookup functions */
const struct file_operations udf_dir_operations = {
.read = generic_read_dir,
.readdir = udf_readdir,
.ioctl = udf_ioctl,
.fsync = udf_fsync_file,
.read = generic_read_dir,
.readdir = udf_readdir,
.ioctl = udf_ioctl,
.fsync = udf_fsync_file,
};
/*
@@ -83,8 +83,7 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
lock_kernel();
if (filp->f_pos == 0) {
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) <
0) {
if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) < 0) {
unlock_kernel();
return 0;
}
@@ -93,7 +92,7 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
result = do_udf_readdir(dir, filp, filldir, dirent);
unlock_kernel();
return result;
return result;
}
static int
@@ -125,21 +124,20 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
if (nf_pos == 0)
nf_pos = (udf_ext0_offset(dir) >> 2);
fibh.soffset = fibh.eoffset =
(nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
fibh.sbh = fibh.ebh = NULL;
else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
&epos, &eloc, &elen,
&offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
} else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
&epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
epos.offset -= sizeof(short_ad);
else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
epos.offset -= sizeof(long_ad);
} else
} else {
offset = 0;
}
if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) {
brelse(epos.bh);
@@ -149,15 +147,11 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) {
i = 16 >> (dir->i_sb->s_blocksize_bits - 9);
if (i + offset > (elen >> dir->i_sb->s_blocksize_bits))
i = (elen >> dir->i_sb->s_blocksize_bits) -
offset;
i = (elen >> dir->i_sb->s_blocksize_bits) - offset;
for (num = 0; i > 0; i--) {
block =
udf_get_lb_pblock(dir->i_sb, eloc,
offset + i);
block = udf_get_lb_pblock(dir->i_sb, eloc, offset + i);
tmp = udf_tgetblk(dir->i_sb, block);
if (tmp && !buffer_uptodate(tmp)
&& !buffer_locked(tmp))
if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
bha[num++] = tmp;
else
brelse(tmp);
@@ -178,7 +172,6 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
&elen, &offset);
if (!fi) {
if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh);
@@ -190,19 +183,16 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
liu = le16_to_cpu(cfi.lengthOfImpUse);
lfi = cfi.lengthFileIdent;
if (fibh.sbh == fibh.ebh)
if (fibh.sbh == fibh.ebh) {
nameptr = fi->fileIdent + liu;
else {
} else {
int poffset; /* Unpaded ending offset */
poffset =
fibh.soffset + sizeof(struct fileIdentDesc) + liu +
lfi;
poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;
if (poffset >= lfi)
nameptr =
(char *)(fibh.ebh->b_data + poffset - lfi);
else {
if (poffset >= lfi) {
nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
} else {
nameptr = fname;
memcpy(nameptr, fi->fileIdent + liu,
lfi - poffset);
@@ -235,17 +225,15 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
}
if (flen) {
if (filldir
(dirent, fname, flen, filp->f_pos, iblock,
dt_type) < 0) {
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0) {
if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh);
brelse(fibh.sbh);
brelse(epos.bh);
return 0;
return 0;
}
}
} /* end while */
} /* end while */
filp->f_pos = nf_pos + 1;
+27 -41
View File
@@ -31,7 +31,7 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
*error = 0;
ad = (uint8_t *) (*bh)->b_data + *offset;
ad = (uint8_t *)(*bh)->b_data + *offset;
*offset += ad_size;
if (!ad) {
@@ -51,7 +51,7 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
ad = tmpad;
remainder = dir->i_sb->s_blocksize - loffset;
memcpy((uint8_t *) ad, (*bh)->b_data + loffset, remainder);
memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder);
brelse(*bh);
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
@@ -60,10 +60,10 @@ static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
if (!((*bh) = udf_tread(dir->i_sb, block)))
return NULL;
memcpy((uint8_t *) ad + remainder, (*bh)->b_data,
ad_size - remainder);
memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder);
*offset = ad_size - remainder;
}
return ad;
}
#endif
@@ -86,15 +86,13 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
(UDF_I_EFE(dir) ?
sizeof(struct extendedFileEntry) :
sizeof(struct fileEntry)),
dir->i_sb->s_blocksize,
&(fibh->eoffset));
dir->i_sb->s_blocksize, &(fibh->eoffset));
if (!fi)
return NULL;
*nf_pos += ((fibh->eoffset - fibh->soffset) >> 2);
memcpy((uint8_t *) cfi, (uint8_t *) fi,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
return fi;
@@ -121,21 +119,14 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
return NULL;
fibh->soffset = fibh->eoffset = 0;
if (!
(*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1)))
{
if (!(*offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) {
i = 16 >> (dir->i_sb->s_blocksize_bits - 9);
if (i + *offset >
(*elen >> dir->i_sb->s_blocksize_bits))
i = (*elen >> dir->i_sb->s_blocksize_bits) -
*offset;
if (i + *offset > (*elen >> dir->i_sb->s_blocksize_bits))
i = (*elen >> dir->i_sb->s_blocksize_bits)-*offset;
for (num = 0; i > 0; i--) {
block =
udf_get_lb_pblock(dir->i_sb, *eloc,
*offset + i);
block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset + i);
tmp = udf_tgetblk(dir->i_sb, block);
if (tmp && !buffer_uptodate(tmp)
&& !buffer_locked(tmp))
if (tmp && !buffer_uptodate(tmp) && !buffer_locked(tmp))
bha[num++] = tmp;
else
brelse(tmp);
@@ -160,7 +151,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
*nf_pos += ((fibh->eoffset - fibh->soffset) >> 2);
if (fibh->eoffset <= dir->i_sb->s_blocksize) {
memcpy((uint8_t *) cfi, (uint8_t *) fi,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
int lextoffset = epos->offset;
@@ -187,21 +178,17 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
if (sizeof(struct fileIdentDesc) > -fibh->soffset) {
int fi_len;
memcpy((uint8_t *) cfi, (uint8_t *) fi, -fibh->soffset);
memcpy((uint8_t *) cfi - fibh->soffset,
fibh->ebh->b_data,
memcpy((uint8_t *)cfi, (uint8_t *)fi, -fibh->soffset);
memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data,
sizeof(struct fileIdentDesc) + fibh->soffset);
fi_len =
(sizeof(struct fileIdentDesc) +
cfi->lengthFileIdent +
le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent +
le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3;
*nf_pos +=
((fi_len - (fibh->eoffset - fibh->soffset)) >> 2);
*nf_pos += ((fi_len - (fibh->eoffset - fibh->soffset)) >> 2);
fibh->eoffset = fibh->soffset + fi_len;
} else {
memcpy((uint8_t *) cfi, (uint8_t *) fi,
memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc));
}
}
@@ -237,9 +224,10 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
}
if ((*offset + sizeof(struct fileIdentDesc)) > bufsize) {
lengthThisIdent = sizeof(struct fileIdentDesc);
} else
} else {
lengthThisIdent = sizeof(struct fileIdentDesc) +
fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
}
/* we need to figure padding, too! */
padlen = lengthThisIdent % UDF_NAME_PAD;
@@ -270,22 +258,20 @@ static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
return NULL;
}
ptr =
(uint8_t *) (fe->extendedAttr) +
le32_to_cpu(fe->lengthExtendedAttr);
ptr = (uint8_t *)(fe->extendedAttr) + le32_to_cpu(fe->lengthExtendedAttr);
if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs))) {
ptr += *offset;
}
ext = (extent_ad *) ptr;
ext = (extent_ad *)ptr;
*offset = *offset + sizeof(extent_ad);
return ext;
}
#endif
short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset,
short_ad *udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset,
int inc)
{
short_ad *sa;
@@ -297,7 +283,7 @@ short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset,
if ((*offset < 0) || ((*offset + sizeof(short_ad)) > maxoffset))
return NULL;
else if ((sa = (short_ad *) ptr)->extLength == 0)
else if ((sa = (short_ad *)ptr)->extLength == 0)
return NULL;
if (inc)
@@ -305,7 +291,7 @@ short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset,
return sa;
}
long_ad *udf_get_filelongad(uint8_t * ptr, int maxoffset, int *offset, int inc)
long_ad *udf_get_filelongad(uint8_t *ptr, int maxoffset, int *offset, int inc)
{
long_ad *la;
@@ -316,7 +302,7 @@ long_ad *udf_get_filelongad(uint8_t * ptr, int maxoffset, int *offset, int inc)
if ((*offset < 0) || ((*offset + sizeof(long_ad)) > maxoffset))
return NULL;
else if ((la = (long_ad *) ptr)->extLength == 0)
else if ((la = (long_ad *)ptr)->extLength == 0)
return NULL;
if (inc)
+340 -340
View File
File diff suppressed because it is too large Load Diff
+34 -38
View File
@@ -30,7 +30,7 @@
#include <linux/udf_fs.h>
#include <asm/uaccess.h>
#include <linux/kernel.h>
#include <linux/string.h> /* memset */
#include <linux/string.h> /* memset */
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
@@ -55,11 +55,11 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
SetPageUptodate(page);
kunmap(page);
unlock_page(page);
return 0;
}
static int udf_adinicb_writepage(struct page *page,
struct writeback_control *wbc)
static int udf_adinicb_writepage(struct page *page, struct writeback_control *wbc)
{
struct inode *inode = page->mapping->host;
char *kaddr;
@@ -72,6 +72,7 @@ static int udf_adinicb_writepage(struct page *page,
SetPageUptodate(page);
kunmap(page);
unlock_page(page);
return 0;
}
@@ -100,11 +101,11 @@ static int udf_adinicb_commit_write(struct file *file, struct page *page,
}
const struct address_space_operations udf_adinicb_aops = {
.readpage = udf_adinicb_readpage,
.writepage = udf_adinicb_writepage,
.sync_page = block_sync_page,
.prepare_write = udf_adinicb_prepare_write,
.commit_write = udf_adinicb_commit_write,
.readpage = udf_adinicb_readpage,
.writepage = udf_adinicb_writepage,
.sync_page = block_sync_page,
.prepare_write = udf_adinicb_prepare_write,
.commit_write = udf_adinicb_commit_write,
};
static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
@@ -122,8 +123,8 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
else
pos = ppos;
if (inode->i_sb->s_blocksize <
(udf_file_entry_alloc_offset(inode) + pos + count)) {
if (inode->i_sb->s_blocksize < (udf_file_entry_alloc_offset(inode) +
pos + count)) {
udf_expand_file_adinicb(inode, pos + count, &err);
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
udf_debug("udf_expand_adinicb: err=%d\n", err);
@@ -138,9 +139,9 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
}
retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
if (retval > 0)
mark_inode_dirty(inode);
return retval;
}
@@ -181,10 +182,12 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
long old_block, new_block;
int result = -EINVAL;
if (file_permission(filp, MAY_READ) != 0) {
udf_debug("no permission to access inode %lu\n", inode->i_ino);
udf_debug("no permission to access inode %lu\n",
inode->i_ino);
return -EPERM;
}
@@ -196,26 +199,19 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
switch (cmd) {
case UDF_GETVOLIDENT:
return copy_to_user((char __user *)arg,
UDF_SB_VOLIDENT(inode->i_sb),
32) ? -EFAULT : 0;
UDF_SB_VOLIDENT(inode->i_sb), 32) ? -EFAULT : 0;
case UDF_RELOCATE_BLOCKS:
{
long old, new;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (get_user(old, (long __user *)arg))
return -EFAULT;
if ((result = udf_relocate_blocks(inode->i_sb,
old, &new)) == 0)
result = put_user(new, (long __user *)arg);
return result;
}
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (get_user(old_block, (long __user *)arg))
return -EFAULT;
if ((result = udf_relocate_blocks(inode->i_sb,
old_block, &new_block)) == 0)
result = put_user(new_block, (long __user *)arg);
return result;
case UDF_GETEASIZE:
result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
break;
case UDF_GETEABLOCK:
result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
@@ -248,16 +244,16 @@ static int udf_release_file(struct inode *inode, struct file *filp)
}
const struct file_operations udf_file_operations = {
.read = do_sync_read,
.aio_read = generic_file_aio_read,
.ioctl = udf_ioctl,
.open = generic_file_open,
.mmap = generic_file_mmap,
.write = do_sync_write,
.aio_write = udf_file_aio_write,
.release = udf_release_file,
.fsync = udf_fsync_file,
.splice_read = generic_file_splice_read,
.read = do_sync_read,
.aio_read = generic_file_aio_read,
.ioctl = udf_ioctl,
.open = generic_file_open,
.mmap = generic_file_mmap,
.write = do_sync_write,
.aio_write = udf_file_aio_write,
.release = udf_release_file,
.fsync = udf_fsync_file,
.splice_read = generic_file_splice_read,
};
const struct inode_operations udf_file_inode_operations = {
+2
View File
@@ -32,6 +32,7 @@ static int udf_fsync_inode(struct inode *, int);
int udf_fsync_file(struct file *file, struct dentry *dentry, int datasync)
{
struct inode *inode = dentry->d_inode;
return udf_fsync_inode(inode, datasync);
}
@@ -46,5 +47,6 @@ static int udf_fsync_inode(struct inode *inode, int datasync)
return err;
err |= udf_sync_inode(inode);
return err ? -EIO : 0;
}
+13 -25
View File
@@ -46,12 +46,10 @@ void udf_free_inode(struct inode *inode)
if (sbi->s_lvidbh) {
if (S_ISDIR(inode->i_mode))
UDF_SB_LVIDIU(sb)->numDirs =
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs)
- 1);
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) - 1);
else
UDF_SB_LVIDIU(sb)->numFiles =
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles)
- 1);
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1);
mark_buffer_dirty(sbi->s_lvidbh);
}
@@ -82,10 +80,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
UDF_I_STRAT4096(inode) = 0;
block =
udf_new_block(dir->i_sb, NULL,
UDF_I_LOCATION(dir).partitionReferenceNum, start,
err);
block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum,
start, err);
if (*err) {
iput(inode);
return NULL;
@@ -95,17 +91,13 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
if (UDF_SB_LVIDBH(sb)) {
struct logicalVolHeaderDesc *lvhd;
uint64_t uniqueID;
lvhd =
(struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->
logicalVolContentsUse);
lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse);
if (S_ISDIR(mode))
UDF_SB_LVIDIU(sb)->numDirs =
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs)
+ 1);
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) + 1);
else
UDF_SB_LVIDIU(sb)->numFiles =
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles)
+ 1);
cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) + 1);
UDF_I_UNIQUE(inode) = uniqueID = le64_to_cpu(lvhd->uniqueID);
if (!(++uniqueID & 0x00000000FFFFFFFFUL))
uniqueID += 16;
@@ -118,12 +110,12 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
inode->i_gid = dir->i_gid;
if (S_ISDIR(mode))
mode |= S_ISGID;
} else
} else {
inode->i_gid = current->fsgid;
}
UDF_I_LOCATION(inode).logicalBlockNum = block;
UDF_I_LOCATION(inode).partitionReferenceNum =
UDF_I_LOCATION(dir).partitionReferenceNum;
UDF_I_LOCATION(inode).partitionReferenceNum = UDF_I_LOCATION(dir).partitionReferenceNum;
inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0);
inode->i_blocks = 0;
UDF_I_LENEATTR(inode) = 0;
@@ -132,14 +124,10 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
UDF_I_EFE(inode) = 1;
UDF_UPDATE_UDFREV(inode->i_sb, UDF_VERS_USE_EXTENDED_FE);
UDF_I_DATA(inode) =
kzalloc(inode->i_sb->s_blocksize -
sizeof(struct extendedFileEntry), GFP_KERNEL);
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
} else {
UDF_I_EFE(inode) = 0;
UDF_I_DATA(inode) =
kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry),
GFP_KERNEL);
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize - sizeof(struct fileEntry), GFP_KERNEL);
}
if (!UDF_I_DATA(inode)) {
iput(inode);
@@ -154,7 +142,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
else
UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
inode->i_mtime = inode->i_atime = inode->i_ctime =
UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
insert_inode_hash(inode);
mark_inode_dirty(inode);
mutex_unlock(&sbi->s_alloc_mutex);
+369 -581
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -43,7 +43,7 @@ unsigned int udf_get_last_session(struct super_block *sb)
udf_debug("XA disk: %s, vol_desc_start=%d\n",
(ms_info.xa_flag ? "yes" : "no"), ms_info.addr.lba);
#if WE_OBEY_THE_WRITTEN_STANDARDS
if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */
if (ms_info.xa_flag) /* necessary for a valid ms_info.addr */
#endif
vol_desc_start = ms_info.addr.lba;
} else {
@@ -57,7 +57,7 @@ unsigned long udf_get_last_block(struct super_block *sb)
struct block_device *bdev = sb->s_bdev;
unsigned long lblock = 0;
if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long)&lblock))
if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock))
lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits;
if (lblock)
+36 -51
View File
@@ -54,15 +54,15 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
int i;
ea = UDF_I_DATA(inode);
if (UDF_I_LENEATTR(inode))
if (UDF_I_LENEATTR(inode)) {
ad = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode);
else {
} else {
ad = ea;
size += sizeof(struct extendedAttrHeaderDesc);
}
offset = inode->i_sb->s_blocksize - udf_file_entry_alloc_offset(inode) -
UDF_I_LENALLOC(inode);
UDF_I_LENALLOC(inode);
/* TODO - Check for FreeEASpace */
@@ -76,56 +76,45 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
if (UDF_I_LENEATTR(inode)) {
/* check checksum/crc */
if (le16_to_cpu(eahd->descTag.tagIdent) !=
TAG_IDENT_EAHD
|| le32_to_cpu(eahd->descTag.tagLocation) !=
UDF_I_LOCATION(inode).logicalBlockNum) {
if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD ||
le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum) {
return NULL;
}
} else {
size -= sizeof(struct extendedAttrHeaderDesc);
UDF_I_LENEATTR(inode) +=
sizeof(struct extendedAttrHeaderDesc);
UDF_I_LENEATTR(inode) += sizeof(struct extendedAttrHeaderDesc);
eahd->descTag.tagIdent = cpu_to_le16(TAG_IDENT_EAHD);
if (UDF_SB_UDFREV(inode->i_sb) >= 0x0200)
eahd->descTag.descVersion = cpu_to_le16(3);
else
eahd->descTag.descVersion = cpu_to_le16(2);
eahd->descTag.tagSerialNum =
cpu_to_le16(UDF_SB_SERIALNUM(inode->i_sb));
eahd->descTag.tagLocation =
cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
eahd->descTag.tagSerialNum = cpu_to_le16(UDF_SB_SERIALNUM(inode->i_sb));
eahd->descTag.tagLocation = cpu_to_le32(UDF_I_LOCATION(inode).logicalBlockNum);
eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF);
eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF);
}
offset = UDF_I_LENEATTR(inode);
if (type < 2048) {
if (le32_to_cpu(eahd->appAttrLocation) <
UDF_I_LENEATTR(inode)) {
uint32_t aal =
le32_to_cpu(eahd->appAttrLocation);
memmove(&ea[offset - aal + size], &ea[aal],
offset - aal);
if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode)) {
uint32_t aal = le32_to_cpu(eahd->appAttrLocation);
memmove(&ea[offset - aal + size],
&ea[aal], offset - aal);
offset -= aal;
eahd->appAttrLocation = cpu_to_le32(aal + size);
}
if (le32_to_cpu(eahd->impAttrLocation) <
UDF_I_LENEATTR(inode)) {
uint32_t ial =
le32_to_cpu(eahd->impAttrLocation);
memmove(&ea[offset - ial + size], &ea[ial],
offset - ial);
if (le32_to_cpu(eahd->impAttrLocation) < UDF_I_LENEATTR(inode)) {
uint32_t ial = le32_to_cpu(eahd->impAttrLocation);
memmove(&ea[offset - ial + size],
&ea[ial], offset - ial);
offset -= ial;
eahd->impAttrLocation = cpu_to_le32(ial + size);
}
} else if (type < 65536) {
if (le32_to_cpu(eahd->appAttrLocation) <
UDF_I_LENEATTR(inode)) {
uint32_t aal =
le32_to_cpu(eahd->appAttrLocation);
memmove(&ea[offset - aal + size], &ea[aal],
offset - aal);
if (le32_to_cpu(eahd->appAttrLocation) < UDF_I_LENEATTR(inode)) {
uint32_t aal = le32_to_cpu(eahd->appAttrLocation);
memmove(&ea[offset - aal + size],
&ea[aal], offset - aal);
offset -= aal;
eahd->appAttrLocation = cpu_to_le32(aal + size);
}
@@ -133,18 +122,18 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
/* rewrite CRC + checksum of eahd */
crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag);
eahd->descTag.descCRCLength = cpu_to_le16(crclen);
eahd->descTag.descCRC =
cpu_to_le16(udf_crc((char *)eahd + sizeof(tag), crclen, 0));
eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd +
sizeof(tag), crclen, 0));
eahd->descTag.tagChecksum = 0;
for (i = 0; i < 16; i++)
if (i != 4)
eahd->descTag.tagChecksum +=
((uint8_t *) & (eahd->descTag))[i];
eahd->descTag.tagChecksum += ((uint8_t *)&(eahd->descTag))[i];
UDF_I_LENEATTR(inode) += size;
return (struct genericFormat *)&ea[offset];
}
if (loc & 0x02) {
}
return NULL;
}
@@ -163,8 +152,7 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
/* check checksum/crc */
if (le16_to_cpu(eahd->descTag.tagIdent) != TAG_IDENT_EAHD ||
le32_to_cpu(eahd->descTag.tagLocation) !=
UDF_I_LOCATION(inode).logicalBlockNum) {
le32_to_cpu(eahd->descTag.tagLocation) != UDF_I_LOCATION(inode).logicalBlockNum) {
return NULL;
}
@@ -177,13 +165,13 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
while (offset < UDF_I_LENEATTR(inode)) {
gaf = (struct genericFormat *)&ea[offset];
if (le32_to_cpu(gaf->attrType) == type
&& gaf->attrSubtype == subtype)
if (le32_to_cpu(gaf->attrType) == type && gaf->attrSubtype == subtype)
return gaf;
else
offset += le32_to_cpu(gaf->attrLength);
}
}
return NULL;
}
@@ -216,23 +204,22 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
return NULL;
}
tag_p = (tag *) (bh->b_data);
tag_p = (tag *)(bh->b_data);
*ident = le16_to_cpu(tag_p->tagIdent);
if (location != le32_to_cpu(tag_p->tagLocation)) {
udf_debug("location mismatch block %u, tag %u != %u\n",
block + UDF_SB_SESSION(sb),
le32_to_cpu(tag_p->tagLocation), location);
block + UDF_SB_SESSION(sb), le32_to_cpu(tag_p->tagLocation), location);
goto error_out;
}
/* Verify the tag checksum */
checksum = 0U;
for (i = 0; i < 4; i++)
checksum += (uint8_t) (bh->b_data[i]);
checksum += (uint8_t)(bh->b_data[i]);
for (i = 5; i < 16; i++)
checksum += (uint8_t) (bh->b_data[i]);
checksum += (uint8_t)(bh->b_data[i]);
if (checksum != tag_p->tagChecksum) {
printk(KERN_ERR "udf: tag checksum failed block %d\n", block);
goto error_out;
@@ -249,16 +236,14 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
/* Verify the descriptor CRC */
if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize ||
le16_to_cpu(tag_p->descCRC) == udf_crc(bh->b_data + sizeof(tag),
le16_to_cpu(tag_p->
descCRCLength),
0)) {
le16_to_cpu(tag_p->descCRCLength), 0)) {
return bh;
}
udf_debug("Crc failure block %d: crc = %d, crclen = %d\n",
block + UDF_SB_SESSION(sb), le16_to_cpu(tag_p->descCRC),
le16_to_cpu(tag_p->descCRCLength));
error_out:
error_out:
brelse(bh);
return NULL;
}
@@ -272,7 +257,7 @@ struct buffer_head *udf_read_ptagged(struct super_block *sb, kernel_lb_addr loc,
void udf_update_tag(char *data, int length)
{
tag *tptr = (tag *) data;
tag *tptr = (tag *)data;
int i;
length -= sizeof(tag);
@@ -283,13 +268,13 @@ void udf_update_tag(char *data, int length)
for (i = 0; i < 16; i++)
if (i != 4)
tptr->tagChecksum += (uint8_t) (data[i]);
tptr->tagChecksum += (uint8_t)(data[i]);
}
void udf_new_tag(char *data, uint16_t ident, uint16_t version, uint16_t snum,
uint32_t loc, int length)
{
tag *tptr = (tag *) data;
tag *tptr = (tag *)data;
tptr->tagIdent = cpu_to_le16(ident);
tptr->descVersion = cpu_to_le16(version);
tptr->tagSerialNum = cpu_to_le16(snum);
+180 -228
View File
File diff suppressed because it is too large Load Diff
+82 -82
View File
@@ -66,64 +66,64 @@
#define IS_DF_SOFT_WRITE_PROTECT 0x02
struct UDFIdentSuffix {
__le16 UDFRevision;
uint8_t OSClass;
uint8_t OSIdentifier;
uint8_t reserved[4];
__le16 UDFRevision;
uint8_t OSClass;
uint8_t OSIdentifier;
uint8_t reserved[4];
} __attribute__ ((packed));
struct impIdentSuffix {
uint8_t OSClass;
uint8_t OSIdentifier;
uint8_t reserved[6];
uint8_t OSClass;
uint8_t OSIdentifier;
uint8_t reserved[6];
} __attribute__ ((packed));
struct appIdentSuffix {
uint8_t impUse[8];
uint8_t impUse[8];
} __attribute__ ((packed));
/* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */
/* Implementation Use (UDF 2.50 2.2.6.4) */
struct logicalVolIntegrityDescImpUse {
regid impIdent;
__le32 numFiles;
__le32 numDirs;
__le16 minUDFReadRev;
__le16 minUDFWriteRev;
__le16 maxUDFWriteRev;
uint8_t impUse[0];
regid impIdent;
__le32 numFiles;
__le32 numDirs;
__le16 minUDFReadRev;
__le16 minUDFWriteRev;
__le16 maxUDFWriteRev;
uint8_t impUse[0];
} __attribute__ ((packed));
/* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */
/* Implementation Use (UDF 2.50 2.2.7.2) */
struct impUseVolDescImpUse {
charspec LVICharset;
dstring logicalVolIdent[128];
dstring LVInfo1[36];
dstring LVInfo2[36];
dstring LVInfo3[36];
regid impIdent;
uint8_t impUse[128];
charspec LVICharset;
dstring logicalVolIdent[128];
dstring LVInfo1[36];
dstring LVInfo2[36];
dstring LVInfo3[36];
regid impIdent;
uint8_t impUse[128];
} __attribute__ ((packed));
struct udfPartitionMap2 {
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
} __attribute__ ((packed));
/* Virtual Partition Map (UDF 2.50 2.2.8) */
struct virtualPartitionMap {
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
uint8_t reserved2[24];
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
uint8_t reserved2[24];
} __attribute__ ((packed));
/* Sparable Partition Map (UDF 2.50 2.2.9) */
@@ -143,62 +143,62 @@ struct sparablePartitionMap {
/* Metadata Partition Map (UDF 2.4.0 2.2.10) */
struct metadataPartitionMap {
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
__le32 metadataFileLoc;
__le32 metadataMirrorFileLoc;
__le32 metadataBitmapFileLoc;
__le32 allocUnitSize;
__le16 alignUnitSize;
uint8_t flags;
uint8_t reserved2[5];
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
__le16 volSeqNum;
__le16 partitionNum;
__le32 metadataFileLoc;
__le32 metadataMirrorFileLoc;
__le32 metadataBitmapFileLoc;
__le32 allocUnitSize;
__le16 alignUnitSize;
uint8_t flags;
uint8_t reserved2[5];
} __attribute__ ((packed));
/* Virtual Allocation Table (UDF 1.5 2.2.10) */
struct virtualAllocationTable15 {
__le32 VirtualSector[0];
regid vatIdent;
__le32 previousVATICBLoc;
__le32 VirtualSector[0];
regid vatIdent;
__le32 previousVATICBLoc;
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT15 0x00U
/* Virtual Allocation Table (UDF 2.50 2.2.11) */
struct virtualAllocationTable20 {
__le16 lengthHeader;
__le16 lengthImpUse;
dstring logicalVolIdent[128];
__le32 previousVATICBLoc;
__le32 numFiles;
__le32 numDirs;
__le16 minReadRevision;
__le16 minWriteRevision;
__le16 maxWriteRevision;
__le16 reserved;
uint8_t impUse[0];
__le32 vatEntry[0];
__le16 lengthHeader;
__le16 lengthImpUse;
dstring logicalVolIdent[128];
__le32 previousVATICBLoc;
__le32 numFiles;
__le32 numDirs;
__le16 minReadRevision;
__le16 minWriteRevision;
__le16 maxWriteRevision;
__le16 reserved;
uint8_t impUse[0];
__le32 vatEntry[0];
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT20 0xF8U
/* Sparing Table (UDF 2.50 2.2.12) */
struct sparingEntry {
__le32 origLocation;
__le32 mappedLocation;
__le32 origLocation;
__le32 mappedLocation;
} __attribute__ ((packed));
struct sparingTable {
tag descTag;
regid sparingIdent;
__le16 reallocationTableLen;
__le16 reserved;
__le32 sequenceNum;
tag descTag;
regid sparingIdent;
__le16 reallocationTableLen;
__le16 reserved;
__le32 sequenceNum;
struct sparingEntry
mapEntry[0];
mapEntry[0];
} __attribute__ ((packed));
/* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */
@@ -208,8 +208,8 @@ struct sparingTable {
/* struct long_ad ICB - ADImpUse (UDF 2.50 2.2.4.3) */
struct allocDescImpUse {
__le16 flags;
uint8_t impUse[4];
__le16 flags;
uint8_t impUse[4];
} __attribute__ ((packed));
#define AD_IU_EXT_ERASED 0x0001
@@ -220,23 +220,23 @@ struct allocDescImpUse {
/* Implementation Use Extended Attribute (UDF 2.50 3.3.4.5) */
/* FreeEASpace (UDF 2.50 3.3.4.5.1.1) */
struct freeEaSpace {
__le16 headerChecksum;
uint8_t freeEASpace[0];
__le16 headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
/* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */
struct DVDCopyrightImpUse {
__le16 headerChecksum;
uint8_t CGMSInfo;
uint8_t dataType;
uint8_t protectionSystemInfo[4];
__le16 headerChecksum;
uint8_t CGMSInfo;
uint8_t dataType;
uint8_t protectionSystemInfo[4];
} __attribute__ ((packed));
/* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */
/* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */
struct freeAppEASpace {
__le16 headerChecksum;
uint8_t freeEASpace[0];
__le16 headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
/* UDF Defined System Stream (UDF 2.50 3.3.7) */
@@ -276,4 +276,4 @@ struct freeAppEASpace {
#define UDF_OS_ID_BEOS 0x00U
#define UDF_OS_ID_WINCE 0x00U
#endif /* _OSTA_UDF_H */
#endif /* _OSTA_UDF_H */
+58 -154
View File
@@ -14,7 +14,7 @@
*
* HISTORY
*
* 12/06/98 blf Created file.
* 12/06/98 blf Created file.
*
*/
@@ -32,19 +32,17 @@ inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
uint16_t partition, uint32_t offset)
{
if (partition >= UDF_SB_NUMPARTS(sb)) {
udf_debug
("block=%d, partition=%d, offset=%d: invalid partition\n",
block, partition, offset);
udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n",
block, partition, offset);
return 0xFFFFFFFF;
}
if (UDF_SB_PARTFUNC(sb, partition))
return UDF_SB_PARTFUNC(sb, partition) (sb, block, partition,
offset);
return UDF_SB_PARTFUNC(sb, partition)(sb, block, partition, offset);
else
return UDF_SB_PARTROOT(sb, partition) + block + offset;
}
uint32_t udf_get_pblock_virt15(struct super_block * sb, uint32_t block,
uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
uint16_t partition, uint32_t offset)
{
struct buffer_head *bh = NULL;
@@ -52,14 +50,11 @@ uint32_t udf_get_pblock_virt15(struct super_block * sb, uint32_t block,
uint32_t index;
uint32_t loc;
index =
(sb->s_blocksize -
UDF_SB_TYPEVIRT(sb, partition).s_start_offset) / sizeof(uint32_t);
index = (sb->s_blocksize - UDF_SB_TYPEVIRT(sb,partition).s_start_offset) / sizeof(uint32_t);
if (block > UDF_SB_TYPEVIRT(sb, partition).s_num_entries) {
udf_debug
("Trying to access block beyond end of VAT (%d max %d)\n",
block, UDF_SB_TYPEVIRT(sb, partition).s_num_entries);
if (block > UDF_SB_TYPEVIRT(sb,partition).s_num_entries) {
udf_debug("Trying to access block beyond end of VAT (%d max %d)\n",
block, UDF_SB_TYPEVIRT(sb,partition).s_num_entries);
return 0xFFFFFFFF;
}
@@ -69,10 +64,7 @@ uint32_t udf_get_pblock_virt15(struct super_block * sb, uint32_t block,
index = block % (sb->s_blocksize / sizeof(uint32_t));
} else {
newblock = 0;
index =
UDF_SB_TYPEVIRT(sb,
partition).s_start_offset /
sizeof(uint32_t) + block;
index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(uint32_t) + block;
}
loc = udf_block_map(UDF_SB_VAT(sb), newblock);
@@ -83,7 +75,7 @@ uint32_t udf_get_pblock_virt15(struct super_block * sb, uint32_t block,
return 0xFFFFFFFF;
}
loc = le32_to_cpu(((__le32 *) bh->b_data)[index]);
loc = le32_to_cpu(((__le32 *)bh->b_data)[index]);
brelse(bh);
@@ -93,8 +85,8 @@ uint32_t udf_get_pblock_virt15(struct super_block * sb, uint32_t block,
}
return udf_get_pblock(sb, loc,
UDF_I_LOCATION(UDF_SB_VAT(sb)).
partitionReferenceNum, offset);
UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum,
offset);
}
inline uint32_t udf_get_pblock_virt20(struct super_block * sb, uint32_t block,
@@ -108,40 +100,29 @@ uint32_t udf_get_pblock_spar15(struct super_block * sb, uint32_t block,
{
int i;
struct sparingTable *st = NULL;
uint32_t packet =
(block + offset) & ~(UDF_SB_TYPESPAR(sb, partition).s_packet_len -
1);
uint32_t packet = (block + offset) & ~(UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1);
for (i = 0; i < 4; i++) {
if (UDF_SB_TYPESPAR(sb, partition).s_spar_map[i] != NULL) {
st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,
partition).
s_spar_map[i]->b_data;
if (UDF_SB_TYPESPAR(sb,partition).s_spar_map[i] != NULL) {
st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,partition).s_spar_map[i]->b_data;
break;
}
}
if (st) {
for (i = 0; i < le16_to_cpu(st->reallocationTableLen); i++) {
if (le32_to_cpu(st->mapEntry[i].origLocation) >=
0xFFFFFFF0)
if (le32_to_cpu(st->mapEntry[i].origLocation) >= 0xFFFFFFF0) {
break;
else if (le32_to_cpu(st->mapEntry[i].origLocation) ==
packet) {
return le32_to_cpu(st->mapEntry[i].
mappedLocation) + ((block +
offset) &
(UDF_SB_TYPESPAR
(sb,
partition).
s_packet_len
- 1));
} else if (le32_to_cpu(st->mapEntry[i].origLocation) >
packet)
} else if (le32_to_cpu(st->mapEntry[i].origLocation) == packet) {
return le32_to_cpu(st->mapEntry[i].mappedLocation) +
((block + offset) & (UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1));
} else if (le32_to_cpu(st->mapEntry[i].origLocation) > packet) {
break;
}
}
}
return UDF_SB_PARTROOT(sb, partition) + block + offset;
return UDF_SB_PARTROOT(sb,partition) + block + offset;
}
int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
@@ -153,20 +134,14 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
int i, j, k, l;
for (i = 0; i < UDF_SB_NUMPARTS(sb); i++) {
if (old_block > UDF_SB_PARTROOT(sb, i) &&
old_block < UDF_SB_PARTROOT(sb, i) + UDF_SB_PARTLEN(sb, i))
{
sdata = &UDF_SB_TYPESPAR(sb, i);
packet =
(old_block -
UDF_SB_PARTROOT(sb,
i)) & ~(sdata->s_packet_len - 1);
if (old_block > UDF_SB_PARTROOT(sb,i) &&
old_block < UDF_SB_PARTROOT(sb,i) + UDF_SB_PARTLEN(sb,i)) {
sdata = &UDF_SB_TYPESPAR(sb,i);
packet = (old_block - UDF_SB_PARTROOT(sb,i)) & ~(sdata->s_packet_len - 1);
for (j = 0; j < 4; j++) {
if (UDF_SB_TYPESPAR(sb, i).s_spar_map[j] !=
NULL) {
st = (struct sparingTable *)sdata->
s_spar_map[j]->b_data;
if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL) {
st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
break;
}
}
@@ -174,122 +149,51 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
if (!st)
return 1;
for (k = 0; k < le16_to_cpu(st->reallocationTableLen);
k++) {
if (le32_to_cpu(st->mapEntry[k].origLocation) ==
0xFFFFFFFF) {
for (k = 0; k < le16_to_cpu(st->reallocationTableLen); k++) {
if (le32_to_cpu(st->mapEntry[k].origLocation) == 0xFFFFFFFF) {
for (; j < 4; j++) {
if (sdata->s_spar_map[j]) {
st = (struct
sparingTable *)
sdata->
s_spar_map[j]->
b_data;
st->mapEntry[k].
origLocation =
cpu_to_le32(packet);
udf_update_tag((char *)
st,
sizeof
(struct
sparingTable)
+
le16_to_cpu
(st->
reallocationTableLen)
*
sizeof
(struct
sparingEntry));
mark_buffer_dirty
(sdata->
s_spar_map[j]);
st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
st->mapEntry[k].origLocation = cpu_to_le32(packet);
udf_update_tag((char *)st, sizeof(struct sparingTable) + le16_to_cpu(st->reallocationTableLen) * sizeof(struct sparingEntry));
mark_buffer_dirty(sdata->s_spar_map[j]);
}
}
*new_block =
le32_to_cpu(st->mapEntry[k].
mappedLocation) +
((old_block -
UDF_SB_PARTROOT(sb,
i)) & (sdata->
s_packet_len
- 1));
*new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
return 0;
} else
if (le32_to_cpu
(st->mapEntry[k].origLocation) ==
packet) {
*new_block =
le32_to_cpu(st->mapEntry[k].
mappedLocation) +
((old_block -
UDF_SB_PARTROOT(sb,
i)) & (sdata->
s_packet_len
- 1));
} else if (le32_to_cpu(st->mapEntry[k].origLocation) == packet) {
*new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
return 0;
} else
if (le32_to_cpu
(st->mapEntry[k].origLocation) > packet)
} else if (le32_to_cpu(st->mapEntry[k].origLocation) > packet) {
break;
}
}
for (l = k; l < le16_to_cpu(st->reallocationTableLen);
l++) {
if (le32_to_cpu(st->mapEntry[l].origLocation) ==
0xFFFFFFFF) {
for (l = k; l < le16_to_cpu(st->reallocationTableLen); l++) {
if (le32_to_cpu(st->mapEntry[l].origLocation) == 0xFFFFFFFF) {
for (; j < 4; j++) {
if (sdata->s_spar_map[j]) {
st = (struct
sparingTable *)
sdata->
s_spar_map[j]->
b_data;
mapEntry =
st->mapEntry[l];
mapEntry.origLocation =
cpu_to_le32(packet);
memmove(&st->
mapEntry[k + 1],
&st->
mapEntry[k],
(l -
k) *
sizeof(struct
sparingEntry));
st->mapEntry[k] =
mapEntry;
udf_update_tag((char *)
st,
sizeof
(struct
sparingTable)
+
le16_to_cpu
(st->
reallocationTableLen)
*
sizeof
(struct
sparingEntry));
mark_buffer_dirty
(sdata->
s_spar_map[j]);
st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
mapEntry = st->mapEntry[l];
mapEntry.origLocation = cpu_to_le32(packet);
memmove(&st->mapEntry[k + 1], &st->mapEntry[k], (l - k) * sizeof(struct sparingEntry));
st->mapEntry[k] = mapEntry;
udf_update_tag((char *)st, sizeof(struct sparingTable) + le16_to_cpu(st->reallocationTableLen) * sizeof(struct sparingEntry));
mark_buffer_dirty(sdata->s_spar_map[j]);
}
}
*new_block =
le32_to_cpu(st->mapEntry[k].
mappedLocation) +
((old_block -
UDF_SB_PARTROOT(sb,
i)) & (sdata->
s_packet_len
- 1));
*new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
return 0;
}
}
return 1;
}
} /* if old_block */
}
if (i == UDF_SB_NUMPARTS(sb)) {
/* outside of partitions */
/* for now, fail =) */
+393 -640
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -11,7 +11,7 @@
* Each contributing author retains all rights to their own work.
*
* (C) 1998-2001 Ben Fennema
* (C) 1999 Stelias Computing Inc
* (C) 1999 Stelias Computing Inc
*
* HISTORY
*
@@ -33,8 +33,7 @@
#include <linux/buffer_head.h>
#include "udf_i.h"
static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen,
char *to)
static void udf_pc_to_char(struct super_block *sb, char *from, int fromlen, char *to)
{
struct pathComponent *pc;
int elen = 0;
@@ -81,9 +80,9 @@ static int udf_symlink_filler(struct file *file, struct page *page)
char *p = kmap(page);
lock_kernel();
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
symlink = UDF_I_DATA(inode) + UDF_I_LENEATTR(inode);
else {
} else {
bh = sb_bread(inode->i_sb, udf_block_map(inode, 0));
if (!bh)
@@ -100,7 +99,8 @@ static int udf_symlink_filler(struct file *file, struct page *page)
kunmap(page);
unlock_page(page);
return 0;
out:
out:
unlock_kernel();
SetPageError(page);
kunmap(page);
@@ -112,5 +112,5 @@ static int udf_symlink_filler(struct file *file, struct page *page)
* symlinks can't do much...
*/
const struct address_space_operations udf_symlink_aops = {
.readpage = udf_symlink_filler,
.readpage = udf_symlink_filler,
};
+39 -74
View File
@@ -32,13 +32,11 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
kernel_lb_addr eloc, int8_t etype, uint32_t elen,
uint32_t nelen)
{
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;
kernel_lb_addr neloc = {};
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;
if (nelen) {
if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
@@ -70,7 +68,7 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
*/
void udf_truncate_tail_extent(struct inode *inode)
{
struct extent_position epos = { NULL, 0, {0, 0} };
struct extent_position epos = {};
kernel_lb_addr eloc;
uint32_t elen, nelen;
uint64_t lbcount = 0;
@@ -156,16 +154,16 @@ void udf_discard_prealloc(struct inode *inode)
extent_trunc(inode, &epos, eloc, etype, elen, 0);
if (!epos.bh) {
UDF_I_LENALLOC(inode) =
epos.offset - udf_file_entry_alloc_offset(inode);
epos.offset - udf_file_entry_alloc_offset(inode);
mark_inode_dirty(inode);
} else {
struct allocExtDesc *aed =
(struct allocExtDesc *)(epos.bh->b_data);
(struct allocExtDesc *)(epos.bh->b_data);
aed->lengthAllocDescs =
cpu_to_le32(epos.offset -
sizeof(struct allocExtDesc));
if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT)
|| UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
cpu_to_le32(epos.offset -
sizeof(struct allocExtDesc));
if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
UDF_SB_UDFREV(inode->i_sb) >= 0x0201)
udf_update_tag(epos.bh->b_data, epos.offset);
else
udf_update_tag(epos.bh->b_data,
@@ -182,7 +180,7 @@ void udf_discard_prealloc(struct inode *inode)
void udf_truncate_extents(struct inode *inode)
{
struct extent_position epos;
kernel_lb_addr eloc, neloc = { 0, 0 };
kernel_lb_addr eloc, neloc = {};
uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc;
int8_t etype;
struct super_block *sb = inode->i_sb;
@@ -198,9 +196,8 @@ void udf_truncate_extents(struct inode *inode)
BUG();
etype = inode_bmap(inode, first_block, &epos, &eloc, &elen, &offset);
byte_offset =
(offset << sb->s_blocksize_bits) +
(inode->i_size & (sb->s_blocksize - 1));
byte_offset = (offset << sb->s_blocksize_bits) +
(inode->i_size & (sb->s_blocksize - 1));
if (etype != -1) {
epos.offset -= adsize;
extent_trunc(inode, &epos, eloc, etype, elen, byte_offset);
@@ -215,9 +212,7 @@ void udf_truncate_extents(struct inode *inode)
else
lenalloc -= sizeof(struct allocExtDesc);
while ((etype =
udf_current_aext(inode, &epos, &eloc, &elen,
0)) != -1) {
while ((etype = udf_current_aext(inode, &epos, &eloc, &elen, 0)) != -1) {
if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
udf_write_aext(inode, &epos, neloc, nelen, 0);
if (indirect_ext_len) {
@@ -229,52 +224,35 @@ void udf_truncate_extents(struct inode *inode)
0, indirect_ext_len);
} else {
if (!epos.bh) {
UDF_I_LENALLOC(inode) =
lenalloc;
UDF_I_LENALLOC(inode) = lenalloc;
mark_inode_dirty(inode);
} else {
struct allocExtDesc *aed =
(struct allocExtDesc
*)(epos.bh->b_data);
(struct allocExtDesc *)(epos.bh->b_data);
aed->lengthAllocDescs =
cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG
(sb, UDF_FLAG_STRICT)
|| UDF_SB_UDFREV(sb) >=
0x0201)
udf_update_tag(epos.bh->
b_data,
lenalloc
+
sizeof
(struct
allocExtDesc));
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
UDF_SB_UDFREV(sb) >= 0x0201)
udf_update_tag(epos.bh->b_data,
lenalloc +
sizeof(struct allocExtDesc));
else
udf_update_tag(epos.bh->
b_data,
sizeof
(struct
allocExtDesc));
mark_buffer_dirty_inode(epos.bh,
inode);
udf_update_tag(epos.bh->b_data,
sizeof(struct allocExtDesc));
mark_buffer_dirty_inode(epos.bh, inode);
}
}
brelse(epos.bh);
epos.offset = sizeof(struct allocExtDesc);
epos.block = eloc;
epos.bh =
udf_tread(sb,
udf_get_lb_pblock(sb, eloc, 0));
epos.bh = udf_tread(sb, udf_get_lb_pblock(sb, eloc, 0));
if (elen)
indirect_ext_len = (elen +
sb->s_blocksize -
1) >> sb->
s_blocksize_bits;
indirect_ext_len = (elen + sb->s_blocksize -1) >>
sb->s_blocksize_bits;
else
indirect_ext_len = 1;
} else {
extent_trunc(inode, &epos, eloc, etype, elen,
0);
extent_trunc(inode, &epos, eloc, etype, elen, 0);
epos.offset += adsize;
}
}
@@ -292,16 +270,13 @@ void udf_truncate_extents(struct inode *inode)
struct allocExtDesc *aed =
(struct allocExtDesc *)(epos.bh->b_data);
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT)
|| UDF_SB_UDFREV(sb) >= 0x0201)
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
UDF_SB_UDFREV(sb) >= 0x0201)
udf_update_tag(epos.bh->b_data,
lenalloc +
sizeof(struct
allocExtDesc));
lenalloc + sizeof(struct allocExtDesc));
else
udf_update_tag(epos.bh->b_data,
sizeof(struct
allocExtDesc));
sizeof(struct allocExtDesc));
mark_buffer_dirty_inode(epos.bh, inode);
}
}
@@ -314,21 +289,14 @@ void udf_truncate_extents(struct inode *inode)
* no extent above inode->i_size => truncate is
* extending the file by 'offset' blocks.
*/
if ((!epos.bh
&& epos.offset ==
udf_file_entry_alloc_offset(inode)) || (epos.bh
&& epos.
offset ==
sizeof
(struct
allocExtDesc)))
{
if ((!epos.bh &&
epos.offset == udf_file_entry_alloc_offset(inode)) ||
(epos.bh && epos.offset == sizeof(struct allocExtDesc))) {
/* File has no extents at all or has empty last
* indirect extent! Create a fake extent... */
extent.extLocation.logicalBlockNum = 0;
extent.extLocation.partitionReferenceNum = 0;
extent.extLength =
EXT_NOT_RECORDED_NOT_ALLOCATED;
extent.extLength = EXT_NOT_RECORDED_NOT_ALLOCATED;
} else {
epos.offset -= adsize;
etype = udf_next_aext(inode, &epos,
@@ -337,10 +305,7 @@ void udf_truncate_extents(struct inode *inode)
extent.extLength |= etype << 30;
}
udf_extend_file(inode, &epos, &extent,
offset +
((inode->
i_size & (sb->s_blocksize - 1)) !=
0));
offset + ((inode->i_size & (sb->s_blocksize - 1)) != 0));
}
}
UDF_I_LENEXTENTS(inode) = inode->i_size;
+1 -1
View File
@@ -23,4 +23,4 @@ static inline struct udf_inode_info *UDF_I(struct inode *inode)
#define UDF_I_LAD(X) ( UDF_I(X)->i_ext.i_lad )
#define UDF_I_DATA(X) ( UDF_I(X)->i_ext.i_data )
#endif /* !defined(_LINUX_UDF_I_H) */
#endif /* !defined(_LINUX_UDF_I_H) */
+9 -17
View File
@@ -20,8 +20,8 @@
#define UDF_FLAG_VARCONV 8
#define UDF_FLAG_NLS_MAP 9
#define UDF_FLAG_UTF8 10
#define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */
#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
#define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */
#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
#define UDF_FLAG_GID_FORGET 13
#define UDF_FLAG_GID_IGNORE 14
@@ -41,8 +41,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
#define UDF_SB_FREE(X)\
{\
if (UDF_SB(X))\
{\
if (UDF_SB(X)) {\
kfree(UDF_SB_PARTMAPS(X));\
UDF_SB_PARTMAPS(X) = NULL;\
}\
@@ -51,13 +50,10 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
#define UDF_SB_ALLOC_PARTMAPS(X,Y)\
{\
UDF_SB_PARTMAPS(X) = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
if (UDF_SB_PARTMAPS(X) != NULL)\
{\
if (UDF_SB_PARTMAPS(X) != NULL) {\
UDF_SB_NUMPARTS(X) = Y;\
memset(UDF_SB_PARTMAPS(X), 0x00, sizeof(struct udf_part_map) * Y);\
}\
else\
{\
} else {\
UDF_SB_NUMPARTS(X) = 0;\
udf_error(X, __FUNCTION__, "Unable to allocate space for %d partition maps", Y);\
}\
@@ -72,15 +68,12 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\
else\
UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = vmalloc(size);\
if (UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap != NULL)\
{\
if (UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap != NULL) {\
memset(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap, 0x00, size);\
UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_block_bitmap =\
(struct buffer_head **)(UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap + 1);\
UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\
}\
else\
{\
} else {\
udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\
}\
}
@@ -90,8 +83,7 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
int i;\
int nr_groups = UDF_SB_BITMAP_NR_GROUPS(X,Y,Z);\
int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\
for (i=0; i<nr_groups; i++)\
{\
for (i = 0; i < nr_groups; i++) {\
if (UDF_SB_BITMAP(X,Y,Z,i))\
brelse(UDF_SB_BITMAP(X,Y,Z,i));\
}\
@@ -139,4 +131,4 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
#define UDF_SB_FLAGS(X) ( UDF_SB(X)->s_flags )
#define UDF_SB_VAT(X) ( UDF_SB(X)->s_vat )
#endif /* __LINUX_UDF_SB_H */
#endif /* __LINUX_UDF_SB_H */
+2 -2
View File
@@ -63,8 +63,8 @@ struct udf_vds_record {
};
struct generic_desc {
tag descTag;
__le32 volDescSeqNum;
tag descTag;
__le32 volDescSeqNum;
};
struct ustr {

Some files were not shown because too many files have changed in this diff Show More