Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb00ea35 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds
Browse files

UDF: coding style conversion - lindent



This patch converts UDF coding style to kernel coding style using Lindent.

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Cc: Jan Kara <jack@ucw.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 95a631e2
Loading
Loading
Loading
Loading
+363 −346

File changed.

Preview size limit exceeded, changes collapsed.

+9 −10
Original line number Diff line number Diff line
@@ -79,8 +79,7 @@ static uint16_t crc_table[256] = {
 *	July 21, 1997 - Andrew E. Mileski
 *	Adapted from OSTA-UDF(tm) 1.50 standard.
 */
uint16_t
udf_crc(uint8_t *data, uint32_t size, uint16_t crc)
uint16_t udf_crc(uint8_t * data, uint32_t size, uint16_t crc)
{
	while (size--)
		crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
+63 −69
Original line number Diff line number Diff line
@@ -82,10 +82,9 @@ 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 (filp->f_pos == 0) {
		if (filldir(dirent, ".", 1, filp->f_pos, dir->i_ino, DT_DIR) <
		    0) {
			unlock_kernel();
			return 0;
		}
@@ -98,7 +97,8 @@ int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
}

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 fileIdentDesc *fi = NULL;
@@ -125,65 +125,61 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
	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;
	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))
	{
			    &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 ((++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)))
		{
		if (!(fibh.sbh = fibh.ebh = udf_tread(dir->i_sb, block))) {
			brelse(epos.bh);
			return -EIO;
		}

		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;
			for (num=0; i>0; i--)
			{
				block = udf_get_lb_pblock(dir->i_sb, eloc, offset+i);
				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);
				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);
			}
			if (num)
			{
			if (num) {
				ll_rw_block(READA, num, bha);
				for (i = 0; i < num; i++)
					brelse(bha[i]);
			}
		}
	}
	else
	{
	} else {
		brelse(epos.bh);
		return -ENOENT;
	}

	while ( nf_pos < size )
	{
	while (nf_pos < size) {
		filp->f_pos = nf_pos + 1;

		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, &elen, &offset);
		fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
					&elen, &offset);

		if (!fi)
		{
		if (!fi) {
			if (fibh.sbh != fibh.ebh)
				brelse(fibh.ebh);
			brelse(fibh.sbh);
@@ -196,43 +192,41 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d

		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
			{
				nameptr =
				    (char *)(fibh.ebh->b_data + poffset - lfi);
			else {
				nameptr = fname;
				memcpy(nameptr, fi->fileIdent + liu, lfi - poffset);
				memcpy(nameptr + lfi - poffset, fibh.ebh->b_data, poffset);
				memcpy(nameptr, fi->fileIdent + liu,
				       lfi - poffset);
				memcpy(nameptr + lfi - poffset,
				       fibh.ebh->b_data, poffset);
			}
		}

		if ( (cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0 )
		{
		if ((cfi.fileCharacteristics & FID_FILE_CHAR_DELETED) != 0) {
			if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNDELETE))
				continue;
		}

		if ( (cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0 )
		{
		if ((cfi.fileCharacteristics & FID_FILE_CHAR_HIDDEN) != 0) {
			if (!UDF_QUERY_FLAG(dir->i_sb, UDF_FLAG_UNHIDE))
				continue;
		}

		if ( cfi.fileCharacteristics & FID_FILE_CHAR_PARENT )
		{
		if (cfi.fileCharacteristics & FID_FILE_CHAR_PARENT) {
			iblock = parent_ino(filp->f_path.dentry);
			flen = 2;
			memcpy(fname, "..", flen);
			dt_type = DT_DIR;
		}
		else
		{
		} else {
			kernel_lb_addr tloc = lelb_to_cpu(cfi.icb.extLocation);

			iblock = udf_get_lb_pblock(dir->i_sb, tloc, 0);
@@ -240,10 +234,10 @@ do_udf_readdir(struct inode * dir, struct file *filp, filldir_t filldir, void *d
			dt_type = DT_UNKNOWN;
		}

		if (flen)
		{
			if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0)
			{
		if (flen) {
			if (filldir
			    (dirent, fname, flen, filp->f_pos, iblock,
			     dt_type) < 0) {
				if (fibh.sbh != fibh.ebh)
					brelse(fibh.ebh);
				brelse(fibh.sbh);
+99 −108
Original line number Diff line number Diff line
@@ -19,10 +19,10 @@
#include <linux/buffer_head.h>

#if 0
static uint8_t *
udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
		kernel_lb_addr fe_loc, int *pos, int *offset,
		struct buffer_head **bh, int *error)
static uint8_t *udf_filead_read(struct inode *dir, uint8_t * tmpad,
				uint8_t ad_size, kernel_lb_addr fe_loc,
				int *pos, int *offset, struct buffer_head **bh,
				int *error)
{
	int loffset = *offset;
	int block;
@@ -34,24 +34,20 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
	ad = (uint8_t *) (*bh)->b_data + *offset;
	*offset += ad_size;

	if (!ad)
	{
	if (!ad) {
		brelse(*bh);
		*error = 1;
		return NULL;
	}

	if (*offset == dir->i_sb->s_blocksize)
	{
	if (*offset == dir->i_sb->s_blocksize) {
		brelse(*bh);
		block = udf_get_lb_pblock(dir->i_sb, fe_loc, ++*pos);
		if (!block)
			return NULL;
		if (!(*bh = udf_tread(dir->i_sb, block)))
			return NULL;
	}
	else if (*offset > dir->i_sb->s_blocksize)
	{
	} else if (*offset > dir->i_sb->s_blocksize) {
		ad = tmpad;

		remainder = dir->i_sb->s_blocksize - loffset;
@@ -64,15 +60,15 @@ udf_filead_read(struct inode *dir, uint8_t *tmpad, uint8_t ad_size,
		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

struct fileIdentDesc *
udf_fileident_read(struct inode *dir, loff_t *nf_pos,
struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t * nf_pos,
					 struct udf_fileident_bh *fibh,
					 struct fileIdentDesc *cfi,
					 struct extent_position *epos,
@@ -85,26 +81,26 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,

	fibh->soffset = fibh->eoffset;

	if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
	{
	if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
		fi = udf_get_fileident(UDF_I_DATA(dir) -
				       (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, sizeof(struct fileIdentDesc));
		memcpy((uint8_t *) cfi, (uint8_t *) fi,
		       sizeof(struct fileIdentDesc));

		return fi;
	}

	if (fibh->eoffset == dir->i_sb->s_blocksize)
	{
	if (fibh->eoffset == dir->i_sb->s_blocksize) {
		int lextoffset = epos->offset;

		if (udf_next_aext(dir, epos, eloc, elen, 1) !=
@@ -125,30 +121,32 @@ 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;
			for (num=0; i>0; i--)
			{
				block = udf_get_lb_pblock(dir->i_sb, *eloc, *offset+i);
			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);
				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);
			}
			if (num)
			{
			if (num) {
				ll_rw_block(READA, num, bha);
				for (i = 0; i < num; i++)
					brelse(bha[i]);
			}
		}
	}
	else if (fibh->sbh != fibh->ebh)
	{
	} else if (fibh->sbh != fibh->ebh) {
		brelse(fibh->sbh);
		fibh->sbh = fibh->ebh;
	}
@@ -161,12 +159,10 @@ 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, sizeof(struct fileIdentDesc));
	}
	else if (fibh->eoffset > dir->i_sb->s_blocksize)
	{
	if (fibh->eoffset <= dir->i_sb->s_blocksize) {
		memcpy((uint8_t *) cfi, (uint8_t *) fi,
		       sizeof(struct fileIdentDesc));
	} else if (fibh->eoffset > dir->i_sb->s_blocksize) {
		int lextoffset = epos->offset;

		if (udf_next_aext(dir, epos, eloc, elen, 1) !=
@@ -188,30 +184,31 @@ udf_fileident_read(struct inode *dir, loff_t *nf_pos,
		if (!(fibh->ebh = udf_tread(dir->i_sb, block)))
			return NULL;

		if (sizeof(struct fileIdentDesc) > - fibh->soffset)
		{
		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 - fibh->soffset,
			       fibh->ebh->b_data,
			       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;

			*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, sizeof(struct fileIdentDesc));
		} else {
			memcpy((uint8_t *) cfi, (uint8_t *) fi,
			       sizeof(struct fileIdentDesc));
		}
	}
	return fi;
}

struct fileIdentDesc * 
udf_get_fileident(void * buffer, int bufsize, int * offset)
struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
{
	struct fileIdentDesc *fi;
	int lengthThisIdent;
@@ -219,7 +216,8 @@ udf_get_fileident(void * buffer, int bufsize, int * offset)
	int padlen;

	if ((!buffer) || (!offset)) {
		udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer, offset);
		udf_debug("invalidparms\n, buffer=%p, offset=%p\n", buffer,
			  offset);
		return NULL;
	}

@@ -229,19 +227,17 @@ udf_get_fileident(void * buffer, int bufsize, int * offset)
		ptr += *offset;
	}
	fi = (struct fileIdentDesc *)ptr;
	if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID)
	{
	if (le16_to_cpu(fi->descTag.tagIdent) != TAG_IDENT_FID) {
		udf_debug("0x%x != TAG_IDENT_FID\n",
			  le16_to_cpu(fi->descTag.tagIdent));
		udf_debug("offset: %u sizeof: %lu bufsize: %u\n",
			*offset, (unsigned long)sizeof(struct fileIdentDesc), bufsize);
			  *offset, (unsigned long)sizeof(struct fileIdentDesc),
			  bufsize);
		return NULL;
	}
	if ( (*offset + sizeof(struct fileIdentDesc)) > bufsize )
	{
	if ((*offset + sizeof(struct fileIdentDesc)) > bufsize) {
		lengthThisIdent = sizeof(struct fileIdentDesc);
	}
	else
	} else
		lengthThisIdent = sizeof(struct fileIdentDesc) +
		    fi->lengthFileIdent + le16_to_cpu(fi->lengthOfImpUse);

@@ -255,32 +251,30 @@ udf_get_fileident(void * buffer, int bufsize, int * offset)
}

#if 0
static extent_ad *
udf_get_fileextent(void * buffer, int bufsize, int * offset)
static extent_ad *udf_get_fileextent(void *buffer, int bufsize, int *offset)
{
	extent_ad *ext;
	struct fileEntry *fe;
	uint8_t *ptr;

	if ( (!buffer) || (!offset) )
	{
	if ((!buffer) || (!offset)) {
		printk(KERN_ERR "udf: udf_get_fileextent() invalidparms\n");
		return NULL;
	}

	fe = (struct fileEntry *)buffer;

	if ( le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE )
	{
	if (le16_to_cpu(fe->descTag.tagIdent) != TAG_IDENT_FE) {
		udf_debug("0x%x != TAG_IDENT_FE\n",
			  le16_to_cpu(fe->descTag.tagIdent));
		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)) )
	{
	if ((*offset > 0) && (*offset < le32_to_cpu(fe->lengthAllocDescs))) {
		ptr += *offset;
	}

@@ -291,13 +285,12 @@ udf_get_fileextent(void * buffer, int bufsize, int * offset)
}
#endif

short_ad *
udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, int inc)
short_ad *udf_get_fileshortad(uint8_t * ptr, int maxoffset, int *offset,
			      int inc)
{
	short_ad *sa;

	if ( (!ptr) || (!offset) )
	{
	if ((!ptr) || (!offset)) {
		printk(KERN_ERR "udf: udf_get_fileshortad() invalidparms\n");
		return NULL;
	}
@@ -312,13 +305,11 @@ udf_get_fileshortad(uint8_t *ptr, int maxoffset, int *offset, int inc)
	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;

	if ( (!ptr) || (!offset) ) 
	{
	if ((!ptr) || (!offset)) {
		printk(KERN_ERR "udf: udf_get_filelongad() invalidparms\n");
		return NULL;
	}
+410 −465
Original line number Diff line number Diff line
@@ -38,8 +38,7 @@
#define _ECMA_167_H 1

/* Character set specification (ECMA 167r3 1/7.2.1) */
typedef struct
{
typedef struct {
	uint8_t charSetType;
	uint8_t charSetInfo[63];
} __attribute__ ((packed)) charspec;
@@ -58,8 +57,7 @@ typedef struct
typedef uint8_t dstring;

/* Timestamp (ECMA 167r3 1/7.3) */
typedef struct
{
typedef struct {
	__le16 typeAndTimezone;
	__le16 year;
	uint8_t month;
@@ -72,8 +70,7 @@ typedef struct
	uint8_t microseconds;
} __attribute__ ((packed)) timestamp;

typedef struct
{
typedef struct {
	uint16_t typeAndTimezone;
	int16_t year;
	uint8_t month;
@@ -94,8 +91,7 @@ typedef struct
#define TIMESTAMP_TIMEZONE_MASK		0x0FFF

/* Entity identifier (ECMA 167r3 1/7.4) */
typedef struct
{
typedef struct {
	uint8_t flags;
	uint8_t ident[23];
	uint8_t identSuffix[8];
@@ -107,8 +103,7 @@ typedef struct

/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
#define VSD_STD_ID_LEN			5
struct volStructDesc
{
struct volStructDesc {
	uint8_t structType;
	uint8_t stdIdent[VSD_STD_ID_LEN];
	uint8_t structVersion;
@@ -127,8 +122,7 @@ struct volStructDesc
#define VSD_STD_ID_TEA01		"TEA01"	/* (2/9.3) */

/* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
struct beginningExtendedAreaDesc
{
struct beginningExtendedAreaDesc {
	uint8_t structType;
	uint8_t stdIdent[VSD_STD_ID_LEN];
	uint8_t structVersion;
@@ -136,8 +130,7 @@ struct beginningExtendedAreaDesc
} __attribute__ ((packed));

/* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
struct terminatingExtendedAreaDesc
{
struct terminatingExtendedAreaDesc {
	uint8_t structType;
	uint8_t stdIdent[VSD_STD_ID_LEN];
	uint8_t structVersion;
@@ -145,8 +138,7 @@ struct terminatingExtendedAreaDesc
} __attribute__ ((packed));

/* Boot Descriptor (ECMA 167r3 2/9.4) */
struct bootDesc
{
struct bootDesc {
	uint8_t structType;
	uint8_t stdIdent[VSD_STD_ID_LEN];
	uint8_t structVersion;
@@ -167,21 +159,18 @@ struct bootDesc
#define BOOT_FLAGS_ERASE		0x01

/* Extent Descriptor (ECMA 167r3 3/7.1) */
typedef struct
{
typedef struct {
	__le32 extLength;
	__le32 extLocation;
} __attribute__ ((packed)) extent_ad;

typedef struct
{
typedef struct {
	uint32_t extLength;
	uint32_t extLocation;
} kernel_extent_ad;

/* Descriptor Tag (ECMA 167r3 3/7.2) */
typedef struct
{
typedef struct {
	__le16 tagIdent;
	__le16 descVersion;
	uint8_t tagChecksum;
@@ -204,8 +193,7 @@ typedef struct
#define TAG_IDENT_LVID			0x0009

/* NSR Descriptor (ECMA 167r3 3/9.1) */
struct NSRDesc
{
struct NSRDesc {
	uint8_t structType;
	uint8_t stdIdent[VSD_STD_ID_LEN];
	uint8_t structVersion;
@@ -214,8 +202,7 @@ struct NSRDesc
} __attribute__ ((packed));

/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
struct primaryVolDesc
{
struct primaryVolDesc {
	tag descTag;
	__le32 volDescSeqNum;
	__le32 primaryVolDescNum;
@@ -244,8 +231,7 @@ struct primaryVolDesc
#define PVD_FLAGS_VSID_COMMON		0x0001

/* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */
struct anchorVolDescPtr
{
struct anchorVolDescPtr {
	tag descTag;
	extent_ad mainVolDescSeqExt;
	extent_ad reserveVolDescSeqExt;
@@ -253,8 +239,7 @@ struct anchorVolDescPtr
} __attribute__ ((packed));

/* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
struct volDescPtr
{
struct volDescPtr {
	tag descTag;
	__le32 volDescSeqNum;
	extent_ad nextVolDescSeqExt;
@@ -262,8 +247,7 @@ struct volDescPtr
} __attribute__ ((packed));

/* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
struct impUseVolDesc
{
struct impUseVolDesc {
	tag descTag;
	__le32 volDescSeqNum;
	regid impIdent;
@@ -271,8 +255,7 @@ struct impUseVolDesc
} __attribute__ ((packed));

/* Partition Descriptor (ECMA 167r3 3/10.5) */
struct partitionDesc
{
struct partitionDesc {
	tag descTag;
	__le32 volDescSeqNum;
	__le16 partitionFlags;
@@ -307,8 +290,7 @@ struct partitionDesc
#define PD_ACCESS_TYPE_OVERWRITABLE	0x00000004

/* Logical Volume Descriptor (ECMA 167r3 3/10.6) */
struct logicalVolDesc
{
struct logicalVolDesc {
	tag descTag;
	__le32 volDescSeqNum;
	charspec descCharSet;
@@ -325,8 +307,7 @@ struct logicalVolDesc
} __attribute__ ((packed));

/* Generic Partition Map (ECMA 167r3 3/10.7.1) */
struct genericPartitionMap
{
struct genericPartitionMap {
	uint8_t partitionMapType;
	uint8_t partitionMapLength;
	uint8_t partitionMapping[0];
@@ -338,8 +319,7 @@ struct genericPartitionMap
#define GP_PARTITION_MAP_TYPE_2		0x02

/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
struct genericPartitionMap1
{
struct genericPartitionMap1 {
	uint8_t partitionMapType;
	uint8_t partitionMapLength;
	__le16 volSeqNum;
@@ -347,16 +327,14 @@ struct genericPartitionMap1
} __attribute__ ((packed));

/* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
struct genericPartitionMap2
{
struct genericPartitionMap2 {
	uint8_t partitionMapType;
	uint8_t partitionMapLength;
	uint8_t partitionIdent[62];
} __attribute__ ((packed));

/* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
struct unallocSpaceDesc
{
struct unallocSpaceDesc {
	tag descTag;
	__le32 volDescSeqNum;
	__le32 numAllocDescs;
@@ -364,15 +342,13 @@ struct unallocSpaceDesc
} __attribute__ ((packed));

/* Terminating Descriptor (ECMA 167r3 3/10.9) */
struct terminatingDesc
{
struct terminatingDesc {
	tag descTag;
	uint8_t reserved[496];
} __attribute__ ((packed));

/* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
struct logicalVolIntegrityDesc
{
struct logicalVolIntegrityDesc {
	tag descTag;
	timestamp recordingDateAndTime;
	__le32 integrityType;
@@ -390,52 +366,45 @@ struct logicalVolIntegrityDesc
#define LVID_INTEGRITY_TYPE_CLOSE	0x00000001

/* Recorded Address (ECMA 167r3 4/7.1) */
typedef struct 
{
typedef struct {
	__le32 logicalBlockNum;
	__le16 partitionReferenceNum;
} __attribute__ ((packed)) lb_addr;

/* ... and its in-core analog */
typedef struct 
{
typedef struct {
	uint32_t logicalBlockNum;
	uint16_t partitionReferenceNum;
} kernel_lb_addr;

/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
typedef struct
{
typedef struct {
	__le32 extLength;
	__le32 extPosition;
} __attribute__ ((packed)) short_ad;

/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
typedef struct
{
typedef struct {
	__le32 extLength;
	lb_addr extLocation;
	uint8_t impUse[6];
} __attribute__ ((packed)) long_ad;

typedef struct
{
typedef struct {
	uint32_t extLength;
	kernel_lb_addr extLocation;
	uint8_t impUse[6];
} kernel_long_ad;

/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
typedef struct
{
typedef struct {
	__le32 extLength;
	__le32 recordedLength;
	__le32 informationLength;
	lb_addr extLocation;
} __attribute__ ((packed)) ext_ad;

typedef struct
{
typedef struct {
	uint32_t extLength;
	uint32_t recordedLength;
	uint32_t informationLength;
@@ -458,8 +427,7 @@ typedef struct
#define TAG_IDENT_EFE			0x010A

/* File Set Descriptor (ECMA 167r3 4/14.1) */
struct fileSetDesc
{
struct fileSetDesc {
	tag descTag;
	timestamp recordingDateAndTime;
	__le16 interchangeLvl;
@@ -482,8 +450,7 @@ struct fileSetDesc
} __attribute__ ((packed));

/* Partition Header Descriptor (ECMA 167r3 4/14.3) */
struct partitionHeaderDesc
{
struct partitionHeaderDesc {
	short_ad unallocSpaceTable;
	short_ad unallocSpaceBitmap;
	short_ad partitionIntegrityTable;
@@ -493,8 +460,7 @@ struct partitionHeaderDesc
} __attribute__ ((packed));

/* File Identifier Descriptor (ECMA 167r3 4/14.4) */
struct fileIdentDesc
{
struct fileIdentDesc {
	tag descTag;
	__le16 fileVersionNum;
	uint8_t fileCharacteristics;
@@ -514,16 +480,14 @@ struct fileIdentDesc
#define FID_FILE_CHAR_METADATA		0x10

/* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */
struct allocExtDesc
{
struct allocExtDesc {
	tag descTag;
	__le32 previousAllocExtLocation;
	__le32 lengthAllocDescs;
} __attribute__ ((packed));

/* ICB Tag (ECMA 167r3 4/14.6) */
typedef struct
{
typedef struct {
	__le32 priorRecordedNumDirectEntries;
	__le16 strategyType;
	__le16 strategyParameter;
@@ -576,23 +540,20 @@ typedef struct
#define ICBTAG_FLAG_STREAM		0x2000

/* Indirect Entry (ECMA 167r3 4/14.7) */
struct indirectEntry
{
struct indirectEntry {
	tag descTag;
	icbtag icbTag;
	long_ad indirectICB;
} __attribute__ ((packed));

/* Terminal Entry (ECMA 167r3 4/14.8) */
struct terminalEntry
{
struct terminalEntry {
	tag descTag;
	icbtag icbTag;
} __attribute__ ((packed));

/* File Entry (ECMA 167r3 4/14.9) */
struct fileEntry
{
struct fileEntry {
	tag descTag;
	icbtag icbTag;
	__le32 uid;
@@ -655,16 +616,14 @@ struct fileEntry
#define FE_RECORD_DISPLAY_ATTR_3	0x03

/* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */
struct extendedAttrHeaderDesc
{
struct extendedAttrHeaderDesc {
	tag descTag;
	__le32 impAttrLocation;
	__le32 appAttrLocation;
} __attribute__ ((packed));

/* Generic Format (ECMA 167r3 4/14.10.2) */
struct genericFormat
{
struct genericFormat {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -673,8 +632,7 @@ struct genericFormat
} __attribute__ ((packed));

/* Character Set Information (ECMA 167r3 4/14.10.3) */
struct charSetInfo
{
struct charSetInfo {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -685,8 +643,7 @@ struct charSetInfo
} __attribute__ ((packed));

/* Alternate Permissions (ECMA 167r3 4/14.10.4) */
struct altPerms
{
struct altPerms {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -697,8 +654,7 @@ struct altPerms
} __attribute__ ((packed));

/* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
struct fileTimesExtAttr
{
struct fileTimesExtAttr {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -715,8 +671,7 @@ struct fileTimesExtAttr
#define FTE_BACKUP			0x00000002

/* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */
struct infoTimesExtAttr
{
struct infoTimesExtAttr {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -727,8 +682,7 @@ struct infoTimesExtAttr
} __attribute__ ((packed));

/* Device Specification (ECMA 167r3 4/14.10.7) */
struct deviceSpec
{
struct deviceSpec {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -740,8 +694,7 @@ struct deviceSpec
} __attribute__ ((packed));

/* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
struct impUseExtAttr
{
struct impUseExtAttr {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -752,8 +705,7 @@ struct impUseExtAttr
} __attribute__ ((packed));

/* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
struct appUseExtAttr
{
struct appUseExtAttr {
	__le32 attrType;
	uint8_t attrSubtype;
	uint8_t reserved[3];
@@ -771,10 +723,8 @@ struct appUseExtAttr
#define EXTATTR_IMP_USE			2048
#define EXTATTR_APP_USE			65536


/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
struct unallocSpaceEntry
{
struct unallocSpaceEntry {
	tag descTag;
	icbtag icbTag;
	__le32 lengthAllocDescs;
@@ -782,8 +732,7 @@ struct unallocSpaceEntry
} __attribute__ ((packed));

/* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
struct spaceBitmapDesc
{
struct spaceBitmapDesc {
	tag descTag;
	__le32 numOfBits;
	__le32 numOfBytes;
@@ -791,8 +740,7 @@ struct spaceBitmapDesc
} __attribute__ ((packed));

/* Partition Integrity Entry (ECMA 167r3 4/14.13) */
struct partitionIntegrityEntry
{
struct partitionIntegrityEntry {
	tag descTag;
	icbtag icbTag;
	timestamp recordingDateAndTime;
@@ -815,15 +763,13 @@ struct partitionIntegrityEntry
/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */

/* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */
struct logicalVolHeaderDesc
{
struct logicalVolHeaderDesc {
	__le64 uniqueID;
	uint8_t reserved[24];
} __attribute__ ((packed));

/* Path Component (ECMA 167r3 4/14.16.1) */
struct pathComponent
{
struct pathComponent {
	uint8_t componentType;
	uint8_t lengthComponentIdent;
	__le16 componentFileVersionNum;
@@ -831,8 +777,7 @@ struct pathComponent
} __attribute__ ((packed));

/* File Entry (ECMA 167r3 4/14.17) */
struct extendedFileEntry
{
struct extendedFileEntry {
	tag descTag;
	icbtag icbTag;
	__le32 uid;
Loading