Commit 5eefec79 authored by Ben Fennema's avatar Ben Fennema Committed by Linus Torvalds

[PATCH] udf patch for 2.5.7-pre1 (part 4/4)

This patch moves the udf spec header files into the fs/udf directory and
removes all the non-standard sized typedefs.
parent b2dffcdf
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "udfdecl.h" #include "udfdecl.h"
static Uint16 crc_table[256] = { static uint16_t crc_table[256] = {
0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U, 0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU, 0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U, 0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
...@@ -84,8 +84,8 @@ static Uint16 crc_table[256] = { ...@@ -84,8 +84,8 @@ static Uint16 crc_table[256] = {
* July 21, 1997 - Andrew E. Mileski * July 21, 1997 - Andrew E. Mileski
* Adapted from OSTA-UDF(tm) 1.50 standard. * Adapted from OSTA-UDF(tm) 1.50 standard.
*/ */
extern Uint16 extern uint16_t
udf_crc(Uint8 *data, Uint32 size, Uint16 crc) udf_crc(uint8_t *data, uint32_t size, uint16_t crc)
{ {
while (size--) while (size--)
crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8); crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
......
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1998-2000 Ben Fennema * (C) 1998-2001 Ben Fennema
* *
* HISTORY * HISTORY
* *
* 10/05/98 dgb Split directory operations into it's own file * 10/05/98 dgb Split directory operations into it's own file
* Implemented directory reads via do_udf_readdir * Implemented directory reads via do_udf_readdir
* 10/06/98 Made directory operations work! * 10/06/98 Made directory operations work!
* 11/17/98 Rewrote directory to support ICB_FLAG_AD_LONG * 11/17/98 Rewrote directory to support ICBTAG_FLAG_AD_LONG
* 11/25/98 blf Rewrote directory handling (readdir+lookup) to support reading * 11/25/98 blf Rewrote directory handling (readdir+lookup) to support reading
* across blocks. * across blocks.
* 12/12/98 Split out the lookup code to namei.c. bulk of directory * 12/12/98 Split out the lookup code to namei.c. bulk of directory
...@@ -31,16 +31,13 @@ ...@@ -31,16 +31,13 @@
#include "udfdecl.h" #include "udfdecl.h"
#if defined(__linux__) && defined(__KERNEL__)
#include <linux/version.h>
#include "udf_i.h"
#include "udf_sb.h"
#include <linux/string.h> #include <linux/string.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/udf_fs.h>
#endif #include "udf_i.h"
#include "udf_sb.h"
/* Prototypes for file operations */ /* Prototypes for file operations */
static int udf_readdir(struct file *, void *, filldir_t); static int udf_readdir(struct file *, void *, filldir_t);
...@@ -102,19 +99,19 @@ static int ...@@ -102,19 +99,19 @@ static int
do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *dirent) do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *dirent)
{ {
struct udf_fileident_bh fibh; struct udf_fileident_bh fibh;
struct FileIdentDesc *fi=NULL; struct fileIdentDesc *fi=NULL;
struct FileIdentDesc cfi; struct fileIdentDesc cfi;
int block, iblock; int block, iblock;
loff_t nf_pos = filp->f_pos - 1; loff_t nf_pos = filp->f_pos - 1;
int flen; int flen;
char fname[255]; char fname[255];
char *nameptr; char *nameptr;
Uint16 liu; uint16_t liu;
Uint8 lfi; uint8_t lfi;
loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
struct buffer_head * bh = NULL, * tmp, * bha[16]; struct buffer_head * bh = NULL, * tmp, * bha[16];
lb_addr bloc, eloc; lb_addr bloc, eloc;
Uint32 extoffset, elen, offset; uint32_t extoffset, elen, offset;
int i, num; int i, num;
unsigned int dt_type; unsigned int dt_type;
...@@ -126,15 +123,15 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -126,15 +123,15 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2), if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
&bloc, &extoffset, &eloc, &elen, &offset, &bh) == EXTENT_RECORDED_ALLOCATED) &bloc, &extoffset, &eloc, &elen, &offset, &bh) == (EXT_RECORDED_ALLOCATED >> 30))
{ {
offset >>= dir->i_sb->s_blocksize_bits; offset >>= dir->i_sb->s_blocksize_bits;
block = udf_get_lb_pblock(dir->i_sb, eloc, offset); block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
if ((++offset << dir->i_sb->s_blocksize_bits) < elen) if ((++offset << dir->i_sb->s_blocksize_bits) < elen)
{ {
if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_SHORT) if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
extoffset -= sizeof(short_ad); extoffset -= sizeof(short_ad);
else if (UDF_I_ALLOCTYPE(dir) == ICB_FLAG_AD_LONG) else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
extoffset -= sizeof(long_ad); extoffset -= sizeof(long_ad);
} }
else else
...@@ -198,7 +195,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -198,7 +195,7 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
{ {
int poffset; /* Unpaded ending offset */ int poffset; /* Unpaded ending offset */
poffset = fibh.soffset + sizeof(struct FileIdentDesc) + liu + lfi; poffset = fibh.soffset + sizeof(struct fileIdentDesc) + liu + lfi;
if (poffset >= lfi) if (poffset >= lfi)
nameptr = (char *)(fibh.ebh->b_data + poffset - lfi); nameptr = (char *)(fibh.ebh->b_data + poffset - lfi);
...@@ -210,19 +207,19 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d ...@@ -210,19 +207,19 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
} }
} }
if ( (cfi.fileCharacteristics & FILE_DELETED) != 0 ) if ( (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
{ {
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) ) if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE) )
continue; continue;
} }
if ( (cfi.fileCharacteristics & FILE_HIDDEN) != 0 ) if ( (cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
{ {
if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) ) if ( !UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE) )
continue; continue;
} }
if ( cfi.fileCharacteristics & FILE_PARENT ) if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
{ {
iblock = parent_ino(filp->f_dentry); iblock = parent_ino(filp->f_dentry);
flen = 2; flen = 2;
......
...@@ -18,33 +18,20 @@ ...@@ -18,33 +18,20 @@
#include "udfdecl.h" #include "udfdecl.h"
#if defined(__linux__) && defined(__KERNEL__)
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/udf_fs.h>
#else
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#endif
#ifdef __KERNEL__
Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size, uint8_t * udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
lb_addr fe_loc, int *pos, int *offset, struct buffer_head **bh, int *error) lb_addr fe_loc, int *pos, int *offset, struct buffer_head **bh, int *error)
{ {
int loffset = *offset; int loffset = *offset;
int block; int block;
Uint8 *ad; uint8_t *ad;
int remainder; int remainder;
*error = 0; *error = 0;
ad = (Uint8 *)(*bh)->b_data + *offset; ad = (uint8_t *)(*bh)->b_data + *offset;
*offset += ad_size; *offset += ad_size;
if (!ad) if (!ad)
...@@ -68,7 +55,7 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size, ...@@ -68,7 +55,7 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size,
ad = tmpad; ad = tmpad;
remainder = dir->i_sb->s_blocksize - loffset; remainder = dir->i_sb->s_blocksize - loffset;
memcpy((Uint8 *)ad, (*bh)->b_data + loffset, remainder); memcpy((uint8_t *)ad, (*bh)->b_data + loffset, remainder);
udf_release_data(*bh); udf_release_data(*bh);
block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos); block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
...@@ -77,21 +64,21 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size, ...@@ -77,21 +64,21 @@ Uint8 * udf_filead_read(struct inode *dir, Uint8 *tmpad, Uint8 ad_size,
if (!((*bh) = udf_tread(dir->i_sb, block))) if (!((*bh) = udf_tread(dir->i_sb, block)))
return NULL; return NULL;
memcpy((Uint8 *)ad + remainder, (*bh)->b_data, ad_size - remainder); memcpy((uint8_t *)ad + remainder, (*bh)->b_data, ad_size - remainder);
*offset = ad_size - remainder; *offset = ad_size - remainder;
} }
return ad; return ad;
} }
struct FileIdentDesc * struct fileIdentDesc *
udf_fileident_read(struct inode *dir, loff_t *nf_pos, udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct udf_fileident_bh *fibh, struct udf_fileident_bh *fibh,
struct FileIdentDesc *cfi, struct fileIdentDesc *cfi,
lb_addr *bloc, Uint32 *extoffset, lb_addr *bloc, uint32_t *extoffset,
lb_addr *eloc, Uint32 *elen, lb_addr *eloc, uint32_t *elen,
Uint32 *offset, struct buffer_head **bh) uint32_t *offset, struct buffer_head **bh)
{ {
struct FileIdentDesc *fi; struct fileIdentDesc *fi;
int i, num, block; int i, num, block;
struct buffer_head * tmp, * bha[16]; struct buffer_head * tmp, * bha[16];
...@@ -102,7 +89,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -102,7 +89,7 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
int lextoffset = *extoffset; int lextoffset = *extoffset;
if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) != if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
EXTENT_RECORDED_ALLOCATED) (EXT_RECORDED_ALLOCATED >> 30))
{ {
return NULL; return NULL;
} }
...@@ -159,14 +146,14 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -159,14 +146,14 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
if (fibh->eoffset <= dir->i_sb->s_blocksize) if (fibh->eoffset <= dir->i_sb->s_blocksize)
{ {
memcpy((Uint8 *)cfi, (Uint8 *)fi, sizeof(struct FileIdentDesc)); memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc));
} }
else if (fibh->eoffset > dir->i_sb->s_blocksize) else if (fibh->eoffset > dir->i_sb->s_blocksize)
{ {
int lextoffset = *extoffset; int lextoffset = *extoffset;
if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) != if (udf_next_aext(dir, bloc, extoffset, eloc, elen, bh, 1) !=
EXTENT_RECORDED_ALLOCATED) (EXT_RECORDED_ALLOCATED >> 30))
{ {
return NULL; return NULL;
} }
...@@ -186,15 +173,15 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -186,15 +173,15 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
if (!(fibh->ebh = udf_tread(dir->i_sb, block))) if (!(fibh->ebh = udf_tread(dir->i_sb, block)))
return NULL; return NULL;
if (sizeof(struct FileIdentDesc) > - fibh->soffset) if (sizeof(struct fileIdentDesc) > - fibh->soffset)
{ {
int fi_len; int fi_len;
memcpy((Uint8 *)cfi, (Uint8 *)fi, - fibh->soffset); memcpy((uint8_t *)cfi, (uint8_t *)fi, - fibh->soffset);
memcpy((Uint8 *)cfi - fibh->soffset, fibh->ebh->b_data, memcpy((uint8_t *)cfi - fibh->soffset, fibh->ebh->b_data,
sizeof(struct FileIdentDesc) + fibh->soffset); sizeof(struct fileIdentDesc) + fibh->soffset);
fi_len = (sizeof(struct FileIdentDesc) + cfi->lengthFileIdent + fi_len = (sizeof(struct fileIdentDesc) + cfi->lengthFileIdent +
le16_to_cpu(cfi->lengthOfImpUse) + 3) & ~3; 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);
...@@ -202,25 +189,22 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -202,25 +189,22 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
} }
else else
{ {
memcpy((Uint8 *)cfi, (Uint8 *)fi, sizeof(struct FileIdentDesc)); memcpy((uint8_t *)cfi, (uint8_t *)fi, sizeof(struct fileIdentDesc));
} }
} }
return fi; return fi;
} }
#endif
struct FileIdentDesc * struct fileIdentDesc *
udf_get_fileident(void * buffer, int bufsize, int * offset) udf_get_fileident(void * buffer, int bufsize, int * offset)
{ {
struct FileIdentDesc *fi; struct fileIdentDesc *fi;
int lengthThisIdent; int lengthThisIdent;
Uint8 * ptr; uint8_t * ptr;
int padlen; int padlen;
if ( (!buffer) || (!offset) ) { if ( (!buffer) || (!offset) ) {
#ifdef __KERNEL__
udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, offset); udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, offset);
#endif
return NULL; return NULL;
} }
...@@ -229,23 +213,21 @@ udf_get_fileident(void * buffer, int bufsize, int * offset) ...@@ -229,23 +213,21 @@ udf_get_fileident(void * buffer, int bufsize, int * offset)
if ( (*offset > 0) && (*offset < bufsize) ) { if ( (*offset > 0) && (*offset < bufsize) ) {
ptr += *offset; ptr += *offset;
} }
fi=(struct FileIdentDesc *)ptr; fi=(struct fileIdentDesc *)ptr;
if (le16_to_cpu(fi->descTag.tagIdent) != TID_FILE_IDENT_DESC) if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID)
{ {
#ifdef __KERNEL__ udf_debug("0x%x != TAG_IDENT_FID\n",
udf_debug("0x%x != TID_FILE_IDENT_DESC\n",
le16_to_cpu(fi->descTag.tagIdent)); le16_to_cpu(fi->descTag.tagIdent));
udf_debug("offset: %u sizeof: %lu bufsize: %u\n", udf_debug("offset: %u sizeof: %lu bufsize: %u\n",
*offset, (unsigned long)sizeof(struct FileIdentDesc), bufsize); *offset, (unsigned long)sizeof(struct fileIdentDesc), bufsize);
#endif
return NULL; return NULL;
} }
if ( (*offset + sizeof(struct FileIdentDesc)) > bufsize ) if ( (*offset + sizeof(struct fileIdentDesc)) > bufsize )
{ {
lengthThisIdent = sizeof(struct FileIdentDesc); lengthThisIdent = sizeof(struct fileIdentDesc);
} }
else else
lengthThisIdent = sizeof(struct FileIdentDesc) + lengthThisIdent = sizeof(struct fileIdentDesc) +
fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse); fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);
/* we need to figure padding, too! */ /* we need to figure padding, too! */
...@@ -261,29 +243,25 @@ extent_ad * ...@@ -261,29 +243,25 @@ extent_ad *
udf_get_fileextent(void * buffer, int bufsize, int * offset) udf_get_fileextent(void * buffer, int bufsize, int * offset)
{ {
extent_ad * ext; extent_ad * ext;
struct FileEntry *fe; struct fileEntry *fe;
Uint8 * ptr; uint8_t * ptr;
if ( (!buffer) || (!offset) ) if ( (!buffer) || (!offset) )
{ {
#ifdef __KERNEL__
printk(KERN_ERR "udf: udf_get_fileextent() invalidparms\n"); printk(KERN_ERR "udf: udf_get_fileextent() invalidparms\n");
#endif
return NULL; return NULL;
} }
fe = (struct FileEntry *)buffer; fe = (struct fileEntry *)buffer;
if ( le16_to_cpu(fe->descTag.tagIdent) != TID_FILE_ENTRY ) if ( le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE )
{ {
#ifdef __KERNEL__ udf_debug("0x%x != TAG_IDENT_FE\n",
udf_debug("0x%x != TID_FILE_ENTRY\n",
le16_to_cpu(fe->descTag.tagIdent)); le16_to_cpu(fe->descTag.tagIdent));
#endif
return NULL; return NULL;
} }
ptr=(Uint8 *)(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)) ) if ( (*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs)) )
{ {
...@@ -300,17 +278,15 @@ short_ad * ...@@ -300,17 +278,15 @@ short_ad *
udf_get_fileshortad(void * buffer, int maxoffset, int *offset, int inc) udf_get_fileshortad(void * buffer, int maxoffset, int *offset, int inc)
{ {
short_ad * sa; short_ad * sa;
Uint8 * ptr; uint8_t * ptr;
if ( (!buffer) || (!offset) ) if ( (!buffer) || (!offset) )
{ {
#ifdef __KERNEL__
printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n"); printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n");
#endif
return NULL; return NULL;
} }
ptr = (Uint8 *)buffer; ptr = (uint8_t *)buffer;
if ( (*offset > 0) && (*offset < maxoffset) ) if ( (*offset > 0) && (*offset < maxoffset) )
ptr += *offset; ptr += *offset;
...@@ -328,17 +304,15 @@ long_ad * ...@@ -328,17 +304,15 @@ long_ad *
udf_get_filelongad(void * buffer, int maxoffset, int * offset, int inc) udf_get_filelongad(void * buffer, int maxoffset, int * offset, int inc)
{ {
long_ad * la; long_ad * la;
Uint8 * ptr; uint8_t * ptr;
if ( (!buffer) || !(offset) ) if ( (!buffer) || !(offset) )
{ {
#ifdef __KERNEL__
printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n"); printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n");
#endif
return NULL; return NULL;
} }
ptr = (Uint8 *)buffer; ptr = (uint8_t *)buffer;
if ( (*offset > 0) && (*offset < maxoffset) ) if ( (*offset > 0) && (*offset < maxoffset) )
ptr += *offset; ptr += *offset;
......
This diff is collapsed.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1998-1999 Dave Boynton * (C) 1998-1999 Dave Boynton
* (C) 1998-2000 Ben Fennema * (C) 1998-2001 Ben Fennema
* (C) 1999-2000 Stelias Computing Inc * (C) 1999-2000 Stelias Computing Inc
* *
* HISTORY * HISTORY
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* 10/07/98 Switched to using generic_readpage, etc., like isofs * 10/07/98 Switched to using generic_readpage, etc., like isofs
* And it works! * And it works!
* 12/06/98 blf Added udf_file_read. uses generic_file_read for all cases but * 12/06/98 blf Added udf_file_read. uses generic_file_read for all cases but
* ICB_FLAG_AD_IN_ICB. * ICBTAG_FLAG_AD_IN_ICB.
* 04/06/99 64 bit file handling on 32 bit systems taken from ext2 file.c * 04/06/99 64 bit file handling on 32 bit systems taken from ext2 file.c
* 05/12/99 Preliminary file write support * 05/12/99 Preliminary file write support
*/ */
...@@ -157,7 +157,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf, ...@@ -157,7 +157,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf,
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
int err, pos; int err, pos;
if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
{ {
if (file->f_flags & O_APPEND) if (file->f_flags & O_APPEND)
pos = inode->i_size; pos = inode->i_size;
...@@ -168,7 +168,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf, ...@@ -168,7 +168,7 @@ static ssize_t udf_file_write(struct file * file, const char * buf,
pos + count)) pos + count))
{ {
udf_expand_file_adinicb(inode, pos + count, &err); udf_expand_file_adinicb(inode, pos + count, &err);
if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
{ {
udf_debug("udf_expand_adinicb: err=%d\n", err); udf_debug("udf_expand_adinicb: err=%d\n", err);
return err; return err;
...@@ -233,7 +233,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -233,7 +233,7 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
int result = -EINVAL; int result = -EINVAL;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
long_ad eaicb; long_ad eaicb;
Uint8 *ea = NULL; uint8_t *ea = NULL;
if ( permission(inode, MAY_READ) != 0 ) if ( permission(inode, MAY_READ) != 0 )
{ {
...@@ -280,18 +280,18 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -280,18 +280,18 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
if (UDF_I_EXTENDED_FE(inode) == 0) if (UDF_I_EXTENDED_FE(inode) == 0)
{ {
struct FileEntry *fe; struct fileEntry *fe;
fe = (struct FileEntry *)bh->b_data; fe = (struct fileEntry *)bh->b_data;
eaicb = lela_to_cpu(fe->extendedAttrICB); eaicb = lela_to_cpu(fe->extendedAttrICB);
if (UDF_I_LENEATTR(inode)) if (UDF_I_LENEATTR(inode))
ea = fe->extendedAttr; ea = fe->extendedAttr;
} }
else else
{ {
struct ExtendedFileEntry *efe; struct extendedFileEntry *efe;
efe = (struct ExtendedFileEntry *)bh->b_data; efe = (struct extendedFileEntry *)bh->b_data;
eaicb = lela_to_cpu(efe->extendedAttrICB); eaicb = lela_to_cpu(efe->extendedAttrICB);
if (UDF_I_LENEATTR(inode)) if (UDF_I_LENEATTR(inode))
ea = efe->extendedAttr; ea = efe->extendedAttr;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1999-2000 Ben Fennema * (C) 1999-2001 Ben Fennema
* (C) 1999-2000 Stelias Computing Inc * (C) 1999-2000 Stelias Computing Inc
* *
* HISTORY * HISTORY
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1998-2000 Ben Fennema * (C) 1998-2001 Ben Fennema
* *
* HISTORY * HISTORY
* *
...@@ -74,7 +74,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -74,7 +74,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
struct super_block *sb; struct super_block *sb;
struct inode * inode; struct inode * inode;
int block; int block;
Uint32 start = UDF_I_LOCATION(dir).logicalBlockNum; uint32_t start = UDF_I_LOCATION(dir).logicalBlockNum;
sb = dir->i_sb; sb = dir->i_sb;
inode = new_inode(sb); inode = new_inode(sb);
...@@ -102,9 +102,9 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -102,9 +102,9 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
UDF_I_STRAT4096(inode) = 0; UDF_I_STRAT4096(inode) = 0;
if (UDF_SB_LVIDBH(sb)) if (UDF_SB_LVIDBH(sb))
{ {
struct LogicalVolHeaderDesc *lvhd; struct logicalVolHeaderDesc *lvhd;
Uint64 uniqueID; uint64_t uniqueID;
lvhd = (struct LogicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse); lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse);
if (S_ISDIR(mode)) if (S_ISDIR(mode))
UDF_SB_LVIDIU(sb)->numDirs = 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);
...@@ -143,11 +143,11 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -143,11 +143,11 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
else else
UDF_I_EXTENDED_FE(inode) = 0; UDF_I_EXTENDED_FE(inode) = 0;
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_IN_ICB; UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_SHORT; UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
else else
UDF_I_ALLOCTYPE(inode) = ICB_FLAG_AD_LONG; UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
inode->i_mtime = inode->i_atime = inode->i_ctime = inode->i_mtime = inode->i_atime = inode->i_ctime =
UDF_I_CRTIME(inode) = CURRENT_TIME; UDF_I_CRTIME(inode) = CURRENT_TIME;
UDF_I_UMTIME(inode) = UDF_I_UCTIME(inode) = UDF_I_UMTIME(inode) = UDF_I_UCTIME(inode) =
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1999-2000 Ben Fennema * (C) 1999-2001 Ben Fennema
* *
* HISTORY * HISTORY
* *
......
This diff is collapsed.
This diff is collapsed.
/*
* osta_udf.h
*
* This file is based on OSTA UDF(tm) 2.01 (March 15, 2000)
* http://www.osta.org
*
* Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU Public License ("GPL").
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "ecma_167.h"
#ifndef _OSTA_UDF_H
#define _OSTA_UDF_H 1
/* OSTA CS0 Charspec (UDF 2.01 2.1.2) */
#define UDF_CHAR_SET_TYPE 0
#define UDF_CHAR_SET_INFO "OSTA Compressed Unicode"
/* Entity Identifier (UDF 2.01 2.1.5) */
/* Identifiers (UDF 2.01 2.1.5.2) */
#define UDF_ID_DEVELOPER "*Linux UDFFS"
#define UDF_ID_COMPLIANT "*OSTA UDF Compliant"
#define UDF_ID_LV_INFO "*UDF LV Info"
#define UDF_ID_FREE_EA "*UDF FreeEASpace"
#define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace"
#define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info"
#define UDF_ID_OS2_EA "*UDF OS/2 EA"
#define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength"
#define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo"
#define UDF_ID_MAC_FINDER "*UDF Mac FinderInfo"
#define UDF_ID_MAC_UNIQUE "*UDF Mac UniqueIDTable"
#define UDF_ID_MAC_RESOURCE "*UDF Mac ResourceFork"
#define UDF_ID_VIRTUAL "*UDF Virtual Partition"
#define UDF_ID_SPARABLE "*UDF Sparable Partition"
#define UDF_ID_ALLOC "*UDF Virtual Alloc Tbl"
#define UDF_ID_SPARING "*UDF Sparing Table"
/* Identifier Suffix (UDF 2.01 2.1.5.3) */
#define IS_DF_HARD_WRITE_PROTECT 0x01
#define IS_DF_SOFT_WRITE_PROTECT 0x02
struct UDFIdentSuffix
{
uint16_t 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];
} __attribute__ ((packed));
struct appIdentSuffix
{
uint8_t impUse[8];
} __attribute__ ((packed));
/* Logical Volume Integrity Descriptor (UDF 2.01 2.2.6) */
/* Implementation Use (UDF 2.01 2.2.6.4) */
struct logicalVolIntegrityDescImpUse
{
regid impIdent;
uint32_t numFiles;
uint32_t numDirs;
uint16_t minUDFReadRev;
uint16_t minUDFWriteRev;
uint16_t maxUDFWriteRev;
uint8_t impUse[0];
} __attribute__ ((packed));
/* Implementation Use Volume Descriptor (UDF 2.01 2.2.7) */
/* Implementation Use (UDF 2.01 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];
} __attribute__ ((packed));
struct udfPartitionMap2
{
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
} __attribute__ ((packed));
/* Virtual Partition Map (UDF 2.01 2.2.8) */
struct virtualPartitionMap
{
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
uint8_t reserved2[24];
} __attribute__ ((packed));
/* Sparable Partition Map (UDF 2.01 2.2.9) */
struct sparablePartitionMap
{
uint8_t partitionMapType;
uint8_t partitionMapLength;
uint8_t reserved1[2];
regid partIdent;
uint16_t volSeqNum;
uint16_t partitionNum;
uint16_t packetLength;
uint8_t numSparingTables;
uint8_t reserved2[1];
uint32_t sizeSparingTable;
uint32_t locSparingTable[4];
} __attribute__ ((packed));
/* Virtual Allocation Table (UDF 1.5 2.2.10) */
struct virtualAllocationTable15
{
uint32_t VirtualSector[0];
regid ident;
uint32_t previousVATICB;
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT15 0x00U
/* Virtual Allocation Table (UDF 2.01 2.2.10) */
struct virtualAllocationTable20
{
uint16_t lengthHeader;
uint16_t lengthImpUse;
dstring logicalVolIdent[128];
uint32_t previousVatICBLoc;
uint32_t numFIDSFiles;
uint32_t numFIDSDirectories;
uint16_t minReadRevision;
uint16_t minWriteRevision;
uint16_t maxWriteRevision;
uint16_t reserved;
uint8_t impUse[0];
uint32_t vatEntry[0];
} __attribute__ ((packed));
#define ICBTAG_FILE_TYPE_VAT20 0xF8U
/* Sparing Table (UDF 2.01 2.2.11) */
struct sparingEntry
{
uint32_t origLocation;
uint32_t mappedLocation;
} __attribute__ ((packed));
struct sparingTable
{
tag descTag;
regid sparingIdent;
uint16_t reallocationTableLen;
uint16_t reserved;
uint32_t sequenceNum;
struct sparingEntry
mapEntry[0];
} __attribute__ ((packed));
/* struct long_ad ICB - ADImpUse (UDF 2.01 2.2.4.3) */
struct allocDescImpUse
{
uint16_t flags;
uint8_t impUse[4];
} __attribute__ ((packed));
#define AD_IU_EXT_ERASED 0x0001
/* Real-Time Files (UDF 2.01 6.11) */
#define ICBTAG_FILE_TYPE_REALTIME 0xF9U
/* Implementation Use Extended Attribute (UDF 2.01 3.3.4.5) */
/* FreeEASpace (UDF 2.01 3.3.4.5.1.1) */
struct freeEaSpace
{
uint16_t headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
/* DVD Copyright Management Information (UDF 2.01 3.3.4.5.1.2) */
struct DVDCopyrightImpUse
{
uint16_t headerChecksum;
uint8_t CGMSInfo;
uint8_t dataType;
uint8_t protectionSystemInfo[4];
} __attribute__ ((packed));
/* Application Use Extended Attribute (UDF 2.01 3.3.4.6) */
/* FreeAppEASpace (UDF 2.01 3.3.4.6.1) */
struct freeAppEASpace
{
uint16_t headerChecksum;
uint8_t freeEASpace[0];
} __attribute__ ((packed));
/* UDF Defined System Stream (UDF 2.01 3.3.7) */
#define UDF_ID_UNIQUE_ID "*UDF Unique ID Mapping Data"
#define UDF_ID_NON_ALLOC "*UDF Non-Allocatable Space"
#define UDF_ID_POWER_CAL "*UDF Power Cal Table"
#define UDF_ID_BACKUP "*UDF Backup"
/* Operating System Identifiers (UDF 2.01 6.3) */
#define UDF_OS_CLASS_UNDEF 0x00U
#define UDF_OS_CLASS_DOS 0x01U
#define UDF_OS_CLASS_OS2 0x02U
#define UDF_OS_CLASS_MAC 0x03U
#define UDF_OS_CLASS_UNIX 0x04U
#define UDF_OS_CLASS_WIN9X 0x05U
#define UDF_OS_CLASS_WINNT 0x06U
#define UDF_OS_CLASS_OS400 0x07U
#define UDF_OS_CLASS_BEOS 0x08U
#define UDF_OS_CLASS_WINCE 0x09U
#define UDF_OS_ID_UNDEF 0x00U
#define UDF_OS_ID_DOS 0x00U
#define UDF_OS_ID_OS2 0x00U
#define UDF_OS_ID_MAC 0x00U
#define UDF_OS_ID_UNIX 0x00U
#define UDF_OS_ID_AIX 0x01U
#define UDF_OS_ID_SOLARIS 0x02U
#define UDF_OS_ID_HPUX 0x03U
#define UDF_OS_ID_IRIX 0x04U
#define UDF_OS_ID_LINUX 0x05U
#define UDF_OS_ID_MKLINUX 0x06U
#define UDF_OS_ID_FREEBSD 0x07U
#define UDF_OS_ID_WIN9X 0x00U
#define UDF_OS_ID_WINNT 0x00U
#define UDF_OS_ID_OS400 0x00U
#define UDF_OS_ID_BEOS 0x00U
#define UDF_OS_ID_WINCE 0x00U
#endif /* _OSTA_UDF_H */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1998-2000 Ben Fennema * (C) 1998-2001 Ben Fennema
* *
* HISTORY * HISTORY
* *
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <linux/udf_fs.h> #include <linux/udf_fs.h>
#include <linux/slab.h> #include <linux/slab.h>
inline Uint32 udf_get_pblock(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset) 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)) if (partition >= UDF_SB_NUMPARTS(sb))
{ {
...@@ -46,14 +46,14 @@ inline Uint32 udf_get_pblock(struct super_block *sb, Uint32 block, Uint16 partit ...@@ -46,14 +46,14 @@ inline Uint32 udf_get_pblock(struct super_block *sb, Uint32 block, Uint16 partit
return UDF_SB_PARTROOT(sb, partition) + block + offset; return UDF_SB_PARTROOT(sb, partition) + block + offset;
} }
Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset) uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
Uint32 newblock; uint32_t newblock;
Uint32 index; uint32_t index;
Uint32 loc; uint32_t loc;
index = (sb->s_blocksize - UDF_SB_TYPEVIRT(sb,partition).s_start_offset) / sizeof(Uint32); 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) if (block > UDF_SB_TYPEVIRT(sb,partition).s_num_entries)
{ {
...@@ -65,13 +65,13 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit ...@@ -65,13 +65,13 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
if (block >= index) if (block >= index)
{ {
block -= index; block -= index;
newblock = 1 + (block / (sb->s_blocksize / sizeof(Uint32))); newblock = 1 + (block / (sb->s_blocksize / sizeof(uint32_t)));
index = block % (sb->s_blocksize / sizeof(Uint32)); index = block % (sb->s_blocksize / sizeof(uint32_t));
} }
else else
{ {
newblock = 0; newblock = 0;
index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(Uint32) + block; index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(uint32_t) + block;
} }
loc = udf_block_map(UDF_SB_VAT(sb), newblock); loc = udf_block_map(UDF_SB_VAT(sb), newblock);
...@@ -83,7 +83,7 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit ...@@ -83,7 +83,7 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
loc = le32_to_cpu(((Uint32 *)bh->b_data)[index]); loc = le32_to_cpu(((uint32_t *)bh->b_data)[index]);
udf_release_data(bh); udf_release_data(bh);
...@@ -96,22 +96,22 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit ...@@ -96,22 +96,22 @@ Uint32 udf_get_pblock_virt15(struct super_block *sb, Uint32 block, Uint16 partit
return udf_get_pblock(sb, loc, UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum, offset); return udf_get_pblock(sb, loc, UDF_I_LOCATION(UDF_SB_VAT(sb)).partitionReferenceNum, offset);
} }
inline Uint32 udf_get_pblock_virt20(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset) inline uint32_t udf_get_pblock_virt20(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
{ {
return udf_get_pblock_virt15(sb, block, partition, offset); return udf_get_pblock_virt15(sb, block, partition, offset);
} }
Uint32 udf_get_pblock_spar15(struct super_block *sb, Uint32 block, Uint16 partition, Uint32 offset) uint32_t udf_get_pblock_spar15(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset)
{ {
int i; int i;
struct SparingTable *st = NULL; struct sparingTable *st = NULL;
Uint32 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++) for (i=0; i<4; i++)
{ {
if (UDF_SB_TYPESPAR(sb,partition).s_spar_map[i] != NULL) 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; st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,partition).s_spar_map[i]->b_data;
break; break;
} }
} }
...@@ -137,9 +137,9 @@ Uint32 udf_get_pblock_spar15(struct super_block *sb, Uint32 block, Uint16 partit ...@@ -137,9 +137,9 @@ Uint32 udf_get_pblock_spar15(struct super_block *sb, Uint32 block, Uint16 partit
int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
{ {
struct udf_sparing_data *sdata; struct udf_sparing_data *sdata;
struct SparingTable *st = NULL; struct sparingTable *st = NULL;
SparingEntry mapEntry; struct sparingEntry mapEntry;
Uint32 packet; uint32_t packet;
int i, j, k, l; int i, j, k, l;
for (i=0; i<UDF_SB_NUMPARTS(sb); i++) for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
...@@ -154,7 +154,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) ...@@ -154,7 +154,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
{ {
if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL) if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL)
{ {
st = (struct SparingTable *)sdata->s_spar_map[j]->b_data; st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
break; break;
} }
} }
...@@ -170,9 +170,9 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) ...@@ -170,9 +170,9 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
{ {
if (sdata->s_spar_map[j]) if (sdata->s_spar_map[j])
{ {
st = (struct SparingTable *)sdata->s_spar_map[j]->b_data; st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
st->mapEntry[k].origLocation = cpu_to_le32(packet); st->mapEntry[k].origLocation = cpu_to_le32(packet);
udf_update_tag((char *)st, sizeof(struct SparingTable) + st->reallocationTableLen * sizeof(SparingEntry)); udf_update_tag((char *)st, sizeof(struct sparingTable) + st->reallocationTableLen * sizeof(struct sparingEntry));
mark_buffer_dirty(sdata->s_spar_map[j]); mark_buffer_dirty(sdata->s_spar_map[j]);
} }
} }
...@@ -197,12 +197,12 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) ...@@ -197,12 +197,12 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
{ {
if (sdata->s_spar_map[j]) if (sdata->s_spar_map[j])
{ {
st = (struct SparingTable *)sdata->s_spar_map[j]->b_data; st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
mapEntry = st->mapEntry[l]; mapEntry = st->mapEntry[l];
mapEntry.origLocation = cpu_to_le32(packet); mapEntry.origLocation = cpu_to_le32(packet);
memmove(&st->mapEntry[k+1], &st->mapEntry[k], (l-k)*sizeof(SparingEntry)); memmove(&st->mapEntry[k+1], &st->mapEntry[k], (l-k)*sizeof(struct sparingEntry));
st->mapEntry[k] = mapEntry; st->mapEntry[k] = mapEntry;
udf_update_tag((char *)st, sizeof(struct SparingTable) + st->reallocationTableLen * sizeof(SparingEntry)); udf_update_tag((char *)st, sizeof(struct sparingTable) + st->reallocationTableLen * sizeof(struct sparingEntry));
mark_buffer_dirty(sdata->s_spar_map[j]); mark_buffer_dirty(sdata->s_spar_map[j]);
} }
} }
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* ftp://prep.ai.mit.edu/pub/gnu/GPL * ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
* *
* (C) 1998-2000 Ben Fennema * (C) 1998-2001 Ben Fennema
* (C) 1999 Stelias Computing Inc * (C) 1999 Stelias Computing Inc
* *
* HISTORY * HISTORY
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
static void udf_pc_to_char(char *from, int fromlen, char *to) static void udf_pc_to_char(char *from, int fromlen, char *to)
{ {
struct PathComponent *pc; struct pathComponent *pc;
int elen = 0; int elen = 0;
char *p = to; char *p = to;
while (elen < fromlen) while (elen < fromlen)
{ {
pc = (struct PathComponent *)(from + elen); pc = (struct pathComponent *)(from + elen);
switch (pc->componentType) switch (pc->componentType)
{ {
case 1: case 1:
...@@ -69,7 +69,7 @@ static void udf_pc_to_char(char *from, int fromlen, char *to) ...@@ -69,7 +69,7 @@ static void udf_pc_to_char(char *from, int fromlen, char *to)
p += pc->lengthComponentIdent; p += pc->lengthComponentIdent;
*p++ = '/'; *p++ = '/';
} }
elen += sizeof(struct PathComponent) + pc->lengthComponentIdent; elen += sizeof(struct pathComponent) + pc->lengthComponentIdent;
} }
if (p > to+1) if (p > to+1)
p[-1] = '\0'; p[-1] = '\0';
...@@ -86,7 +86,7 @@ static int udf_symlink_filler(struct file *file, struct page *page) ...@@ -86,7 +86,7 @@ static int udf_symlink_filler(struct file *file, struct page *page)
char *p = kmap(page); char *p = kmap(page);
lock_kernel(); lock_kernel();
if (UDF_I_ALLOCTYPE(inode) == ICB_FLAG_AD_IN_ICB) if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB)
{ {
bh = udf_tread(inode->i_sb, inode->i_ino); bh = udf_tread(inode->i_sb, inode->i_ino);
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ static inline struct udf_inode_info *UDF_I(struct inode *inode) ...@@ -13,7 +13,7 @@ static inline struct udf_inode_info *UDF_I(struct inode *inode)
#define UDF_I_LENEXTENTS(X) ( UDF_I(X)->i_lenExtents ) #define UDF_I_LENEXTENTS(X) ( UDF_I(X)->i_lenExtents )
#define UDF_I_UNIQUE(X) ( UDF_I(X)->i_unique ) #define UDF_I_UNIQUE(X) ( UDF_I(X)->i_unique )
#define UDF_I_ALLOCTYPE(X) ( UDF_I(X)->i_alloc_type ) #define UDF_I_ALLOCTYPE(X) ( UDF_I(X)->i_alloc_type )
#define UDF_I_EXTENDED_FE(X)( UDF_I(X)->i_extended_fe ) #define UDF_I_EXTENDED_FE(X) ( UDF_I(X)->i_extended_fe )
#define UDF_I_STRAT4096(X) ( UDF_I(X)->i_strat_4096 ) #define UDF_I_STRAT4096(X) ( UDF_I(X)->i_strat_4096 )
#define UDF_I_NEW_INODE(X) ( UDF_I(X)->i_new_inode ) #define UDF_I_NEW_INODE(X) ( UDF_I(X)->i_new_inode )
#define UDF_I_NEXT_ALLOC_BLOCK(X) ( UDF_I(X)->i_next_alloc_block ) #define UDF_I_NEXT_ALLOC_BLOCK(X) ( UDF_I(X)->i_next_alloc_block )
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\ #define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
{\ {\
int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct SpaceBitmapDesc) << 3) +\ int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct spaceBitmapDesc) << 3) +\
((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\ ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\
UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(sizeof(struct udf_bitmap) +\ UDF_SB_PARTMAPS(X)[(Y)].Z.s_bitmap = kmalloc(sizeof(struct udf_bitmap) +\
sizeof(struct buffer_head *) * nr_groups,\ sizeof(struct buffer_head *) * nr_groups,\
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
#define UDF_SB_ANCHOR(X) ( UDF_SB(X)->s_anchor ) #define UDF_SB_ANCHOR(X) ( UDF_SB(X)->s_anchor )
#define UDF_SB_LASTBLOCK(X) ( UDF_SB(X)->s_lastblock ) #define UDF_SB_LASTBLOCK(X) ( UDF_SB(X)->s_lastblock )
#define UDF_SB_LVIDBH(X) ( UDF_SB(X)->s_lvidbh ) #define UDF_SB_LVIDBH(X) ( UDF_SB(X)->s_lvidbh )
#define UDF_SB_LVID(X) ( (struct LogicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data ) #define UDF_SB_LVID(X) ( (struct logicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
#define UDF_SB_LVIDIU(X) ( (struct LogicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(Uint32)/sizeof(Uint8)]) ) #define UDF_SB_LVIDIU(X) ( (struct logicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(uint32_t)/sizeof(uint8_t)]) )
#define UDF_SB_UMASK(X) ( UDF_SB(X)->s_umask ) #define UDF_SB_UMASK(X) ( UDF_SB(X)->s_umask )
#define UDF_SB_GID(X) ( UDF_SB(X)->s_gid ) #define UDF_SB_GID(X) ( UDF_SB(X)->s_gid )
......
This diff is collapsed.
#ifndef __UDF_ENDIAN_H #ifndef __UDF_ENDIAN_H
#define __UDF_ENDIAN_H #define __UDF_ENDIAN_H
#ifndef __KERNEL__
#include <sys/types.h>
#if __BYTE_ORDER == 0
#error "__BYTE_ORDER must be defined"
#elif __BYTE_ORDER == __BIG_ENDIAN
#define le16_to_cpu(x) \
((Uint16)((((Uint16)(x) & 0x00FFU) << 8) | \
(((Uint16)(x) & 0xFF00U) >> 8)))
#define le32_to_cpu(x) \
((Uint32)((((Uint32)(x) & 0x000000FFU) << 24) | \
(((Uint32)(x) & 0x0000FF00U) << 8) | \
(((Uint32)(x) & 0x00FF0000U) >> 8) | \
(((Uint32)(x) & 0xFF000000U) >> 24)))
#define le64_to_cpu(x) \
((Uint64)((((Uint64)(x) & 0x00000000000000FFULL) << 56) | \
(((Uint64)(x) & 0x000000000000FF00ULL) << 40) | \
(((Uint64)(x) & 0x0000000000FF0000ULL) << 24) | \
(((Uint64)(x) & 0x00000000FF000000ULL) << 8) | \
(((Uint64)(x) & 0x000000FF00000000ULL) >> 8) | \
(((Uint64)(x) & 0x0000FF0000000000ULL) >> 24) | \
(((Uint64)(x) & 0x00FF000000000000ULL) >> 40) | \
(((Uint64)(x) & 0xFF00000000000000ULL) >> 56)))
#define cpu_to_le16(x) (le16_to_cpu(x))
#define cpu_to_le32(x) (le32_to_cpu(x))
#define cpu_to_le64(x) (le64_to_cpu(x))
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
#define le16_to_cpu(x) (x)
#define le32_to_cpu(x) (x)
#define le64_to_cpu(x) (x)
#define cpu_to_le16(x) (x)
#define cpu_to_le32(x) (x)
#define cpu_to_le64(x) (x)
#endif /* __BYTE_ORDER == 0 */
#include <string.h>
#else /* __KERNEL__ */
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/string.h> #include <linux/string.h>
#endif /* ! __KERNEL__ */
static inline lb_addr lelb_to_cpu(lb_addr in) static inline lb_addr lelb_to_cpu(lb_addr in)
{ {
lb_addr out; lb_addr out;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -31,14 +31,14 @@ ...@@ -31,14 +31,14 @@
* *
*/ */
#if !defined(_LINUX_UDF_FS_H) #ifndef _UDF_FS_H
#define _LINUX_UDF_FS_H #define _UDF_FS_H 1
#define UDF_PREALLOCATE #define UDF_PREALLOCATE
#define UDF_DEFAULT_PREALLOC_BLOCKS 8 #define UDF_DEFAULT_PREALLOC_BLOCKS 8
#define UDFFS_DATE "2001/10/10" #define UDFFS_DATE "2002/03/11"
#define UDFFS_VERSION "0.9.5" #define UDFFS_VERSION "0.9.6"
#if !defined(UDFFS_RW) #if !defined(UDFFS_RW)
...@@ -66,4 +66,4 @@ ...@@ -66,4 +66,4 @@
#define udf_info(f, a...) \ #define udf_info(f, a...) \
printk (KERN_INFO "UDF-fs INFO " f, ##a); printk (KERN_INFO "UDF-fs INFO " f, ##a);
#endif /* !defined(_LINUX_UDF_FS_H) */ #endif /* _UDF_FS_H */
This diff is collapsed.
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* Each contributing author retains all rights to their own work. * Each contributing author retains all rights to their own work.
*/ */
#if !defined(_LINUX_UDF_FS_SB_H) #ifndef _UDF_FS_SB_H
#define _LINUX_UDF_FS_SB_H #define _UDF_FS_SB_H 1
#pragma pack(1) #pragma pack(1)
...@@ -115,4 +115,4 @@ struct udf_sb_info ...@@ -115,4 +115,4 @@ struct udf_sb_info
struct inode *s_vat; struct inode *s_vat;
}; };
#endif /* !defined(_LINUX_UDF_FS_SB_H) */ #endif /* _UDF_FS_SB_H */
This diff is collapsed.
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