Commit 62429f43 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6: (41 commits)
  udf: use crc_itu_t from lib instead of udf_crc
  udf: Fix compilation warnings when UDF debug is on
  udf: Fix bug in VAT mapping code
  udf: Add read-only support for 2.50 UDF media
  udf: Fix handling of multisession media
  udf: Mount filesystem read-only if it has pseudooverwrite partition
  udf: Handle VAT packed inside inode properly
  udf: Allow loading of VAT inode
  udf: Fix detection of VAT version
  udf: Silence warning about accesses beyond end of device
  udf: Improve anchor block detection
  udf: Cleanup anchor block detection.
  udf: Move processing of virtual partitions
  udf: Move filling of partition descriptor info into a separate function
  udf: Improve error recovery on mount
  udf: Cleanup volume descriptor sequence processing
  udf: fix anchor point detection
  udf: Remove declarations of arrays of size UDF_NAME_LEN (256 bytes)
  udf: Remove checking of existence of filename in udf_add_entry()
  udf: Mark udf_process_sequence() as noinline
  ...
parents 26defe34 f845fced
...@@ -689,6 +689,7 @@ config ZISOFS ...@@ -689,6 +689,7 @@ config ZISOFS
config UDF_FS config UDF_FS
tristate "UDF file system support" tristate "UDF file system support"
select CRC_ITU_T
help help
This is the new file system used on some CD-ROMs and DVDs. Say Y if This is the new file system used on some CD-ROMs and DVDs. Say Y if
you intend to mount DVD discs or CDRW's written in packet mode, or you intend to mount DVD discs or CDRW's written in packet mode, or
......
...@@ -6,4 +6,4 @@ obj-$(CONFIG_UDF_FS) += udf.o ...@@ -6,4 +6,4 @@ obj-$(CONFIG_UDF_FS) += udf.o
udf-objs := balloc.o dir.o file.o ialloc.o inode.o lowlevel.o namei.o \ udf-objs := balloc.o dir.o file.o ialloc.o inode.o lowlevel.o namei.o \
partition.o super.o truncate.o symlink.o fsync.o \ partition.o super.o truncate.o symlink.o fsync.o \
crc.o directory.o misc.o udftime.o unicode.o directory.o misc.o udftime.o unicode.o
...@@ -149,8 +149,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi, ...@@ -149,8 +149,7 @@ static bool udf_add_free_space(struct udf_sb_info *sbi,
return false; return false;
lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data; lvid = (struct logicalVolIntegrityDesc *)sbi->s_lvid_bh->b_data;
lvid->freeSpaceTable[partition] = cpu_to_le32(le32_to_cpu( le32_add_cpu(&lvid->freeSpaceTable[partition], cnt);
lvid->freeSpaceTable[partition]) + cnt);
return true; return true;
} }
...@@ -589,10 +588,8 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -589,10 +588,8 @@ static void udf_table_free_blocks(struct super_block *sb,
sptr = oepos.bh->b_data + epos.offset; sptr = oepos.bh->b_data + epos.offset;
aed = (struct allocExtDesc *) aed = (struct allocExtDesc *)
oepos.bh->b_data; oepos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs,
cpu_to_le32(le32_to_cpu( adsize);
aed->lengthAllocDescs) +
adsize);
} else { } else {
sptr = iinfo->i_ext.i_data + sptr = iinfo->i_ext.i_data +
epos.offset; epos.offset;
...@@ -645,9 +642,7 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -645,9 +642,7 @@ static void udf_table_free_blocks(struct super_block *sb,
mark_inode_dirty(table); mark_inode_dirty(table);
} else { } else {
aed = (struct allocExtDesc *)epos.bh->b_data; aed = (struct allocExtDesc *)epos.bh->b_data;
aed->lengthAllocDescs = le32_add_cpu(&aed->lengthAllocDescs, adsize);
cpu_to_le32(le32_to_cpu(
aed->lengthAllocDescs) + adsize);
udf_update_tag(epos.bh->b_data, epos.offset); udf_update_tag(epos.bh->b_data, epos.offset);
mark_buffer_dirty(epos.bh); mark_buffer_dirty(epos.bh);
} }
......
/*
* crc.c
*
* PURPOSE
* Routines to generate, calculate, and test a 16-bit CRC.
*
* DESCRIPTION
* The CRC code was devised by Don P. Mitchell of AT&T Bell Laboratories
* and Ned W. Rhodes of Software Systems Group. It has been published in
* "Design and Validation of Computer Protocols", Prentice Hall,
* Englewood Cliffs, NJ, 1991, Chapter 3, ISBN 0-13-539925-4.
*
* Copyright is held by AT&T.
*
* AT&T gives permission for the free use of the CRC source code.
*
* COPYRIGHT
* This file is distributed under the terms of the GNU General Public
* License (GPL). Copies of the GPL can be obtained from:
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*/
#include "udfdecl.h"
static uint16_t crc_table[256] = {
0x0000U, 0x1021U, 0x2042U, 0x3063U, 0x4084U, 0x50a5U, 0x60c6U, 0x70e7U,
0x8108U, 0x9129U, 0xa14aU, 0xb16bU, 0xc18cU, 0xd1adU, 0xe1ceU, 0xf1efU,
0x1231U, 0x0210U, 0x3273U, 0x2252U, 0x52b5U, 0x4294U, 0x72f7U, 0x62d6U,
0x9339U, 0x8318U, 0xb37bU, 0xa35aU, 0xd3bdU, 0xc39cU, 0xf3ffU, 0xe3deU,
0x2462U, 0x3443U, 0x0420U, 0x1401U, 0x64e6U, 0x74c7U, 0x44a4U, 0x5485U,
0xa56aU, 0xb54bU, 0x8528U, 0x9509U, 0xe5eeU, 0xf5cfU, 0xc5acU, 0xd58dU,
0x3653U, 0x2672U, 0x1611U, 0x0630U, 0x76d7U, 0x66f6U, 0x5695U, 0x46b4U,
0xb75bU, 0xa77aU, 0x9719U, 0x8738U, 0xf7dfU, 0xe7feU, 0xd79dU, 0xc7bcU,
0x48c4U, 0x58e5U, 0x6886U, 0x78a7U, 0x0840U, 0x1861U, 0x2802U, 0x3823U,
0xc9ccU, 0xd9edU, 0xe98eU, 0xf9afU, 0x8948U, 0x9969U, 0xa90aU, 0xb92bU,
0x5af5U, 0x4ad4U, 0x7ab7U, 0x6a96U, 0x1a71U, 0x0a50U, 0x3a33U, 0x2a12U,
0xdbfdU, 0xcbdcU, 0xfbbfU, 0xeb9eU, 0x9b79U, 0x8b58U, 0xbb3bU, 0xab1aU,
0x6ca6U, 0x7c87U, 0x4ce4U, 0x5cc5U, 0x2c22U, 0x3c03U, 0x0c60U, 0x1c41U,
0xedaeU, 0xfd8fU, 0xcdecU, 0xddcdU, 0xad2aU, 0xbd0bU, 0x8d68U, 0x9d49U,
0x7e97U, 0x6eb6U, 0x5ed5U, 0x4ef4U, 0x3e13U, 0x2e32U, 0x1e51U, 0x0e70U,
0xff9fU, 0xefbeU, 0xdfddU, 0xcffcU, 0xbf1bU, 0xaf3aU, 0x9f59U, 0x8f78U,
0x9188U, 0x81a9U, 0xb1caU, 0xa1ebU, 0xd10cU, 0xc12dU, 0xf14eU, 0xe16fU,
0x1080U, 0x00a1U, 0x30c2U, 0x20e3U, 0x5004U, 0x4025U, 0x7046U, 0x6067U,
0x83b9U, 0x9398U, 0xa3fbU, 0xb3daU, 0xc33dU, 0xd31cU, 0xe37fU, 0xf35eU,
0x02b1U, 0x1290U, 0x22f3U, 0x32d2U, 0x4235U, 0x5214U, 0x6277U, 0x7256U,
0xb5eaU, 0xa5cbU, 0x95a8U, 0x8589U, 0xf56eU, 0xe54fU, 0xd52cU, 0xc50dU,
0x34e2U, 0x24c3U, 0x14a0U, 0x0481U, 0x7466U, 0x6447U, 0x5424U, 0x4405U,
0xa7dbU, 0xb7faU, 0x8799U, 0x97b8U, 0xe75fU, 0xf77eU, 0xc71dU, 0xd73cU,
0x26d3U, 0x36f2U, 0x0691U, 0x16b0U, 0x6657U, 0x7676U, 0x4615U, 0x5634U,
0xd94cU, 0xc96dU, 0xf90eU, 0xe92fU, 0x99c8U, 0x89e9U, 0xb98aU, 0xa9abU,
0x5844U, 0x4865U, 0x7806U, 0x6827U, 0x18c0U, 0x08e1U, 0x3882U, 0x28a3U,
0xcb7dU, 0xdb5cU, 0xeb3fU, 0xfb1eU, 0x8bf9U, 0x9bd8U, 0xabbbU, 0xbb9aU,
0x4a75U, 0x5a54U, 0x6a37U, 0x7a16U, 0x0af1U, 0x1ad0U, 0x2ab3U, 0x3a92U,
0xfd2eU, 0xed0fU, 0xdd6cU, 0xcd4dU, 0xbdaaU, 0xad8bU, 0x9de8U, 0x8dc9U,
0x7c26U, 0x6c07U, 0x5c64U, 0x4c45U, 0x3ca2U, 0x2c83U, 0x1ce0U, 0x0cc1U,
0xef1fU, 0xff3eU, 0xcf5dU, 0xdf7cU, 0xaf9bU, 0xbfbaU, 0x8fd9U, 0x9ff8U,
0x6e17U, 0x7e36U, 0x4e55U, 0x5e74U, 0x2e93U, 0x3eb2U, 0x0ed1U, 0x1ef0U
};
/*
* udf_crc
*
* PURPOSE
* Calculate a 16-bit CRC checksum using ITU-T V.41 polynomial.
*
* DESCRIPTION
* The OSTA-UDF(tm) 1.50 standard states that using CRCs is mandatory.
* The polynomial used is: x^16 + x^12 + x^15 + 1
*
* PRE-CONDITIONS
* data Pointer to the data block.
* size Size of the data block.
*
* POST-CONDITIONS
* <return> CRC of the data block.
*
* HISTORY
* 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)
{
while (size--)
crc = crc_table[(crc >> 8 ^ *(data++)) & 0xffU] ^ (crc << 8);
return crc;
}
/****************************************************************************/
#if defined(TEST)
/*
* PURPOSE
* Test udf_crc()
*
* HISTORY
* July 21, 1997 - Andrew E. Mileski
* Adapted from OSTA-UDF(tm) 1.50 standard.
*/
unsigned char bytes[] = { 0x70U, 0x6AU, 0x77U };
int main(void)
{
unsigned short x;
x = udf_crc(bytes, sizeof bytes);
printf("udf_crc: calculated = %4.4x, correct = %4.4x\n", x, 0x3299U);
return 0;
}
#endif /* defined(TEST) */
/****************************************************************************/
#if defined(GENERATE)
/*
* PURPOSE
* Generate a table for fast 16-bit CRC calculations (any polynomial).
*
* DESCRIPTION
* The ITU-T V.41 polynomial is 010041.
*
* HISTORY
* July 21, 1997 - Andrew E. Mileski
* Adapted from OSTA-UDF(tm) 1.50 standard.
*/
#include <stdio.h>
int main(int argc, char **argv)
{
unsigned long crc, poly;
int n, i;
/* Get the polynomial */
sscanf(argv[1], "%lo", &poly);
if (poly & 0xffff0000U) {
fprintf(stderr, "polynomial is too large\en");
exit(1);
}
printf("/* CRC 0%o */\n", poly);
/* Create a table */
printf("static unsigned short crc_table[256] = {\n");
for (n = 0; n < 256; n++) {
if (n % 8 == 0)
printf("\t");
crc = n << 8;
for (i = 0; i < 8; i++) {
if (crc & 0x8000U)
crc = (crc << 1) ^ poly;
else
crc <<= 1;
crc &= 0xFFFFU;
}
if (n == 255)
printf("0x%04xU ", crc);
else
printf("0x%04xU, ", crc);
if (n % 8 == 7)
printf("\n");
}
printf("};\n");
return 0;
}
#endif /* defined(GENERATE) */
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
static int do_udf_readdir(struct inode *dir, struct file *filp, static int do_udf_readdir(struct inode *dir, struct file *filp,
filldir_t filldir, void *dirent) filldir_t filldir, void *dirent)
{ {
struct udf_fileident_bh fibh; struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL};
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) << 2; loff_t nf_pos = (filp->f_pos - 1) << 2;
int flen; int flen;
char fname[UDF_NAME_LEN]; char *fname = NULL;
char *nameptr; char *nameptr;
uint16_t liu; uint16_t liu;
uint8_t lfi; uint8_t lfi;
...@@ -54,23 +54,32 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, ...@@ -54,23 +54,32 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
kernel_lb_addr eloc; kernel_lb_addr eloc;
uint32_t elen; uint32_t elen;
sector_t offset; sector_t offset;
int i, num; int i, num, ret = 0;
unsigned int dt_type; unsigned int dt_type;
struct extent_position epos = { NULL, 0, {0, 0} }; struct extent_position epos = { NULL, 0, {0, 0} };
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
if (nf_pos >= size) if (nf_pos >= size)
return 0; goto out;
fname = kmalloc(UDF_NAME_LEN, GFP_NOFS);
if (!fname) {
ret = -ENOMEM;
goto out;
}
if (nf_pos == 0) if (nf_pos == 0)
nf_pos = udf_ext0_offset(dir); nf_pos = udf_ext0_offset(dir);
fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1); fibh.soffset = fibh.eoffset = nf_pos & (dir->i_sb->s_blocksize - 1);
iinfo = UDF_I(dir); iinfo = UDF_I(dir);
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) { if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
fibh.sbh = fibh.ebh = NULL; if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits,
} else if (inode_bmap(dir, nf_pos >> dir->i_sb->s_blocksize_bits, &epos, &eloc, &elen, &offset)
&epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) { != (EXT_RECORDED_ALLOCATED >> 30)) {
ret = -ENOENT;
goto out;
}
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 (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
...@@ -83,8 +92,8 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, ...@@ -83,8 +92,8 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
} }
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); ret = -EIO;
return -EIO; goto out;
} }
if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) { if (!(offset & ((16 >> (dir->i_sb->s_blocksize_bits - 9)) - 1))) {
...@@ -105,9 +114,6 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, ...@@ -105,9 +114,6 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
brelse(bha[i]); brelse(bha[i]);
} }
} }
} else {
brelse(epos.bh);
return -ENOENT;
} }
while (nf_pos < size) { while (nf_pos < size) {
...@@ -115,13 +121,8 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, ...@@ -115,13 +121,8 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc, fi = udf_fileident_read(dir, &nf_pos, &fibh, &cfi, &epos, &eloc,
&elen, &offset); &elen, &offset);
if (!fi) { if (!fi)
if (fibh.sbh != fibh.ebh) goto out;
brelse(fibh.ebh);
brelse(fibh.sbh);
brelse(epos.bh);
return 0;
}
liu = le16_to_cpu(cfi.lengthOfImpUse); liu = le16_to_cpu(cfi.lengthOfImpUse);
lfi = cfi.lengthFileIdent; lfi = cfi.lengthFileIdent;
...@@ -167,53 +168,23 @@ static int do_udf_readdir(struct inode *dir, struct file *filp, ...@@ -167,53 +168,23 @@ static int do_udf_readdir(struct inode *dir, struct file *filp,
dt_type = DT_UNKNOWN; dt_type = DT_UNKNOWN;
} }
if (flen) { if (flen && filldir(dirent, fname, flen, filp->f_pos,
if (filldir(dirent, fname, flen, filp->f_pos, iblock, dt_type) < 0) { iblock, dt_type) < 0)
if (fibh.sbh != fibh.ebh) goto out;
brelse(fibh.ebh);
brelse(fibh.sbh);
brelse(epos.bh);
return 0;
}
}
} /* end while */ } /* end while */
filp->f_pos = (nf_pos >> 2) + 1; filp->f_pos = (nf_pos >> 2) + 1;
out:
if (fibh.sbh != fibh.ebh) if (fibh.sbh != fibh.ebh)
brelse(fibh.ebh); brelse(fibh.ebh);
brelse(fibh.sbh); brelse(fibh.sbh);
brelse(epos.bh); brelse(epos.bh);
kfree(fname);
return 0; return ret;
} }
/*
* udf_readdir
*
* PURPOSE
* Read a directory entry.
*
* DESCRIPTION
* Optional - sys_getdents() will return -ENOTDIR if this routine is not
* available.
*
* Refer to sys_getdents() in fs/readdir.c
* sys_getdents() -> .
*
* PRE-CONDITIONS
* filp Pointer to directory file.
* buf Pointer to directory entry buffer.
* filldir Pointer to filldir function.
*
* POST-CONDITIONS
* <return> >=0 on success.
*
* HISTORY
* July 1, 1997 - Andrew E. Mileski
* Written, tested, and released.
*/
static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir) static int udf_readdir(struct file *filp, void *dirent, filldir_t filldir)
{ {
struct inode *dir = filp->f_path.dentry->d_inode; struct inode *dir = filp->f_path.dentry->d_inode;
......
...@@ -70,19 +70,6 @@ typedef struct { ...@@ -70,19 +70,6 @@ typedef struct {
uint8_t microseconds; uint8_t microseconds;
} __attribute__ ((packed)) timestamp; } __attribute__ ((packed)) timestamp;
typedef struct {
uint16_t typeAndTimezone;
int16_t year;
uint8_t month;
uint8_t day;
uint8_t hour;
uint8_t minute;
uint8_t second;
uint8_t centiseconds;
uint8_t hundredsOfMicroseconds;
uint8_t microseconds;
} __attribute__ ((packed)) kernel_timestamp;
/* Type and Time Zone (ECMA 167r3 1/7.3.1) */ /* Type and Time Zone (ECMA 167r3 1/7.3.1) */
#define TIMESTAMP_TYPE_MASK 0xF000 #define TIMESTAMP_TYPE_MASK 0xF000
#define TIMESTAMP_TYPE_CUT 0x0000 #define TIMESTAMP_TYPE_CUT 0x0000
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "udfdecl.h" #include "udfdecl.h"
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/udf_fs.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> /* memset */ #include <linux/string.h> /* memset */
...@@ -144,40 +143,6 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -144,40 +143,6 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
return retval; return retval;
} }
/*
* udf_ioctl
*
* PURPOSE
* Issue an ioctl.
*
* DESCRIPTION
* Optional - sys_ioctl() will return -ENOTTY if this routine is not
* available, and the ioctl cannot be handled without filesystem help.
*
* sys_ioctl() handles these ioctls that apply only to regular files:
* FIBMAP [requires udf_block_map()], FIGETBSZ, FIONREAD
* These ioctls are also handled by sys_ioctl():
* FIOCLEX, FIONCLEX, FIONBIO, FIOASYNC
* All other ioctls are passed to the filesystem.
*
* Refer to sys_ioctl() in fs/ioctl.c
* sys_ioctl() -> .
*
* PRE-CONDITIONS
* inode Pointer to inode that ioctl was issued on.
* filp Pointer to file that ioctl was issued on.
* cmd The ioctl command.
* arg The ioctl argument [can be interpreted as a
* user-space pointer if desired].
*
* POST-CONDITIONS
* <return> Success (>=0) or an error code (<=0) that
* sys_ioctl() will return.
*
* HISTORY
* July 1, 1997 - Andrew E. Mileski
* Written, tested, and released.
*/
int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
...@@ -225,18 +190,6 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -225,18 +190,6 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
return result; return result;
} }
/*
* udf_release_file
*
* PURPOSE
* Called when all references to the file are closed
*
* DESCRIPTION
* Discard prealloced blocks
*
* HISTORY
*
*/
static int udf_release_file(struct inode *inode, struct file *filp) static int udf_release_file(struct inode *inode, struct file *filp)
{ {
if (filp->f_mode & FMODE_WRITE) { if (filp->f_mode & FMODE_WRITE) {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "udfdecl.h" #include "udfdecl.h"
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/quotaops.h> #include <linux/quotaops.h>
#include <linux/udf_fs.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -47,11 +46,9 @@ void udf_free_inode(struct inode *inode) ...@@ -47,11 +46,9 @@ void udf_free_inode(struct inode *inode)
struct logicalVolIntegrityDescImpUse *lvidiu = struct logicalVolIntegrityDescImpUse *lvidiu =
udf_sb_lvidiu(sbi); udf_sb_lvidiu(sbi);
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
lvidiu->numDirs = le32_add_cpu(&lvidiu->numDirs, -1);
cpu_to_le32(le32_to_cpu(lvidiu->numDirs) - 1);
else else
lvidiu->numFiles = le32_add_cpu(&lvidiu->numFiles, -1);
cpu_to_le32(le32_to_cpu(lvidiu->numFiles) - 1);
mark_buffer_dirty(sbi->s_lvid_bh); mark_buffer_dirty(sbi->s_lvid_bh);
} }
...@@ -105,11 +102,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err) ...@@ -105,11 +102,9 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
lvhd = (struct logicalVolHeaderDesc *) lvhd = (struct logicalVolHeaderDesc *)
(lvid->logicalVolContentsUse); (lvid->logicalVolContentsUse);
if (S_ISDIR(mode)) if (S_ISDIR(mode))
lvidiu->numDirs = le32_add_cpu(&lvidiu->numDirs, 1);
cpu_to_le32(le32_to_cpu(lvidiu->numDirs) + 1);
else else
lvidiu->numFiles = le32_add_cpu(&lvidiu->numFiles, 1);
cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1);
iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID); iinfo->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID);
if (!(++uniqueID & 0x00000000FFFFFFFFUL)) if (!(++uniqueID & 0x00000000FFFFFFFFUL))
uniqueID += 16; uniqueID += 16;
......
This diff is collapsed.
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/udf_fs.h>
#include "udf_sb.h" #include "udf_sb.h"
unsigned int udf_get_last_session(struct super_block *sb) unsigned int udf_get_last_session(struct super_block *sb)
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/udf_fs.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/crc-itu-t.h>
#include "udf_i.h" #include "udf_i.h"
#include "udf_sb.h" #include "udf_sb.h"
...@@ -136,8 +136,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size, ...@@ -136,8 +136,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
/* rewrite CRC + checksum of eahd */ /* rewrite CRC + checksum of eahd */
crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag); crclen = sizeof(struct extendedAttrHeaderDesc) - sizeof(tag);
eahd->descTag.descCRCLength = cpu_to_le16(crclen); eahd->descTag.descCRCLength = cpu_to_le16(crclen);
eahd->descTag.descCRC = cpu_to_le16(udf_crc((char *)eahd + eahd->descTag.descCRC = cpu_to_le16(crc_itu_t(0, (char *)eahd +
sizeof(tag), crclen, 0)); sizeof(tag), crclen));
eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag); eahd->descTag.tagChecksum = udf_tag_checksum(&eahd->descTag);
iinfo->i_lenEAttr += size; iinfo->i_lenEAttr += size;
return (struct genericFormat *)&ea[offset]; return (struct genericFormat *)&ea[offset];
...@@ -204,16 +204,15 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, ...@@ -204,16 +204,15 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
{ {
tag *tag_p; tag *tag_p;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct udf_sb_info *sbi = UDF_SB(sb);
/* Read the block */ /* Read the block */
if (block == 0xFFFFFFFF) if (block == 0xFFFFFFFF)
return NULL; return NULL;
bh = udf_tread(sb, block + sbi->s_session); bh = udf_tread(sb, block);
if (!bh) { if (!bh) {
udf_debug("block=%d, location=%d: read failed\n", udf_debug("block=%d, location=%d: read failed\n",
block + sbi->s_session, location); block, location);
return NULL; return NULL;
} }
...@@ -223,8 +222,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, ...@@ -223,8 +222,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
if (location != le32_to_cpu(tag_p->tagLocation)) { if (location != le32_to_cpu(tag_p->tagLocation)) {
udf_debug("location mismatch block %u, tag %u != %u\n", udf_debug("location mismatch block %u, tag %u != %u\n",
block + sbi->s_session, block, le32_to_cpu(tag_p->tagLocation), location);
le32_to_cpu(tag_p->tagLocation), location);
goto error_out; goto error_out;
} }
...@@ -244,13 +242,13 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, ...@@ -244,13 +242,13 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
/* Verify the descriptor CRC */ /* Verify the descriptor CRC */
if (le16_to_cpu(tag_p->descCRCLength) + sizeof(tag) > sb->s_blocksize || 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->descCRC) == crc_itu_t(0,
le16_to_cpu(tag_p->descCRCLength), 0)) bh->b_data + sizeof(tag),
le16_to_cpu(tag_p->descCRCLength)))
return bh; return bh;
udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block,
block + sbi->s_session, le16_to_cpu(tag_p->descCRC), le16_to_cpu(tag_p->descCRC), le16_to_cpu(tag_p->descCRCLength));
le16_to_cpu(tag_p->descCRCLength));
error_out: error_out:
brelse(bh); brelse(bh);
...@@ -270,7 +268,7 @@ void udf_update_tag(char *data, int length) ...@@ -270,7 +268,7 @@ void udf_update_tag(char *data, int length)
length -= sizeof(tag); length -= sizeof(tag);
tptr->descCRCLength = cpu_to_le16(length); tptr->descCRCLength = cpu_to_le16(length);
tptr->descCRC = cpu_to_le16(udf_crc(data + sizeof(tag), length, 0)); tptr->descCRC = cpu_to_le16(crc_itu_t(0, data + sizeof(tag), length));
tptr->tagChecksum = udf_tag_checksum(tptr); tptr->tagChecksum = udf_tag_checksum(tptr);
} }
......
This diff is collapsed.
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/udf_fs.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
...@@ -55,11 +54,10 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, ...@@ -55,11 +54,10 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
struct udf_part_map *map; struct udf_part_map *map;
struct udf_virtual_data *vdata; struct udf_virtual_data *vdata;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo = UDF_I(sbi->s_vat_inode);
map = &sbi->s_partmaps[partition]; map = &sbi->s_partmaps[partition];
vdata = &map->s_type_specific.s_virtual; vdata = &map->s_type_specific.s_virtual;
index = (sb->s_blocksize - vdata->s_start_offset) / sizeof(uint32_t);
if (block > vdata->s_num_entries) { if (block > vdata->s_num_entries) {
udf_debug("Trying to access block beyond end of VAT " udf_debug("Trying to access block beyond end of VAT "
...@@ -67,6 +65,12 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, ...@@ -67,6 +65,12 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
loc = le32_to_cpu(((__le32 *)(iinfo->i_ext.i_data +
vdata->s_start_offset))[block]);
goto translate;
}
index = (sb->s_blocksize - vdata->s_start_offset) / sizeof(uint32_t);
if (block >= index) { if (block >= index) {
block -= index; block -= index;
newblock = 1 + (block / (sb->s_blocksize / sizeof(uint32_t))); newblock = 1 + (block / (sb->s_blocksize / sizeof(uint32_t)));
...@@ -89,7 +93,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, ...@@ -89,7 +93,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
brelse(bh); brelse(bh);
iinfo = UDF_I(sbi->s_vat_inode); translate:
if (iinfo->i_location.partitionReferenceNum == partition) { if (iinfo->i_location.partitionReferenceNum == partition) {
udf_debug("recursive call to udf_get_pblock!\n"); udf_debug("recursive call to udf_get_pblock!\n");
return 0xFFFFFFFF; return 0xFFFFFFFF;
...@@ -263,3 +267,58 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) ...@@ -263,3 +267,58 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
return 0; return 0;
} }
static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block,
uint16_t partition, uint32_t offset)
{
struct super_block *sb = inode->i_sb;
struct udf_part_map *map;
kernel_lb_addr eloc;
uint32_t elen;
sector_t ext_offset;
struct extent_position epos = {};
uint32_t phyblock;
if (inode_bmap(inode, block, &epos, &eloc, &elen, &ext_offset) !=
(EXT_RECORDED_ALLOCATED >> 30))
phyblock = 0xFFFFFFFF;
else {
map = &UDF_SB(sb)->s_partmaps[partition];
/* map to sparable/physical partition desc */
phyblock = udf_get_pblock(sb, eloc.logicalBlockNum,
map->s_partition_num, ext_offset + offset);
}
brelse(epos.bh);
return phyblock;
}
uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
uint16_t partition, uint32_t offset)
{
struct udf_sb_info *sbi = UDF_SB(sb);
struct udf_part_map *map;
struct udf_meta_data *mdata;
uint32_t retblk;
struct inode *inode;
udf_debug("READING from METADATA\n");
map = &sbi->s_partmaps[partition];
mdata = &map->s_type_specific.s_metadata;
inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;
/* We shouldn't mount such media... */
BUG_ON(!inode);
retblk = udf_try_read_meta(inode, block, partition, offset);
if (retblk == 0xFFFFFFFF) {
udf_warning(sb, __func__, "error reading from METADATA, "
"trying to read from MIRROR");
inode = mdata->s_mirror_fe;
if (!inode)
return 0xFFFFFFFF;
retblk = udf_try_read_meta(inode, block, partition, offset);
}
return retblk;
}
This diff is collapsed.
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/udf_fs.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/stat.h> #include <linux/stat.h>
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "udfdecl.h" #include "udfdecl.h"
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/udf_fs.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include "udf_i.h" #include "udf_i.h"
...@@ -180,6 +179,24 @@ void udf_discard_prealloc(struct inode *inode) ...@@ -180,6 +179,24 @@ void udf_discard_prealloc(struct inode *inode)
brelse(epos.bh); brelse(epos.bh);
} }
static void udf_update_alloc_ext_desc(struct inode *inode,
struct extent_position *epos,
u32 lenalloc)
{
struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);
struct allocExtDesc *aed = (struct allocExtDesc *) (epos->bh->b_data);
int len = sizeof(struct allocExtDesc);
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) || sbi->s_udfrev >= 0x0201)
len += lenalloc;
udf_update_tag(epos->bh->b_data, len);
mark_buffer_dirty_inode(epos->bh, inode);
}
void udf_truncate_extents(struct inode *inode) void udf_truncate_extents(struct inode *inode)
{ {
struct extent_position epos; struct extent_position epos;
...@@ -187,7 +204,6 @@ void udf_truncate_extents(struct inode *inode) ...@@ -187,7 +204,6 @@ void udf_truncate_extents(struct inode *inode)
uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc; uint32_t elen, nelen = 0, indirect_ext_len = 0, lenalloc;
int8_t etype; int8_t etype;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);
sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset; sector_t first_block = inode->i_size >> sb->s_blocksize_bits, offset;
loff_t byte_offset; loff_t byte_offset;
int adsize; int adsize;
...@@ -224,35 +240,15 @@ void udf_truncate_extents(struct inode *inode) ...@@ -224,35 +240,15 @@ void udf_truncate_extents(struct inode *inode)
if (indirect_ext_len) { if (indirect_ext_len) {
/* We managed to free all extents in the /* We managed to free all extents in the
* indirect extent - free it too */ * indirect extent - free it too */
if (!epos.bh) BUG_ON(!epos.bh);
BUG();
udf_free_blocks(sb, inode, epos.block, udf_free_blocks(sb, inode, epos.block,
0, indirect_ext_len); 0, indirect_ext_len);
} else { } else if (!epos.bh) {
if (!epos.bh) { iinfo->i_lenAlloc = lenalloc;
iinfo->i_lenAlloc = mark_inode_dirty(inode);
lenalloc; } else
mark_inode_dirty(inode); udf_update_alloc_ext_desc(inode,
} else { &epos, lenalloc);
struct allocExtDesc *aed =
(struct allocExtDesc *)
(epos.bh->b_data);
int len =
sizeof(struct allocExtDesc);
aed->lengthAllocDescs =
cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb,
UDF_FLAG_STRICT) ||
sbi->s_udfrev >= 0x0201)
len += lenalloc;
udf_update_tag(epos.bh->b_data,
len);
mark_buffer_dirty_inode(
epos.bh, inode);
}
}
brelse(epos.bh); brelse(epos.bh);
epos.offset = sizeof(struct allocExtDesc); epos.offset = sizeof(struct allocExtDesc);
epos.block = eloc; epos.block = eloc;
...@@ -272,29 +268,14 @@ void udf_truncate_extents(struct inode *inode) ...@@ -272,29 +268,14 @@ void udf_truncate_extents(struct inode *inode)
} }
if (indirect_ext_len) { if (indirect_ext_len) {
if (!epos.bh) BUG_ON(!epos.bh);
BUG();
udf_free_blocks(sb, inode, epos.block, 0, udf_free_blocks(sb, inode, epos.block, 0,
indirect_ext_len); indirect_ext_len);
} else { } else if (!epos.bh) {
if (!epos.bh) { iinfo->i_lenAlloc = lenalloc;
iinfo->i_lenAlloc = lenalloc; mark_inode_dirty(inode);
mark_inode_dirty(inode); } else
} else { udf_update_alloc_ext_desc(inode, &epos, lenalloc);
struct allocExtDesc *aed =
(struct allocExtDesc *)(epos.bh->b_data);
aed->lengthAllocDescs = cpu_to_le32(lenalloc);
if (!UDF_QUERY_FLAG(sb, UDF_FLAG_STRICT) ||
sbi->s_udfrev >= 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);
}
}
} else if (inode->i_size) { } else if (inode->i_size) {
if (byte_offset) { if (byte_offset) {
kernel_long_ad extent; kernel_long_ad extent;
......
#ifndef __LINUX_UDF_I_H #ifndef _UDF_I_H
#define __LINUX_UDF_I_H #define _UDF_I_H
struct udf_inode_info {
struct timespec i_crtime;
/* Physical address of inode */
kernel_lb_addr i_location;
__u64 i_unique;
__u32 i_lenEAttr;
__u32 i_lenAlloc;
__u64 i_lenExtents;
__u32 i_next_alloc_block;
__u32 i_next_alloc_goal;
unsigned i_alloc_type : 3;
unsigned i_efe : 1; /* extendedFileEntry */
unsigned i_use : 1; /* unallocSpaceEntry */
unsigned i_strat4096 : 1;
unsigned reserved : 26;
union {
short_ad *i_sad;
long_ad *i_lad;
__u8 *i_data;
} i_ext;
struct inode vfs_inode;
};
#include <linux/udf_fs_i.h>
static inline struct udf_inode_info *UDF_I(struct inode *inode) static inline struct udf_inode_info *UDF_I(struct inode *inode)
{ {
return list_entry(inode, struct udf_inode_info, vfs_inode); return list_entry(inode, struct udf_inode_info, vfs_inode);
} }
#endif /* !defined(_LINUX_UDF_I_H) */ #endif /* _UDF_I_H) */
#ifndef __LINUX_UDF_SB_H #ifndef __LINUX_UDF_SB_H
#define __LINUX_UDF_SB_H #define __LINUX_UDF_SB_H
#include <linux/mutex.h>
/* Since UDF 2.01 is ISO 13346 based... */ /* Since UDF 2.01 is ISO 13346 based... */
#define UDF_SUPER_MAGIC 0x15013346 #define UDF_SUPER_MAGIC 0x15013346
#define UDF_MAX_READ_VERSION 0x0201 #define UDF_MAX_READ_VERSION 0x0250
#define UDF_MAX_WRITE_VERSION 0x0201 #define UDF_MAX_WRITE_VERSION 0x0201
#define UDF_FLAG_USE_EXTENDED_FE 0 #define UDF_FLAG_USE_EXTENDED_FE 0
...@@ -38,6 +40,111 @@ ...@@ -38,6 +40,111 @@
#define UDF_PART_FLAG_REWRITABLE 0x0040 #define UDF_PART_FLAG_REWRITABLE 0x0040
#define UDF_PART_FLAG_OVERWRITABLE 0x0080 #define UDF_PART_FLAG_OVERWRITABLE 0x0080
#define UDF_MAX_BLOCK_LOADED 8
#define UDF_TYPE1_MAP15 0x1511U
#define UDF_VIRTUAL_MAP15 0x1512U
#define UDF_VIRTUAL_MAP20 0x2012U
#define UDF_SPARABLE_MAP15 0x1522U
#define UDF_METADATA_MAP25 0x2511U
#pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */
struct udf_meta_data {
__u32 s_meta_file_loc;
__u32 s_mirror_file_loc;
__u32 s_bitmap_file_loc;
__u32 s_alloc_unit_size;
__u16 s_align_unit_size;
__u8 s_dup_md_flag;
struct inode *s_metadata_fe;
struct inode *s_mirror_fe;
struct inode *s_bitmap_fe;
};
struct udf_sparing_data {
__u16 s_packet_len;
struct buffer_head *s_spar_map[4];
};
struct udf_virtual_data {
__u32 s_num_entries;
__u16 s_start_offset;
};
struct udf_bitmap {
__u32 s_extLength;
__u32 s_extPosition;
__u16 s_nr_groups;
struct buffer_head **s_block_bitmap;
};
struct udf_part_map {
union {
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_uspace;
union {
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_fspace;
__u32 s_partition_root;
__u32 s_partition_len;
__u16 s_partition_type;
__u16 s_partition_num;
union {
struct udf_sparing_data s_sparing;
struct udf_virtual_data s_virtual;
struct udf_meta_data s_metadata;
} s_type_specific;
__u32 (*s_partition_func)(struct super_block *, __u32, __u16, __u32);
__u16 s_volumeseqnum;
__u16 s_partition_flags;
};
#pragma pack()
struct udf_sb_info {
struct udf_part_map *s_partmaps;
__u8 s_volume_ident[32];
/* Overall info */
__u16 s_partitions;
__u16 s_partition;
/* Sector headers */
__s32 s_session;
__u32 s_anchor[3];
__u32 s_last_block;
struct buffer_head *s_lvid_bh;
/* Default permissions */
mode_t s_umask;
gid_t s_gid;
uid_t s_uid;
/* Root Info */
struct timespec s_record_time;
/* Fileset Info */
__u16 s_serial_number;
/* highest UDF revision we have recorded to this media */
__u16 s_udfrev;
/* Miscellaneous flags */
__u32 s_flags;
/* Encoding info */
struct nls_table *s_nls_map;
/* VAT inode */
struct inode *s_vat_inode;
struct mutex s_alloc_mutex;
};
static inline struct udf_sb_info *UDF_SB(struct super_block *sb) static inline struct udf_sb_info *UDF_SB(struct super_block *sb)
{ {
return sb->s_fs_info; return sb->s_fs_info;
......
#ifndef __UDF_DECL_H #ifndef __UDF_DECL_H
#define __UDF_DECL_H #define __UDF_DECL_H
#include <linux/udf_fs.h>
#include "ecma_167.h" #include "ecma_167.h"
#include "osta_udf.h" #include "osta_udf.h"
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/udf_fs_i.h>
#include <linux/udf_fs_sb.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/udf_fs_i.h>
#include "udf_sb.h"
#include "udfend.h" #include "udfend.h"
#include "udf_i.h"
#define UDF_PREALLOCATE
#define UDF_DEFAULT_PREALLOC_BLOCKS 8
#define UDFFS_DEBUG
#ifdef UDFFS_DEBUG
#define udf_debug(f, a...) \
do { \
printk(KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
__FILE__, __LINE__, __func__); \
printk(f, ##a); \
} while (0)
#else
#define udf_debug(f, a...) /**/
#endif
#define udf_info(f, a...) \
printk(KERN_INFO "UDF-fs INFO " f, ##a);
#define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) ) #define udf_fixed_to_variable(x) ( ( ( (x) >> 5 ) * 39 ) + ( (x) & 0x0000001F ) )
#define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) ) #define udf_variable_to_fixed(x) ( ( ( (x) / 39 ) << 5 ) + ( (x) % 39 ) )
...@@ -23,16 +43,24 @@ ...@@ -23,16 +43,24 @@
#define UDF_NAME_LEN 256 #define UDF_NAME_LEN 256
#define UDF_PATH_LEN 1023 #define UDF_PATH_LEN 1023
#define udf_file_entry_alloc_offset(inode)\ static inline size_t udf_file_entry_alloc_offset(struct inode *inode)
(UDF_I(inode)->i_use ?\ {
sizeof(struct unallocSpaceEntry) :\ struct udf_inode_info *iinfo = UDF_I(inode);
((UDF_I(inode)->i_efe ?\ if (iinfo->i_use)
sizeof(struct extendedFileEntry) :\ return sizeof(struct unallocSpaceEntry);
sizeof(struct fileEntry)) + UDF_I(inode)->i_lenEAttr)) else if (iinfo->i_efe)
return sizeof(struct extendedFileEntry) + iinfo->i_lenEAttr;
#define udf_ext0_offset(inode)\ else
(UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ?\ return sizeof(struct fileEntry) + iinfo->i_lenEAttr;
udf_file_entry_alloc_offset(inode) : 0) }
static inline size_t udf_ext0_offset(struct inode *inode)
{
if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
return udf_file_entry_alloc_offset(inode);
else
return 0;
}
#define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset)) #define udf_get_lb_pblock(sb,loc,offset) udf_get_pblock((sb), (loc).logicalBlockNum, (loc).partitionReferenceNum, (offset))
...@@ -83,7 +111,6 @@ struct extent_position { ...@@ -83,7 +111,6 @@ struct extent_position {
}; };
/* super.c */ /* super.c */
extern void udf_error(struct super_block *, const char *, const char *, ...);
extern void udf_warning(struct super_block *, const char *, const char *, ...); extern void udf_warning(struct super_block *, const char *, const char *, ...);
/* namei.c */ /* namei.c */
...@@ -150,6 +177,8 @@ extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t, ...@@ -150,6 +177,8 @@ extern uint32_t udf_get_pblock_virt20(struct super_block *, uint32_t, uint16_t,
uint32_t); uint32_t);
extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t, extern uint32_t udf_get_pblock_spar15(struct super_block *, uint32_t, uint16_t,
uint32_t); uint32_t);
extern uint32_t udf_get_pblock_meta25(struct super_block *, uint32_t, uint16_t,
uint32_t);
extern int udf_relocate_blocks(struct super_block *, long, long *); extern int udf_relocate_blocks(struct super_block *, long, long *);
/* unicode.c */ /* unicode.c */
...@@ -157,7 +186,7 @@ extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int); ...@@ -157,7 +186,7 @@ extern int udf_get_filename(struct super_block *, uint8_t *, uint8_t *, int);
extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *, extern int udf_put_filename(struct super_block *, const uint8_t *, uint8_t *,
int); int);
extern int udf_build_ustr(struct ustr *, dstring *, int); extern int udf_build_ustr(struct ustr *, dstring *, int);
extern int udf_CS0toUTF8(struct ustr *, struct ustr *); extern int udf_CS0toUTF8(struct ustr *, const struct ustr *);
/* ialloc.c */ /* ialloc.c */
extern void udf_free_inode(struct inode *); extern void udf_free_inode(struct inode *);
...@@ -191,11 +220,9 @@ extern struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, ...@@ -191,11 +220,9 @@ extern struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize,
extern long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int); extern long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int);
extern short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int); extern short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int);
/* crc.c */
extern uint16_t udf_crc(uint8_t *, uint32_t, uint16_t);
/* udftime.c */ /* udftime.c */
extern time_t *udf_stamp_to_time(time_t *, long *, kernel_timestamp); extern struct timespec *udf_disk_stamp_to_time(struct timespec *dest,
extern kernel_timestamp *udf_time_to_stamp(kernel_timestamp *, struct timespec); timestamp src);
extern timestamp *udf_time_to_disk_stamp(timestamp *dest, struct timespec src);
#endif /* __UDF_DECL_H */ #endif /* __UDF_DECL_H */
...@@ -24,17 +24,6 @@ static inline lb_addr cpu_to_lelb(kernel_lb_addr in) ...@@ -24,17 +24,6 @@ static inline lb_addr cpu_to_lelb(kernel_lb_addr in)
return out; return out;
} }
static inline kernel_timestamp lets_to_cpu(timestamp in)
{
kernel_timestamp out;
memcpy(&out, &in, sizeof(timestamp));
out.typeAndTimezone = le16_to_cpu(in.typeAndTimezone);
out.year = le16_to_cpu(in.year);
return out;
}
static inline short_ad lesa_to_cpu(short_ad in) static inline short_ad lesa_to_cpu(short_ad in)
{ {
short_ad out; short_ad out;
...@@ -85,15 +74,4 @@ static inline kernel_extent_ad leea_to_cpu(extent_ad in) ...@@ -85,15 +74,4 @@ static inline kernel_extent_ad leea_to_cpu(extent_ad in)
return out; return out;
} }
static inline timestamp cpu_to_lets(kernel_timestamp in)
{
timestamp out;
memcpy(&out, &in, sizeof(timestamp));
out.typeAndTimezone = cpu_to_le16(in.typeAndTimezone);
out.year = cpu_to_le16(in.year);
return out;
}
#endif /* __UDF_ENDIAN_H */ #endif /* __UDF_ENDIAN_H */
...@@ -85,39 +85,38 @@ extern struct timezone sys_tz; ...@@ -85,39 +85,38 @@ extern struct timezone sys_tz;
#define SECS_PER_HOUR (60 * 60) #define SECS_PER_HOUR (60 * 60)
#define SECS_PER_DAY (SECS_PER_HOUR * 24) #define SECS_PER_DAY (SECS_PER_HOUR * 24)
time_t *udf_stamp_to_time(time_t *dest, long *dest_usec, kernel_timestamp src) struct timespec *udf_disk_stamp_to_time(struct timespec *dest, timestamp src)
{ {
int yday; int yday;
uint8_t type = src.typeAndTimezone >> 12; u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone);
u16 year = le16_to_cpu(src.year);
uint8_t type = typeAndTimezone >> 12;
int16_t offset; int16_t offset;
if (type == 1) { if (type == 1) {
offset = src.typeAndTimezone << 4; offset = typeAndTimezone << 4;
/* sign extent offset */ /* sign extent offset */
offset = (offset >> 4); offset = (offset >> 4);
if (offset == -2047) /* unspecified offset */ if (offset == -2047) /* unspecified offset */
offset = 0; offset = 0;
} else { } else
offset = 0; offset = 0;
}
if ((src.year < EPOCH_YEAR) || if ((year < EPOCH_YEAR) ||
(src.year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) { (year >= EPOCH_YEAR + MAX_YEAR_SECONDS)) {
*dest = -1;
*dest_usec = -1;
return NULL; return NULL;
} }
*dest = year_seconds[src.year - EPOCH_YEAR]; dest->tv_sec = year_seconds[year - EPOCH_YEAR];
*dest -= offset * 60; dest->tv_sec -= offset * 60;
yday = ((__mon_yday[__isleap(src.year)][src.month - 1]) + src.day - 1); yday = ((__mon_yday[__isleap(year)][src.month - 1]) + src.day - 1);
*dest += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second; dest->tv_sec += (((yday * 24) + src.hour) * 60 + src.minute) * 60 + src.second;
*dest_usec = src.centiseconds * 10000 + dest->tv_nsec = 1000 * (src.centiseconds * 10000 +
src.hundredsOfMicroseconds * 100 + src.microseconds; src.hundredsOfMicroseconds * 100 + src.microseconds);
return dest; return dest;
} }
kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) timestamp *udf_time_to_disk_stamp(timestamp *dest, struct timespec ts)
{ {
long int days, rem, y; long int days, rem, y;
const unsigned short int *ip; const unsigned short int *ip;
...@@ -128,7 +127,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) ...@@ -128,7 +127,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts)
if (!dest) if (!dest)
return NULL; return NULL;
dest->typeAndTimezone = 0x1000 | (offset & 0x0FFF); dest->typeAndTimezone = cpu_to_le16(0x1000 | (offset & 0x0FFF));
ts.tv_sec += offset * 60; ts.tv_sec += offset * 60;
days = ts.tv_sec / SECS_PER_DAY; days = ts.tv_sec / SECS_PER_DAY;
...@@ -151,7 +150,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts) ...@@ -151,7 +150,7 @@ kernel_timestamp *udf_time_to_stamp(kernel_timestamp *dest, struct timespec ts)
- LEAPS_THRU_END_OF(y - 1)); - LEAPS_THRU_END_OF(y - 1));
y = yg; y = yg;
} }
dest->year = y; dest->year = cpu_to_le16(y);
ip = __mon_yday[__isleap(y)]; ip = __mon_yday[__isleap(y)];
for (y = 11; days < (long int)ip[y]; --y) for (y = 11; days < (long int)ip[y]; --y)
continue; continue;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> /* for memset */ #include <linux/string.h> /* for memset */
#include <linux/nls.h> #include <linux/nls.h>
#include <linux/udf_fs.h> #include <linux/crc-itu-t.h>
#include "udf_sb.h" #include "udf_sb.h"
...@@ -49,14 +49,16 @@ int udf_build_ustr(struct ustr *dest, dstring *ptr, int size) ...@@ -49,14 +49,16 @@ int udf_build_ustr(struct ustr *dest, dstring *ptr, int size)
{ {
int usesize; int usesize;
if ((!dest) || (!ptr) || (!size)) if (!dest || !ptr || !size)
return -1; return -1;
BUG_ON(size < 2);
memset(dest, 0, sizeof(struct ustr)); usesize = min_t(size_t, ptr[size - 1], sizeof(dest->u_name));
usesize = (size > UDF_NAME_LEN) ? UDF_NAME_LEN : size; usesize = min(usesize, size - 2);
dest->u_cmpID = ptr[0]; dest->u_cmpID = ptr[0];
dest->u_len = ptr[size - 1]; dest->u_len = usesize;
memcpy(dest->u_name, ptr + 1, usesize - 1); memcpy(dest->u_name, ptr + 1, usesize);
memset(dest->u_name + usesize, 0, sizeof(dest->u_name) - usesize);
return 0; return 0;
} }
...@@ -83,9 +85,6 @@ static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize) ...@@ -83,9 +85,6 @@ static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
* PURPOSE * PURPOSE
* Convert OSTA Compressed Unicode to the UTF-8 equivalent. * Convert OSTA Compressed Unicode to the UTF-8 equivalent.
* *
* DESCRIPTION
* This routine is only called by udf_filldir().
*
* PRE-CONDITIONS * PRE-CONDITIONS
* utf Pointer to UTF-8 output buffer. * utf Pointer to UTF-8 output buffer.
* ocu Pointer to OSTA Compressed Unicode input buffer * ocu Pointer to OSTA Compressed Unicode input buffer
...@@ -99,43 +98,39 @@ static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize) ...@@ -99,43 +98,39 @@ static int udf_build_ustr_exact(struct ustr *dest, dstring *ptr, int exactsize)
* November 12, 1997 - Andrew E. Mileski * November 12, 1997 - Andrew E. Mileski
* Written, tested, and released. * Written, tested, and released.
*/ */
int udf_CS0toUTF8(struct ustr *utf_o, struct ustr *ocu_i) int udf_CS0toUTF8(struct ustr *utf_o, const struct ustr *ocu_i)
{ {
uint8_t *ocu; const uint8_t *ocu;
uint32_t c;
uint8_t cmp_id, ocu_len; uint8_t cmp_id, ocu_len;
int i; int i;
ocu = ocu_i->u_name;
ocu_len = ocu_i->u_len; ocu_len = ocu_i->u_len;
cmp_id = ocu_i->u_cmpID;
utf_o->u_len = 0;
if (ocu_len == 0) { if (ocu_len == 0) {
memset(utf_o, 0, sizeof(struct ustr)); memset(utf_o, 0, sizeof(struct ustr));
utf_o->u_cmpID = 0;
utf_o->u_len = 0;
return 0; return 0;
} }
if ((cmp_id != 8) && (cmp_id != 16)) { cmp_id = ocu_i->u_cmpID;
if (cmp_id != 8 && cmp_id != 16) {
memset(utf_o, 0, sizeof(struct ustr));
printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n", printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n",
cmp_id, ocu_i->u_name); cmp_id, ocu_i->u_name);
return 0; return 0;
} }
ocu = ocu_i->u_name;
utf_o->u_len = 0;
for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) { for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) {
/* Expand OSTA compressed Unicode to Unicode */ /* Expand OSTA compressed Unicode to Unicode */
c = ocu[i++]; uint32_t c = ocu[i++];
if (cmp_id == 16) if (cmp_id == 16)
c = (c << 8) | ocu[i++]; c = (c << 8) | ocu[i++];
/* Compress Unicode to UTF-8 */ /* Compress Unicode to UTF-8 */
if (c < 0x80U) { if (c < 0x80U)
utf_o->u_name[utf_o->u_len++] = (uint8_t)c; utf_o->u_name[utf_o->u_len++] = (uint8_t)c;
} else if (c < 0x800U) { else if (c < 0x800U) {
utf_o->u_name[utf_o->u_len++] = utf_o->u_name[utf_o->u_len++] =
(uint8_t)(0xc0 | (c >> 6)); (uint8_t)(0xc0 | (c >> 6));
utf_o->u_name[utf_o->u_len++] = utf_o->u_name[utf_o->u_len++] =
...@@ -255,35 +250,32 @@ static int udf_UTF8toCS0(dstring *ocu, struct ustr *utf, int length) ...@@ -255,35 +250,32 @@ static int udf_UTF8toCS0(dstring *ocu, struct ustr *utf, int length)
} }
static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o,
struct ustr *ocu_i) const struct ustr *ocu_i)
{ {
uint8_t *ocu; const uint8_t *ocu;
uint32_t c;
uint8_t cmp_id, ocu_len; uint8_t cmp_id, ocu_len;
int i; int i;
ocu = ocu_i->u_name;
ocu_len = ocu_i->u_len; ocu_len = ocu_i->u_len;
cmp_id = ocu_i->u_cmpID;
utf_o->u_len = 0;
if (ocu_len == 0) { if (ocu_len == 0) {
memset(utf_o, 0, sizeof(struct ustr)); memset(utf_o, 0, sizeof(struct ustr));
utf_o->u_cmpID = 0;
utf_o->u_len = 0;
return 0; return 0;
} }
if ((cmp_id != 8) && (cmp_id != 16)) { cmp_id = ocu_i->u_cmpID;
if (cmp_id != 8 && cmp_id != 16) {
memset(utf_o, 0, sizeof(struct ustr));
printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n", printk(KERN_ERR "udf: unknown compression code (%d) stri=%s\n",
cmp_id, ocu_i->u_name); cmp_id, ocu_i->u_name);
return 0; return 0;
} }
ocu = ocu_i->u_name;
utf_o->u_len = 0;
for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) { for (i = 0; (i < ocu_len) && (utf_o->u_len <= (UDF_NAME_LEN - 3));) {
/* Expand OSTA compressed Unicode to Unicode */ /* Expand OSTA compressed Unicode to Unicode */
c = ocu[i++]; uint32_t c = ocu[i++];
if (cmp_id == 16) if (cmp_id == 16)
c = (c << 8) | ocu[i++]; c = (c << 8) | ocu[i++];
...@@ -463,7 +455,7 @@ static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName, ...@@ -463,7 +455,7 @@ static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName,
} else if (newIndex > 250) } else if (newIndex > 250)
newIndex = 250; newIndex = 250;
newName[newIndex++] = CRC_MARK; newName[newIndex++] = CRC_MARK;
valueCRC = udf_crc(fidName, fidNameLen, 0); valueCRC = crc_itu_t(0, fidName, fidNameLen);
newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12]; newName[newIndex++] = hexChar[(valueCRC & 0xf000) >> 12];
newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8]; newName[newIndex++] = hexChar[(valueCRC & 0x0f00) >> 8];
newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4]; newName[newIndex++] = hexChar[(valueCRC & 0x00f0) >> 4];
......
...@@ -150,6 +150,7 @@ header-y += tiocl.h ...@@ -150,6 +150,7 @@ header-y += tiocl.h
header-y += tipc.h header-y += tipc.h
header-y += tipc_config.h header-y += tipc_config.h
header-y += toshiba.h header-y += toshiba.h
header-y += udf_fs_i.h
header-y += ultrasound.h header-y += ultrasound.h
header-y += un.h header-y += un.h
header-y += utime.h header-y += utime.h
...@@ -334,7 +335,6 @@ unifdef-y += time.h ...@@ -334,7 +335,6 @@ unifdef-y += time.h
unifdef-y += timex.h unifdef-y += timex.h
unifdef-y += tty.h unifdef-y += tty.h
unifdef-y += types.h unifdef-y += types.h
unifdef-y += udf_fs_i.h
unifdef-y += udp.h unifdef-y += udp.h
unifdef-y += uinput.h unifdef-y += uinput.h
unifdef-y += uio.h unifdef-y += uio.h
......
/*
* udf_fs.h
*
* PURPOSE
* Included by fs/filesystems.c
*
* DESCRIPTION
* OSTA-UDF(tm) = Optical Storage Technology Association
* Universal Disk Format.
*
* This code is based on version 2.50 of the UDF specification,
* and revision 3 of the ECMA 167 standard [equivalent to ISO 13346].
* http://www.osta.org/ * http://www.ecma.ch/
* http://www.iso.org/
*
* COPYRIGHT
* This file is distributed under the terms of the GNU General Public
* License (GPL). Copies of the GPL can be obtained from:
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*
* (C) 1999-2004 Ben Fennema
* (C) 1999-2000 Stelias Computing Inc
*
* HISTORY
*
*/
#ifndef _UDF_FS_H
#define _UDF_FS_H 1
#define UDF_PREALLOCATE
#define UDF_DEFAULT_PREALLOC_BLOCKS 8
#undef UDFFS_DEBUG
#ifdef UDFFS_DEBUG
#define udf_debug(f, a...) \
do { \
printk (KERN_DEBUG "UDF-fs DEBUG %s:%d:%s: ", \
__FILE__, __LINE__, __FUNCTION__); \
printk (f, ##a); \
} while (0)
#else
#define udf_debug(f, a...) /**/
#endif
#define udf_info(f, a...) \
printk (KERN_INFO "UDF-fs INFO " f, ##a);
#endif /* _UDF_FS_H */
...@@ -9,41 +9,10 @@ ...@@ -9,41 +9,10 @@
* 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.
*/ */
#ifndef _UDF_FS_I_H #ifndef _UDF_FS_I_H
#define _UDF_FS_I_H 1 #define _UDF_FS_I_H 1
#ifdef __KERNEL__
struct udf_inode_info
{
struct timespec i_crtime;
/* Physical address of inode */
kernel_lb_addr i_location;
__u64 i_unique;
__u32 i_lenEAttr;
__u32 i_lenAlloc;
__u64 i_lenExtents;
__u32 i_next_alloc_block;
__u32 i_next_alloc_goal;
unsigned i_alloc_type : 3;
unsigned i_efe : 1;
unsigned i_use : 1;
unsigned i_strat4096 : 1;
unsigned reserved : 26;
union
{
short_ad *i_sad;
long_ad *i_lad;
__u8 *i_data;
} i_ext;
struct inode vfs_inode;
};
#endif
/* exported IOCTLs, we have 'l', 0x40-0x7f */ /* exported IOCTLs, we have 'l', 0x40-0x7f */
#define UDF_GETEASIZE _IOR('l', 0x40, int) #define UDF_GETEASIZE _IOR('l', 0x40, int)
#define UDF_GETEABLOCK _IOR('l', 0x41, void *) #define UDF_GETEABLOCK _IOR('l', 0x41, void *)
#define UDF_GETVOLIDENT _IOR('l', 0x42, void *) #define UDF_GETVOLIDENT _IOR('l', 0x42, void *)
......
/*
* udf_fs_sb.h
*
* This include file is for the Linux kernel/module.
*
* COPYRIGHT
* This file is distributed under the terms of the GNU General Public
* License (GPL). Copies of the GPL can be obtained from:
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*/
#ifndef _UDF_FS_SB_H
#define _UDF_FS_SB_H 1
#include <linux/mutex.h>
#pragma pack(1)
#define UDF_MAX_BLOCK_LOADED 8
#define UDF_TYPE1_MAP15 0x1511U
#define UDF_VIRTUAL_MAP15 0x1512U
#define UDF_VIRTUAL_MAP20 0x2012U
#define UDF_SPARABLE_MAP15 0x1522U
struct udf_sparing_data
{
__u16 s_packet_len;
struct buffer_head *s_spar_map[4];
};
struct udf_virtual_data
{
__u32 s_num_entries;
__u16 s_start_offset;
};
struct udf_bitmap
{
__u32 s_extLength;
__u32 s_extPosition;
__u16 s_nr_groups;
struct buffer_head **s_block_bitmap;
};
struct udf_part_map
{
union
{
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_uspace;
union
{
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_fspace;
__u32 s_partition_root;
__u32 s_partition_len;
__u16 s_partition_type;
__u16 s_partition_num;
union
{
struct udf_sparing_data s_sparing;
struct udf_virtual_data s_virtual;
} s_type_specific;
__u32 (*s_partition_func)(struct super_block *, __u32, __u16, __u32);
__u16 s_volumeseqnum;
__u16 s_partition_flags;
};
#pragma pack()
struct udf_sb_info
{
struct udf_part_map *s_partmaps;
__u8 s_volume_ident[32];
/* Overall info */
__u16 s_partitions;
__u16 s_partition;
/* Sector headers */
__s32 s_session;
__u32 s_anchor[4];
__u32 s_last_block;
struct buffer_head *s_lvid_bh;
/* Default permissions */
mode_t s_umask;
gid_t s_gid;
uid_t s_uid;
/* Root Info */
struct timespec s_record_time;
/* Fileset Info */
__u16 s_serial_number;
/* highest UDF revision we have recorded to this media */
__u16 s_udfrev;
/* Miscellaneous flags */
__u32 s_flags;
/* Encoding info */
struct nls_table *s_nls_map;
/* VAT inode */
struct inode *s_vat_inode;
struct mutex s_alloc_mutex;
};
#endif /* _UDF_FS_SB_H */
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