Delete extra whitespace at the end of line, which annoys quilt

git-svn-id: svn://coreboot.org/openbios/openbios-devel@284 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2008-12-11 20:30:53 +00:00
parent 3038a07be7
commit 58ca864765
200 changed files with 1661 additions and 1661 deletions

View File

@@ -1,25 +1,25 @@
/*
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
*
* Carnegie Mellon requests users of this software to return to
*
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/

View File

@@ -1,26 +1,26 @@
/*
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
*
* Carnegie Mellon requests users of this software to return to
*
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/

View File

@@ -1,25 +1,25 @@
/*
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
*
* Carnegie Mellon requests users of this software to return to
*
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/

View File

@@ -1,4 +1,4 @@
/* GRUB compatibility header
/* GRUB compatibility header
*
* taken from filo and grub.
*/
@@ -76,21 +76,21 @@ static __inline__ unsigned int log2(unsigned int word)
/* assume 8 bits per byte. */
unsigned int i = 1 << (sizeof(word)*8 - 1);
unsigned int pow = sizeof(word) * 8 - 1;
if (! word) {
/* invalid parameter */
return -1;
}
for(; i > word; i >>= 1, pow--) ;
return pow;
return pow;
}
#define ffz(n) log2(~(n))
#endif
static inline int
static inline int
substring (const char *s1, const char *s2)
{
while (*s1 == *s2)
@@ -115,7 +115,7 @@ substring (const char *s1, const char *s2)
#define MAXINT 0x7fffffff
/* This is only used by fsys_* to determine if it's hard disk. If it is,
* they try to guess filesystem type by partition type. I guess it is
* they try to guess filesystem type by partition type. I guess it is
* not necessory, so hardcoded to 0 (first floppy) --ts1 */
#define current_drive 0
#define current_slice 0

View File

@@ -1,25 +1,25 @@
/*
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
*
* Carnegie Mellon requests users of this software to return to
*
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
@@ -75,7 +75,7 @@
/*
* Addresses stored in inodes are capable of addressing fragments
* of `blocks'. File system blocks of at most size MAXBSIZE can
* of `blocks'. File system blocks of at most size MAXBSIZE can
* be optionally broken into 2, 4, or 8 pieces, each of which is
* addressible; these pieces may be DEV_BSIZE, or some multiple of
* a DEV_BSIZE unit.
@@ -113,7 +113,7 @@
/*
* The path name on which the file system is mounted is maintained
* in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
* in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
* the super block for this name.
* The limit on the amount of summary information per file system
* is defined by MAXCSBUFS. It is currently parameterized for a

View File

@@ -92,7 +92,7 @@ struct PartitionBlock
#define ST_FILE -3
#define ST_ROOT 1
#define ST_USERDIR 2
#define ST_USERDIR 2
struct BootBlock{
int id;
@@ -465,7 +465,7 @@ unsigned char length;
static unsigned int getHashKey(char *name,unsigned int tablesize, unsigned char flags)
{
unsigned int length;
length=0;
while (name[length] != 0)
length++;
@@ -667,7 +667,7 @@ int affs_dir(char *dirname)
if (print_possibilities>0)
print_possibilities = -print_possibilities;
#endif
}
}
else
{
errnum = ERR_BAD_FILETYPE;
@@ -689,7 +689,7 @@ int affs_dir(char *dirname)
while (*current && !isspace(*current))
*fname++ = *current++;
*fname = 0;
errnum = findBlock(filename, &buffer2);
if (errnum)
return 0;

View File

@@ -285,7 +285,7 @@ dump_inode(struct ext2_inode *i)
printf(" flags=%d\n", __le32_to_cpu(i->i_flags));
}
void
void
dump_inode_data(unsigned char *inode, int len)
{
static char hexdigit[] = "0123456789abcdef";
@@ -333,8 +333,8 @@ static int
ext2_rdfsb (int fsblock, char * buffer)
{
#ifdef E2DEBUG
printf ("ext2_rdfsb: fsblock %d, devblock %d, size %d\n", fsblock,
fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
printf ("ext2_rdfsb: fsblock %d, devblock %d, size %d\n", fsblock,
fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE),
EXT2_BLOCK_SIZE (SUPERBLOCK));
#endif /* E2DEBUG */
return devread (fsblock * (EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE), 0,
@@ -574,14 +574,14 @@ ext2fs_dir (char *dirname)
#ifdef E2DEBUG
dump_group_desc(GROUP_DESC);
#endif /* E2DEBUG */
#endif /* E2DEBUG */
gdp = GROUP_DESC;
ino_blk = __le32_to_cpu(gdp[desc].bg_inode_table) +
(((current_ino - 1) % __le32_to_cpu(SUPERBLOCK->s_inodes_per_group))
>> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
#ifdef E2DEBUG
printf ("ext2fs_dir: itab_blk=%d, i_in_grp=%d, log2=%d\n",
printf ("ext2fs_dir: itab_blk=%d, i_in_grp=%d, log2=%d\n",
__le32_to_cpu(gdp[desc].bg_inode_table),
((current_ino - 1) % __le32_to_cpu(SUPERBLOCK->s_inodes_per_group)),
log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));

View File

@@ -23,7 +23,7 @@
#include "filesys.h"
#include "fat.h"
struct fat_superblock
struct fat_superblock
{
int fat_offset;
int fat_length;
@@ -31,7 +31,7 @@ struct fat_superblock
int root_offset;
int root_max;
int data_offset;
int num_sectors;
int num_clust;
int clust_eof_marker;
@@ -39,7 +39,7 @@ struct fat_superblock
int sectsize_bits;
int clustsize_bits;
int root_cluster;
int cached_fat;
int file_cluster;
int current_cluster_num;
@@ -59,13 +59,13 @@ fat_mount (void)
{
struct fat_bpb bpb;
__u32 magic, first_fat;
/* Check partition type for harddisk */
if (((current_drive & 0x80) || (current_slice != 0))
&& ! IS_PC_SLICE_TYPE_FAT (current_slice)
&& (! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_MSDOS)))
return 0;
/* Read bpb */
if (! devread (0, 0, sizeof (bpb), (char *) &bpb))
return 0;
@@ -74,40 +74,40 @@ fat_mount (void)
zero division. */
if (bpb.sects_per_clust == 0)
return 0;
FAT_SUPER->sectsize_bits = log2 (bpb.bytes_per_sect);
FAT_SUPER->clustsize_bits
= FAT_SUPER->sectsize_bits + log2 (bpb.sects_per_clust);
/* Fill in info about super block */
FAT_SUPER->num_sectors = bpb.short_sectors
FAT_SUPER->num_sectors = bpb.short_sectors
? bpb.short_sectors : bpb.long_sectors;
/* FAT offset and length */
FAT_SUPER->fat_offset = bpb.reserved_sects;
FAT_SUPER->fat_length =
FAT_SUPER->fat_length =
bpb.fat_length ? bpb.fat_length : bpb.fat32_length;
/* Rootdir offset and length for FAT12/16 */
FAT_SUPER->root_offset =
FAT_SUPER->root_offset =
FAT_SUPER->fat_offset + bpb.num_fats * FAT_SUPER->fat_length;
FAT_SUPER->root_max = FAT_DIRENTRY_LENGTH * bpb.dir_entries;
/* Data offset and number of clusters */
FAT_SUPER->data_offset =
FAT_SUPER->data_offset =
FAT_SUPER->root_offset
+ ((FAT_SUPER->root_max - 1) >> FAT_SUPER->sectsize_bits) + 1;
FAT_SUPER->num_clust =
2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset)
FAT_SUPER->num_clust =
2 + ((FAT_SUPER->num_sectors - FAT_SUPER->data_offset)
/ bpb.sects_per_clust);
FAT_SUPER->sects_per_clust = bpb.sects_per_clust;
if (!bpb.fat_length)
{
/* This is a FAT32 */
if (bpb.dir_entries)
return 0;
if (bpb.flags & 0x0080)
{
/* FAT mirroring is disabled, get active FAT */
@@ -116,34 +116,34 @@ fat_mount (void)
return 0;
FAT_SUPER->fat_offset += active_fat * FAT_SUPER->fat_length;
}
FAT_SUPER->fat_size = 8;
FAT_SUPER->root_cluster = bpb.root_cluster;
/* Yes the following is correct. FAT32 should be called FAT28 :) */
FAT_SUPER->clust_eof_marker = 0xffffff8;
}
else
}
else
{
if (!FAT_SUPER->root_max)
return 0;
FAT_SUPER->root_cluster = -1;
if (FAT_SUPER->num_clust > FAT_MAX_12BIT_CLUST)
if (FAT_SUPER->num_clust > FAT_MAX_12BIT_CLUST)
{
FAT_SUPER->fat_size = 4;
FAT_SUPER->clust_eof_marker = 0xfff8;
}
}
else
{
FAT_SUPER->fat_size = 3;
FAT_SUPER->clust_eof_marker = 0xff8;
}
}
/* Now do some sanity checks */
if (bpb.bytes_per_sect != (1 << FAT_SUPER->sectsize_bits)
|| bpb.bytes_per_sect != SECTOR_SIZE
|| bpb.sects_per_clust != (1 << (FAT_SUPER->clustsize_bits
@@ -152,7 +152,7 @@ fat_mount (void)
|| (FAT_SUPER->fat_size * FAT_SUPER->num_clust / (2 * SECTOR_SIZE)
> FAT_SUPER->fat_length))
return 0;
/* kbs: Media check on first FAT entry [ported from PUPA] */
if (!devread(FAT_SUPER->fat_offset, 0,
@@ -189,7 +189,7 @@ fat_read (char *buf, int len)
int offset;
int ret = 0;
int size;
if (FAT_SUPER->file_cluster < 0)
{
/* root directory for fat16 */
@@ -201,7 +201,7 @@ fat_read (char *buf, int len)
filepos += size;
return size;
}
logical_clust = filepos >> FAT_SUPER->clustsize_bits;
offset = (filepos & ((1 << FAT_SUPER->clustsize_bits) - 1));
if (logical_clust < FAT_SUPER->current_cluster_num)
@@ -209,19 +209,19 @@ fat_read (char *buf, int len)
FAT_SUPER->current_cluster_num = 0;
FAT_SUPER->current_cluster = FAT_SUPER->file_cluster;
}
while (len > 0)
{
int sector;
while (logical_clust > FAT_SUPER->current_cluster_num)
{
/* calculate next cluster */
int fat_entry =
int fat_entry =
FAT_SUPER->current_cluster * FAT_SUPER->fat_size;
int next_cluster;
int cached_pos = (fat_entry - FAT_SUPER->cached_fat);
if (cached_pos < 0 ||
if (cached_pos < 0 ||
(cached_pos + FAT_SUPER->fat_size) > 2*FAT_CACHE_SIZE)
{
FAT_SUPER->cached_fat = (fat_entry & ~(2*SECTOR_SIZE - 1));
@@ -240,7 +240,7 @@ fat_read (char *buf, int len)
}
else if (FAT_SUPER->fat_size == 4)
next_cluster &= 0xFFFF;
if (next_cluster >= FAT_SUPER->clust_eof_marker)
return ret;
if (next_cluster < 2 || next_cluster >= FAT_SUPER->num_clust)
@@ -248,24 +248,24 @@ fat_read (char *buf, int len)
errnum = ERR_FSYS_CORRUPT;
return 0;
}
FAT_SUPER->current_cluster = next_cluster;
FAT_SUPER->current_cluster_num++;
}
sector = FAT_SUPER->data_offset +
((FAT_SUPER->current_cluster - 2) << (FAT_SUPER->clustsize_bits
- FAT_SUPER->sectsize_bits));
size = (1 << FAT_SUPER->clustsize_bits) - offset;
if (size > len)
size = len;
disk_read_func = disk_read_hook;
devread(sector, offset, size, buf);
disk_read_func = NULL;
len -= size;
buf += size;
ret += size;
@@ -285,25 +285,25 @@ fat_dir (char *dirname)
#ifndef STAGE1_5
int do_possibilities = 0;
#endif
/* XXX I18N:
* the positions 2,4,6 etc are high bytes of a 16 bit unicode char
* the positions 2,4,6 etc are high bytes of a 16 bit unicode char
*/
static unsigned char longdir_pos[] =
static unsigned char longdir_pos[] =
{ 1, 3, 5, 7, 9, 14, 16, 18, 20, 22, 24, 28, 30 };
int slot = -2;
int alias_checksum = -1;
FAT_SUPER->file_cluster = FAT_SUPER->root_cluster;
filepos = 0;
FAT_SUPER->current_cluster_num = MAXINT;
/* main loop to find desired directory entry */
loop:
/* if we have a real file (and we're not just printing possibilities),
then this is where we want to exit */
if (!*dirname || isspace (*dirname))
{
if (attrib & FAT_ATTRIB_DIR)
@@ -311,15 +311,15 @@ fat_dir (char *dirname)
errnum = ERR_BAD_FILETYPE;
return 0;
}
return 1;
}
/* continue with the file/directory name interpretation */
while (*dirname == '/')
dirname++;
if (!(attrib & FAT_ATTRIB_DIR))
{
errnum = ERR_BAD_FILETYPE;
@@ -327,16 +327,16 @@ fat_dir (char *dirname)
}
/* Directories don't have a file size */
filemax = MAXINT;
for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++);
*rest = 0;
# ifndef STAGE1_5
if (print_possibilities && ch != '/')
do_possibilities = 1;
# endif
while (1)
{
if (fat_read (dir_buf, FAT_DIRENTRY_LENGTH) != FAT_DIRENTRY_LENGTH
@@ -353,14 +353,14 @@ fat_dir (char *dirname)
return 1;
}
# endif /* STAGE1_5 */
errnum = ERR_FILE_NOT_FOUND;
*rest = ch;
}
return 0;
}
if (FAT_DIRENTRY_ATTRIB (dir_buf) == FAT_ATTRIB_LONGNAME)
{
/* This is a long filename. The filename is build from back
@@ -377,72 +377,72 @@ fat_dir (char *dirname)
*/
int i, offset;
unsigned char id = FAT_LONGDIR_ID(dir_buf);
if ((id & 0x40))
if ((id & 0x40))
{
id &= 0x3f;
slot = id;
filename[slot * 13] = 0;
alias_checksum = FAT_LONGDIR_ALIASCHECKSUM(dir_buf);
}
}
if (id != slot || slot == 0
|| alias_checksum != FAT_LONGDIR_ALIASCHECKSUM(dir_buf))
{
alias_checksum = -1;
continue;
}
slot--;
offset = slot * 13;
for (i=0; i < 13; i++)
filename[offset+i] = dir_buf[longdir_pos[i]];
continue;
}
if (!FAT_DIRENTRY_VALID (dir_buf))
continue;
if (alias_checksum != -1 && slot == 0)
{
int i;
unsigned char sum;
slot = -2;
for (sum = 0, i = 0; i< 11; i++)
sum = ((sum >> 1) | (sum << 7)) + dir_buf[i];
if (sum == alias_checksum)
{
# ifndef STAGE1_5
if (do_possibilities)
goto print_filename;
# endif /* STAGE1_5 */
if (substring (dirname, filename) == 0)
break;
}
}
/* XXX convert to 8.3 filename format here */
{
int i, j, c;
for (i = 0; i < 8 && (c = filename[i] = tolower (dir_buf[i]))
&& !isspace (c); i++);
filename[i++] = '.';
for (j = 0; j < 3 && (c = filename[i + j] = tolower (dir_buf[8 + j]))
&& !isspace (c); j++);
if (j == 0)
i--;
filename[i + j] = 0;
}
# ifndef STAGE1_5
if (do_possibilities)
{
@@ -456,19 +456,19 @@ fat_dir (char *dirname)
continue;
}
# endif /* STAGE1_5 */
if (substring (dirname, filename) == 0)
break;
}
*(dirname = rest) = ch;
attrib = FAT_DIRENTRY_ATTRIB (dir_buf);
filemax = FAT_DIRENTRY_FILELENGTH (dir_buf);
filepos = 0;
FAT_SUPER->file_cluster = FAT_DIRENTRY_FIRST_CLUSTER (dir_buf);
FAT_SUPER->current_cluster_num = MAXINT;
/* go back to main loop at top of function */
goto loop;
}

View File

@@ -91,7 +91,7 @@ ffs_mount (void)
mapblock = -1;
mapblock_offset = -1;
return retval;
}
@@ -99,10 +99,10 @@ static int
block_map (int file_block)
{
int bnum, offset, bsize;
if (file_block < NDADDR)
return (INODE->i_db[file_block]);
/* If the blockmap loaded does not include FILE_BLOCK,
load a new blockmap. */
if ((bnum = fsbtodb (SUPERBLOCK, INODE->i_ib[0])) != mapblock
@@ -112,7 +112,7 @@ block_map (int file_block)
{
offset = ((file_block - NDADDR) % NINDIR (SUPERBLOCK));
bsize = MAPBUF_LEN;
if (offset + MAPBUF_LEN > SUPERBLOCK->fs_bsize)
offset = (SUPERBLOCK->fs_bsize - MAPBUF_LEN) / sizeof (int);
}
@@ -121,7 +121,7 @@ block_map (int file_block)
bsize = SUPERBLOCK->fs_bsize;
offset = 0;
}
if (! devread (bnum, offset * sizeof (int), bsize, (char *) MAPBUF))
{
mapblock = -1;
@@ -130,12 +130,12 @@ block_map (int file_block)
errnum = ERR_FSYS_CORRUPT;
return -1;
}
mapblock = bnum;
mapblock_bsize = bsize;
mapblock_offset = offset;
}
return (((int *) MAPBUF)[((file_block - NDADDR) % NINDIR (SUPERBLOCK))
- mapblock_offset]);
}
@@ -145,7 +145,7 @@ int
ffs_read (char *buf, int len)
{
int logno, off, size, map, ret = 0;
while (len && !errnum)
{
off = blkoff (SUPERBLOCK, filepos);
@@ -296,7 +296,7 @@ ffs_embed (int *start_sector, int needed_sectors)
familiar with BSD should check for this. */
if (needed_sectors > 14)
return 0;
*start_sector = 1;
#if 1
/* FIXME: Disable the embedding in FFS until someone checks if

View File

@@ -82,7 +82,7 @@ iso9660_mount (void)
*/
for (sector = 16 ; sector < 32 ; sector++)
{
if (!iso9660_devread(sector, 0, sizeof(*PRIMDESC), (char *)PRIMDESC))
if (!iso9660_devread(sector, 0, sizeof(*PRIMDESC), (char *)PRIMDESC))
break;
/* check ISO_VD_PRIMARY and ISO_STANDARD_ID */
if (CHECK4(&PRIMDESC->type, ISO_VD_PRIMARY, 'C', 'D', '0')

View File

@@ -1,5 +1,5 @@
/* fsys_jfs.c - an implementation for the IBM JFS file system */
/*
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2001,2002 Free Software Foundation, Inc.
*
@@ -240,7 +240,7 @@ jfs_read (char *buf, int len)
offset = offsetXAD (xad);
xadlen = lengthXAD (xad);
if (isinxt (filepos >> jfs.l2bsize, offset, xadlen)) {
endofcur = (offset + xadlen) << jfs.l2bsize;
endofcur = (offset + xadlen) << jfs.l2bsize;
toread = (endofcur >= endpos)
? len : (endofcur - filepos);
@@ -262,7 +262,7 @@ jfs_read (char *buf, int len)
}
continue;
}
endofprev = offset + xadlen;
endofprev = offset + xadlen;
xad = next_extent ();
} while (len > 0 && xad);

View File

@@ -20,7 +20,7 @@
/* Restrictions:
This is MINIX V1 only (yet)
Disk creation is like:
mkfs.minix -c DEVICE
mkfs.minix -c DEVICE
*/
#ifdef FSYS_MINIX
@@ -75,7 +75,7 @@ typedef unsigned int __u32;
#define MINIX_V1 0x0001 /* original minix fs */
#define MINIX_V2 0x0002 /* minix V2 fs */
/* originally this is :
/* originally this is :
#define INODE_VERSION(inode) inode->i_sb->u.minix_sb.s_version
here we have */
#define INODE_VERSION(inode) (SUPERBLOCK->s_version)
@@ -164,15 +164,15 @@ minix_mount (void)
&& ! IS_PC_SLICE_TYPE_MINIX (current_slice)
&& ! IS_PC_SLICE_TYPE_BSD_WITH_FS (current_slice, FS_OTHER))
return 0; /* The partition is not of MINIX type */
if (part_length < (SBLOCK +
(sizeof (struct minix_super_block) / DEV_BSIZE)))
return 0; /* The partition is too short */
if (!devread (SBLOCK, 0, sizeof (struct minix_super_block),
(char *) SUPERBLOCK))
return 0; /* Cannot read superblock */
switch (SUPERBLOCK->s_magic)
{
case MINIX_SUPER_MAGIC:
@@ -210,7 +210,7 @@ minix_block_map (int logical_block)
if (logical_block < 512)
{
i = INODE->i_zone[7];
if (!i || ((mapblock1 != 1)
&& !minix_rdfsb (i, DATABLOCK1)))
{
@@ -311,7 +311,7 @@ minix_dir (char *dirname)
char * rest;
char ch;
int off; /* offset within block of directory
int off; /* offset within block of directory
entry */
int loc; /* location within a directory */
int blk; /* which data blk within dir entry */
@@ -326,7 +326,7 @@ minix_dir (char *dirname)
#ifdef DEBUG_MINIX
printf ("\n");
#endif
#endif
while (1)
{
@@ -345,7 +345,7 @@ minix_dir (char *dirname)
raw_inode = INODE + ((current_ino - 1) % MINIX_INODES_PER_BLOCK);
/* copy inode to fixed location */
memmove ((void *) INODE, (void *) raw_inode,
memmove ((void *) INODE, (void *) raw_inode,
sizeof (struct minix_inode));
/* If we've got a symbolic link, then chase it. */
@@ -430,7 +430,7 @@ minix_dir (char *dirname)
while (*dirname == '/')
dirname++;
/* if this isn't a directory of sufficient size to hold our file,
/* if this isn't a directory of sufficient size to hold our file,
abort */
if (!(INODE->i_size) || !S_ISDIR (INODE->i_mode))
{

View File

@@ -431,7 +431,7 @@ static int search_attribute( MFTR *mftr, int type, char *name)
{
#ifdef DEBUG_NTFS
printf("searching attribute %x <%s>\n", type, name);
#endif
#endif
mftr->attr_type = type;
mftr->attr_name = name;
@@ -907,7 +907,7 @@ printf("reading uninitialized data 3\n");
ret += len0;
}
#else
errnum = FSYS_CORRUPT;
errnum = FSYS_CORRUPT;
#endif /*NO_NTFS_DECOMPRESSION*/
#endif /*STAGE1_5*/
return ret;

View File

@@ -96,9 +96,9 @@ struct reiserfs_journal_commit {
/* this header block gets written whenever a transaction is considered
fully flushed, and is more recent than the last fully flushed
transaction.
transaction.
fully flushed means all the log blocks and all the real blocks are
on disk, and this transaction does not need to be replayed.
on disk, and this transaction does not need to be replayed.
*/
struct reiserfs_journal_header {
/* id of last fully flushed transaction */
@@ -110,7 +110,7 @@ struct reiserfs_journal_header {
};
/* magic string to find desc blocks in the journal */
#define JOURNAL_DESC_MAGIC "ReIsErLB"
#define JOURNAL_DESC_MAGIC "ReIsErLB"
/*
@@ -127,7 +127,7 @@ struct offset_v1
* hashing the name and using few bits (23 or more) of the resulting
* hash, and generation number that allows distinguishing names with
* hash collisions. If number of collisions overflows generation
* number, we return EEXIST. High order bit is 0 always
* number, we return EEXIST. High order bit is 0 always
*/
__u32 k_offset;
__u32 k_uniqueness;
@@ -144,7 +144,7 @@ struct offset_v2
* hashing the name and using few bits (23 or more) of the resulting
* hash, and generation number that allows distinguishing names with
* hash collisions. If number of collisions overflows generation
* number, we return EEXIST. High order bit is 0 always
* number, we return EEXIST. High order bit is 0 always
*/
__u64 k_offset:60;
__u64 k_type: 4;
@@ -171,7 +171,7 @@ struct key
/* Header of a disk block. More precisely, header of a formatted leaf
or internal node, and not the header of an unformatted node. */
struct block_head
{
{
__u16 blk_level; /* Level of a block in the tree. */
__u16 blk_nr_item; /* Number of keys/items in a block. */
__u16 blk_free_space; /* Block free space in bytes. */
@@ -184,7 +184,7 @@ struct block_head
struct item_head
{
struct key ih_key; /* Everything in the tree is found by searching for it based on its key.*/
union
{
__u16 ih_free_space; /* The free space in the last unformatted node of an indirect item if this
@@ -197,8 +197,8 @@ struct item_head
u;
__u16 ih_item_len; /* total size of the item body */
__u16 ih_item_location; /* an offset to the item body within the block */
__u16 ih_version; /* ITEM_VERSION_1 for all old items,
ITEM_VERSION_2 for new ones.
__u16 ih_version; /* ITEM_VERSION_1 for all old items,
ITEM_VERSION_2 for new ones.
Highest bit is set by fsck
temporary, cleaned after all done */
};
@@ -268,7 +268,7 @@ struct reiserfs_de_head
#define V2_TYPE_STAT_DATA 0
#define V2_TYPE_INDIRECT 1
#define V2_TYPE_DIRECT 2
#define V2_TYPE_DIRENTRY 3
#define V2_TYPE_DIRENTRY 3
#define REISERFS_ROOT_OBJECTID 2
#define REISERFS_ROOT_PARENT_OBJECTID 1
@@ -327,7 +327,7 @@ struct fsys_reiser_info
__u16 cached_slots;
/* The number of valid transactions in journal */
__u16 journal_transactions;
unsigned int blocks[MAX_HEIGHT];
unsigned int next_key_nr[MAX_HEIGHT];
};
@@ -348,13 +348,13 @@ struct fsys_reiser_info
*/
#define INFO \
((struct fsys_reiser_info *) ((char *) FSYS_BUF + FSYSREISER_CACHE_SIZE))
/*
/*
* The journal cache. For each transaction it contains the number of
* blocks followed by the real block numbers of this transaction.
* blocks followed by the real block numbers of this transaction.
*
* If the block numbers of some transaction won't fit in this space,
* this list is stopped with a 0xffffffff marker and the remaining
* uncommitted transactions aren't cached.
* uncommitted transactions aren't cached.
*/
#define JOURNAL_START ((__u32 *) (INFO + 1))
#define JOURNAL_END ((__u32 *) (FSYS_BUF + FSYS_BUFLEN))
@@ -365,16 +365,16 @@ is_power_of_two (unsigned long word)
return (word & -word) == word;
}
static int
journal_read (int block, int len, char *buffer)
static int
journal_read (int block, int len, char *buffer)
{
return devread ((INFO->journal_block + block) << INFO->blocksize_shift,
return devread ((INFO->journal_block + block) << INFO->blocksize_shift,
0, len, buffer);
}
/* Read a block from ReiserFS file system, taking the journal into
* account. If the block nr is in the journal, the block from the
* journal taken.
* journal taken.
*/
static int
block_read (int blockNr, int start, int len, char *buffer)
@@ -384,7 +384,7 @@ block_read (int blockNr, int start, int len, char *buffer)
int journal_mask = INFO->journal_block_count - 1;
int translatedNr = blockNr;
__u32 *journal_table = JOURNAL_START;
while (transactions-- > 0)
while (transactions-- > 0)
{
int i = 0;
int j_len;
@@ -416,11 +416,11 @@ block_read (int blockNr, int start, int len, char *buffer)
while (i < j_len && i < JOURNAL_TRANS_HALF)
if (desc.j_realblock[i++] == blockNr)
goto found;
if (j_len >= JOURNAL_TRANS_HALF)
{
int commit_block = (desc_block + 1 + j_len) & journal_mask;
if (! journal_read (commit_block,
if (! journal_read (commit_block,
sizeof (commit), (char *) &commit))
return 0;
while (i < j_len)
@@ -429,11 +429,11 @@ block_read (int blockNr, int start, int len, char *buffer)
}
}
goto not_found;
found:
translatedNr = INFO->journal_block + ((desc_block + i) & journal_mask);
#ifdef REISERDEBUG
printf ("block_read: block %d is mapped to journal block %d.\n",
printf ("block_read: block %d is mapped to journal block %d.\n",
blockNr, translatedNr - INFO->journal_block);
#endif
/* We must continue the search, as this block may be overwritten
@@ -450,8 +450,8 @@ block_read (int blockNr, int start, int len, char *buffer)
* we can still read the rest from the disk on demand.
*
* The first number of valid transactions and the descriptor block of the
* first valid transaction are held in INFO. The transactions are all
* adjacent, but we must take care of the journal wrap around.
* first valid transaction are held in INFO. The transactions are all
* adjacent, but we must take care of the journal wrap around.
*/
static int
journal_init (void)
@@ -474,11 +474,11 @@ journal_init (void)
next_trans_id = header.j_last_flush_trans_id + 1;
#ifdef REISERDEBUG
printf ("journal_init: last flushed %d\n",
printf ("journal_init: last flushed %d\n",
header.j_last_flush_trans_id);
#endif
while (1)
while (1)
{
journal_read (desc_block, sizeof (desc), (char *) &desc);
if (substring (JOURNAL_DESC_MAGIC, desc.j_magic) > 0
@@ -486,16 +486,16 @@ journal_init (void)
|| desc.j_mount_id != header.j_mount_id)
/* no more valid transactions */
break;
commit_block = (desc_block + desc.j_len + 1) & (block_count - 1);
journal_read (commit_block, sizeof (commit), (char *) &commit);
if (desc.j_trans_id != commit.j_trans_id
|| desc.j_len != commit.j_len)
/* no more valid transactions */
break;
#ifdef REISERDEBUG
printf ("Found valid transaction %d/%d at %d.\n",
printf ("Found valid transaction %d/%d at %d.\n",
desc.j_trans_id, desc.j_mount_id, desc_block);
#endif
@@ -521,7 +521,7 @@ journal_init (void)
{
*journal_table++ = desc.j_realblock[i];
#ifdef REISERDEBUG
printf ("block %d is in journal %d.\n",
printf ("block %d is in journal %d.\n",
desc.j_realblock[i], desc_block);
#endif
}
@@ -529,8 +529,8 @@ journal_init (void)
{
*journal_table++ = commit.j_realblock[i-JOURNAL_TRANS_HALF];
#ifdef REISERDEBUG
printf ("block %d is in journal %d.\n",
commit.j_realblock[i-JOURNAL_TRANS_HALF],
printf ("block %d is in journal %d.\n",
commit.j_realblock[i-JOURNAL_TRANS_HALF],
desc_block);
#endif
}
@@ -539,7 +539,7 @@ journal_init (void)
desc_block = (commit_block + 1) & (block_count - 1);
}
#ifdef REISERDEBUG
printf ("Transaction %d/%d at %d isn't valid.\n",
printf ("Transaction %d/%d at %d isn't valid.\n",
desc.j_trans_id, desc.j_mount_id, desc_block);
#endif
@@ -556,7 +556,7 @@ reiserfs_mount (void)
int superblock = REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS;
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
(char *) &super)
|| (substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) > 0
&& substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0)
@@ -567,7 +567,7 @@ reiserfs_mount (void)
/* Try old super block position */
superblock = REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS;
if (part_length < superblock + (sizeof (super) >> SECTOR_BITS)
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
|| ! devread (superblock, 0, sizeof (struct reiserfs_super_block),
(char *) &super))
return 0;
@@ -575,10 +575,10 @@ reiserfs_mount (void)
&& substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) > 0)
{
/* pre journaling super block ? */
if (substring (REISERFS_SUPER_MAGIC_STRING,
if (substring (REISERFS_SUPER_MAGIC_STRING,
(char*) ((char *) &super + 20)) > 0)
return 0;
super.s_blocksize = REISERFS_OLD_BLOCKSIZE;
super.s_journal_block = 0;
super.s_version = 0;
@@ -588,16 +588,16 @@ reiserfs_mount (void)
/* check the version number. */
if (super.s_version > REISERFS_MAX_SUPPORTED_VERSION)
return 0;
INFO->version = super.s_version;
INFO->blocksize = super.s_blocksize;
INFO->fullblocksize_shift = log2 (super.s_blocksize);
INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
INFO->cached_slots =
INFO->cached_slots =
(FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1;
#ifdef REISERDEBUG
printf ("reiserfs_mount: version=%d, blocksize=%d\n",
printf ("reiserfs_mount: version=%d, blocksize=%d\n",
INFO->version, INFO->blocksize);
#endif /* REISERDEBUG */
@@ -610,7 +610,7 @@ reiserfs_mount (void)
return 0;
/* Initialize journal code. If something fails we end with zero
* journal_transactions, so we don't access the journal at all.
* journal_transactions, so we don't access the journal at all.
*/
INFO->journal_transactions = 0;
if (super.s_journal_block != 0 && super.s_journal_dev == 0)
@@ -621,17 +621,17 @@ reiserfs_mount (void)
journal_init ();
/* Read in super block again, maybe it is in the journal */
block_read (superblock >> INFO->blocksize_shift,
block_read (superblock >> INFO->blocksize_shift,
0, sizeof (struct reiserfs_super_block), (char *) &super);
}
if (! block_read (super.s_root_block, 0, INFO->blocksize, (char*) ROOT))
return 0;
INFO->tree_depth = BLOCKHEAD (ROOT)->blk_level;
#ifdef REISERDEBUG
printf ("root read_in: block=%d, depth=%d\n",
printf ("root read_in: block=%d, depth=%d\n",
super.s_root_block, INFO->tree_depth);
#endif /* REISERDEBUG */
@@ -639,7 +639,7 @@ reiserfs_mount (void)
return 0;
if (INFO->tree_depth == DISK_LEAF_NODE_LEVEL)
{
/* There is only one node in the whole filesystem,
/* There is only one node in the whole filesystem,
* which is simultanously leaf and root */
memcpy (LEAF, ROOT, INFO->blocksize);
}
@@ -654,7 +654,7 @@ reiserfs_mount (void)
* My tree node cache is organized as following
* 0 ROOT node
* 1 LEAF node (if the ROOT is also a LEAF it is copied here
* 2-n other nodes on current path from bottom to top.
* 2-n other nodes on current path from bottom to top.
* if there is not enough space in the cache, the top most are
* omitted.
*
@@ -664,7 +664,7 @@ reiserfs_mount (void)
* next_key() gets the next key in tree order.
*
* This means, that I can only sequential reads of files are
* efficient, but this really doesn't hurt for grub.
* efficient, but this really doesn't hurt for grub.
*/
/* Read in the node at the current path and depth into the node cache.
@@ -678,7 +678,7 @@ read_tree_node (unsigned int blockNr, int depth)
if (depth < num_cached)
{
/* This is the cached part of the path. Check if same block is
* needed.
* needed.
*/
if (blockNr == INFO->blocks[depth])
return cache;
@@ -704,7 +704,7 @@ read_tree_node (unsigned int blockNr, int depth)
}
/* Get the next key, i.e. the key following the last retrieved key in
* tree order. INFO->current_ih and
* tree order. INFO->current_ih and
* INFO->current_info are adapted accordingly. */
static int
next_key (void)
@@ -712,21 +712,21 @@ next_key (void)
int depth;
struct item_head *ih = INFO->current_ih + 1;
char *cache;
#ifdef REISERDEBUG
printf ("next_key:\n old ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
printf ("next_key:\n old ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
INFO->current_ih->ih_key.u.v1.k_offset,
INFO->current_ih->ih_key.u.v1.k_uniqueness,
INFO->current_ih->ih_version);
#endif /* REISERDEBUG */
if (ih == &ITEMHEAD[BLOCKHEAD (LEAF)->blk_nr_item])
{
depth = DISK_LEAF_NODE_LEVEL;
/* The last item, was the last in the leaf node.
* Read in the next block
/* The last item, was the last in the leaf node.
* Read in the next block
*/
do
{
@@ -743,18 +743,18 @@ next_key (void)
#endif /* REISERDEBUG */
}
while (INFO->next_key_nr[depth] == 0);
if (depth == INFO->tree_depth)
cache = ROOT;
else if (depth <= INFO->cached_slots)
cache = CACHE (depth);
else
else
{
cache = read_tree_node (INFO->blocks[depth], depth);
if (! cache)
return 0;
}
do
{
int nr_item = BLOCKHEAD (cache)->blk_nr_item;
@@ -771,16 +771,16 @@ next_key (void)
return 0;
}
while (depth > DISK_LEAF_NODE_LEVEL);
ih = ITEMHEAD;
}
found:
INFO->current_ih = ih;
INFO->current_item = &LEAF[ih->ih_item_location];
#ifdef REISERDEBUG
printf (" new ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
printf (" new ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
INFO->current_ih->ih_key.u.v1.k_offset,
INFO->current_ih->ih_key.u.v1.k_uniqueness,
INFO->current_ih->ih_version);
@@ -788,18 +788,18 @@ next_key (void)
return 1;
}
/* preconditions: reiserfs_mount already executed, therefore
/* preconditions: reiserfs_mount already executed, therefore
* INFO block is valid
* returns: 0 if error (errnum is set),
* returns: 0 if error (errnum is set),
* nonzero iff we were able to find the key successfully.
* postconditions: on a nonzero return, the current_ih and
* postconditions: on a nonzero return, the current_ih and
* current_item fields describe the key that equals the
* searched key. INFO->next_key contains the next key after
* the searched key.
* side effects: messes around with the cache.
*/
static int
search_stat (__u32 dir_id, __u32 objectid)
search_stat (__u32 dir_id, __u32 objectid)
{
char *cache;
int depth;
@@ -809,21 +809,21 @@ search_stat (__u32 dir_id, __u32 objectid)
#ifdef REISERDEBUG
printf ("search_stat:\n key %d:%d:0:0\n", dir_id, objectid);
#endif /* REISERDEBUG */
depth = INFO->tree_depth;
cache = ROOT;
while (depth > DISK_LEAF_NODE_LEVEL)
{
struct key *key;
nr_item = BLOCKHEAD (cache)->blk_nr_item;
key = KEY (cache);
for (i = 0; i < nr_item; i++)
for (i = 0; i < nr_item; i++)
{
if (key->k_dir_id > dir_id
|| (key->k_dir_id == dir_id
|| (key->k_dir_id == dir_id
&& (key->k_objectid > objectid
|| (key->k_objectid == objectid
&& (key->u.v1.k_offset
@@ -831,7 +831,7 @@ search_stat (__u32 dir_id, __u32 objectid)
break;
key++;
}
#ifdef REISERDEBUG
printf (" depth=%d, i=%d/%d\n", depth, i, nr_item);
#endif /* REISERDEBUG */
@@ -840,13 +840,13 @@ search_stat (__u32 dir_id, __u32 objectid)
if (! cache)
return 0;
}
/* cache == LEAF */
nr_item = BLOCKHEAD (LEAF)->blk_nr_item;
ih = ITEMHEAD;
for (i = 0; i < nr_item; i++)
for (i = 0; i < nr_item; i++)
{
if (ih->ih_key.k_dir_id == dir_id
if (ih->ih_key.k_dir_id == dir_id
&& ih->ih_key.k_objectid == objectid
&& ih->ih_key.u.v1.k_offset == 0
&& ih->ih_key.u.v1.k_uniqueness == 0)
@@ -871,32 +871,32 @@ reiserfs_read (char *buf, int len)
unsigned int offset;
unsigned int to_read;
char *prev_buf = buf;
#ifdef REISERDEBUG
printf ("reiserfs_read: filepos=%d len=%d, offset=%x:%x\n",
filepos, len, (__u64) IH_KEY_OFFSET (INFO->current_ih) - 1);
#endif /* REISERDEBUG */
if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid
|| IH_KEY_OFFSET (INFO->current_ih) > filepos + 1)
{
search_stat (INFO->fileinfo.k_dir_id, INFO->fileinfo.k_objectid);
goto get_next_key;
}
while (! errnum)
{
if (INFO->current_ih->ih_key.k_objectid != INFO->fileinfo.k_objectid)
break;
offset = filepos - IH_KEY_OFFSET (INFO->current_ih) + 1;
blocksize = INFO->current_ih->ih_item_len;
#ifdef REISERDEBUG
printf (" loop: filepos=%d len=%d, offset=%d blocksize=%d\n",
filepos, len, offset, blocksize);
#endif /* REISERDEBUG */
if (IH_KEY_ISTYPE(INFO->current_ih, TYPE_DIRECT)
&& offset < blocksize)
{
@@ -907,14 +907,14 @@ reiserfs_read (char *buf, int len)
to_read = blocksize - offset;
if (to_read > len)
to_read = len;
if (disk_read_hook != NULL)
{
disk_read_func = disk_read_hook;
block_read (INFO->blocks[DISK_LEAF_NODE_LEVEL],
(INFO->current_item - LEAF + offset), to_read, buf);
disk_read_func = NULL;
}
else
@@ -928,25 +928,25 @@ reiserfs_read (char *buf, int len)
printf ("indirect_read: offset=%d, blocksize=%d\n",
offset, blocksize);
#endif /* REISERDEBUG */
while (offset < blocksize)
{
__u32 blocknr = ((__u32 *) INFO->current_item)
[offset >> INFO->fullblocksize_shift];
int blk_offset = offset & (INFO->blocksize-1);
to_read = INFO->blocksize - blk_offset;
if (to_read > len)
to_read = len;
disk_read_func = disk_read_hook;
/* Journal is only for meta data. Data blocks can be read
* directly without using block_read
*/
devread (blocknr << INFO->blocksize_shift,
blk_offset, to_read, buf);
disk_read_func = NULL;
update_buf_len:
len -= to_read;
@@ -965,11 +965,11 @@ reiserfs_read (char *buf, int len)
}
/* preconditions: reiserfs_mount already executed, therefore
/* preconditions: reiserfs_mount already executed, therefore
* INFO block is valid
* returns: 0 if error, nonzero iff we were able to find the file successfully
* postconditions: on a nonzero return, INFO->fileinfo contains the info
* of the file we were trying to look up, filepos is 0 and filemax is
* of the file we were trying to look up, filepos is 0 and filemax is
* the size of the file.
*/
int
@@ -987,23 +987,23 @@ reiserfs_dir (char *dirname)
dir_id = REISERFS_ROOT_PARENT_OBJECTID;
objectid = REISERFS_ROOT_OBJECTID;
while (1)
{
#ifdef REISERDEBUG
printf ("dirname=%s\n", dirname);
#endif /* REISERDEBUG */
/* Search for the stat info first. */
if (! search_stat (dir_id, objectid))
return 0;
#ifdef REISERDEBUG
printf ("sd_mode=%x sd_size=%d\n",
printf ("sd_mode=%x sd_size=%d\n",
((struct stat_data *) INFO->current_item)->sd_mode,
((struct stat_data *) INFO->current_item)->sd_size);
#endif /* REISERDEBUG */
mode = ((struct stat_data *) INFO->current_item)->sd_mode;
/* If we've got a symbolic link, then chase it. */
@@ -1029,7 +1029,7 @@ reiserfs_dir (char *dirname)
errnum = ERR_FILELENGTH;
return 0;
}
/* Copy the remaining name to the end of the symlink data.
Note that DIRNAME and LINKBUF may overlap! */
grub_memmove (linkbuf + filemax, dirname, len+1);
@@ -1069,7 +1069,7 @@ reiserfs_dir (char *dirname)
/* if we have a real file (and we're not just printing possibilities),
then this is where we want to exit */
if (! *dirname || isspace (*dirname))
{
if (! S_ISREG (mode))
@@ -1077,22 +1077,22 @@ reiserfs_dir (char *dirname)
errnum = ERR_BAD_FILETYPE;
return 0;
}
filepos = 0;
filemax = ((struct stat_data *) INFO->current_item)->sd_size;
/* If this is a new stat data and size is > 4GB set filemax to
/* If this is a new stat data and size is > 4GB set filemax to
* maximum
*/
if (INFO->current_ih->ih_version == ITEM_VERSION_2
&& ((struct stat_data *) INFO->current_item)->sd_size_hi > 0)
filemax = 0xffffffff;
INFO->fileinfo.k_dir_id = dir_id;
INFO->fileinfo.k_objectid = objectid;
return next_key ();
}
/* continue with the file/directory name interpretation */
while (*dirname == '/')
dirname++;
@@ -1103,31 +1103,31 @@ reiserfs_dir (char *dirname)
}
for (rest = dirname; (ch = *rest) && ! isspace (ch) && ch != '/'; rest++);
*rest = 0;
# ifndef STAGE1_5
if (print_possibilities && ch != '/')
do_possibilities = 1;
# endif /* ! STAGE1_5 */
while (1)
{
char *name_end;
int num_entries;
if (! next_key ())
return 0;
#ifdef REISERDEBUG
printf ("ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
printf ("ih: key %d:%d:%d:%d version:%d\n",
INFO->current_ih->ih_key.k_dir_id,
INFO->current_ih->ih_key.k_objectid,
INFO->current_ih->ih_key.u.v1.k_offset,
INFO->current_ih->ih_key.u.v1.k_uniqueness,
INFO->current_ih->ih_version);
#endif /* REISERDEBUG */
if (INFO->current_ih->ih_key.k_objectid != objectid)
break;
name_end = INFO->current_item + INFO->current_ih->ih_item_len;
de_head = (struct reiserfs_de_head *) INFO->current_item;
num_entries = INFO->current_ih->u.ih_entry_count;
@@ -1142,7 +1142,7 @@ reiserfs_dir (char *dirname)
* terminated. We write a temporary 0 behind it.
* NOTE: that this may overwrite the first block in
* the tree cache. That doesn't hurt as long as we
* don't call next_key () in between.
* don't call next_key () in between.
*/
*name_end = 0;
cmp = substring (dirname, filename);
@@ -1171,18 +1171,18 @@ reiserfs_dir (char *dirname)
num_entries--;
}
}
# ifndef STAGE1_5
if (print_possibilities < 0)
return 1;
# endif /* ! STAGE1_5 */
errnum = ERR_FILE_NOT_FOUND;
*rest = ch;
return 0;
found:
*rest = ch;
dirname = rest;
@@ -1198,22 +1198,22 @@ reiserfs_embed (int *start_sector, int needed_sectors)
{
struct reiserfs_super_block super;
int num_sectors;
if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS, 0,
if (! devread (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS, 0,
sizeof (struct reiserfs_super_block), (char *) &super))
return 0;
*start_sector = 1; /* reserve first sector for stage1 */
if ((substring (REISERFS_SUPER_MAGIC_STRING, super.s_magic) <= 0
|| substring (REISER2FS_SUPER_MAGIC_STRING, super.s_magic) <= 0)
&& (/* check that this is not a super block copy inside
* the journal log */
super.s_journal_block * super.s_blocksize
super.s_journal_block * super.s_blocksize
> REISERFS_DISK_OFFSET_IN_BYTES))
num_sectors = (REISERFS_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1;
else
num_sectors = (REISERFS_OLD_DISK_OFFSET_IN_BYTES >> SECTOR_BITS) - 1;
return (needed_sectors <= num_sectors);
}
#endif /* FSYS_REISERFS */

View File

@@ -41,21 +41,21 @@ static struct dir_entry *vstafs_nextdir (void);
*/
static int f_sector;
int
int
vstafs_mount (void)
{
int retval = 1;
if( (((current_drive & 0x80) || (current_slice != 0))
&& current_slice != PC_SLICE_TYPE_VSTAFS)
|| ! devread (0, 0, BLOCK_SIZE, (char *) FSYS_BUF)
|| FIRST_SECTOR->fs_magic != 0xDEADFACE)
retval = 0;
return retval;
}
static void
static void
get_file_info (int sector)
{
devread (sector, 0, BLOCK_SIZE, (char *) FILE_INFO);
@@ -76,13 +76,13 @@ vstafs_readdir (long sector)
errnum = ERR_FILE_NOT_FOUND;
return NULL;
}
a1 = FILE_INFO->blocks;
curr_ext = 0;
devread (a1[curr_ext].a_start, 0, 512, (char *) DIRECTORY_BUF);
current_direntry = 11;
current_blockpos = 0;
return &DIRECTORY_BUF[10];
}
@@ -97,7 +97,7 @@ vstafs_nextdir (void)
current_blockpos = 0;
curr_ext++;
}
if (curr_ext < FILE_INFO->extents)
{
devread (a1[curr_ext].a_start + current_blockpos, 0,
@@ -109,17 +109,17 @@ vstafs_nextdir (void)
return NULL;
}
}
return &DIRECTORY_BUF[current_direntry++];
}
int
int
vstafs_dir (char *dirname)
{
char *fn, ch;
struct dir_entry *d;
/* int l, i, s; */
/*
* Read in the entries of the current directory.
*/
@@ -130,7 +130,7 @@ vstafs_dir (char *dirname)
{
return 0;
}
/*
* Find the file in the path
*/
@@ -138,19 +138,19 @@ vstafs_dir (char *dirname)
fn = dirname;
while ((ch = *fn) && ch != '/' && ! isspace (ch)) fn++;
*fn = 0;
do
{
if (d->name[0] == 0 || d->name[0] & 0x80)
continue;
#ifndef STAGE1_5
if (print_possibilities && ch != '/'
&& (! *dirname || strcmp (dirname, d->name) <= 0))
{
if (print_possibilities > 0)
print_possibilities = -print_possibilities;
printf (" %s", d->name);
}
#endif
@@ -158,12 +158,12 @@ vstafs_dir (char *dirname)
{
f_sector = d->start;
get_file_info (f_sector);
filemax = FILE_INFO->len;
filemax = FILE_INFO->len;
break;
}
}
while ((d =vstafs_nextdir ()));
*(dirname = fn) = ch;
if (! d)
{
@@ -174,17 +174,17 @@ vstafs_dir (char *dirname)
#endif
return 1;
}
errnum = ERR_FILE_NOT_FOUND;
return 0;
}
}
while (*dirname && ! isspace (ch));
return 1;
}
int
int
vstafs_read (char *addr, int len)
{
struct alloc *a2;
@@ -193,11 +193,11 @@ vstafs_read (char *addr, int len)
char extent;
int ext_size;
char *curr_pos;
get_file_info (f_sector);
size = FILE_INFO->len-VSTAFS_START_DATA;
a2 = FILE_INFO->blocks;
if (filepos > 0)
{
if (filepos < a2[0].a_len * 512 - VSTAFS_START_DATA)
@@ -226,11 +226,11 @@ vstafs_read (char *addr, int len)
extent = 0;
curr_len = a2[0].a_len * 512 - offset;
}
curr_pos = addr;
if (curr_len > len)
curr_len = len;
for (curr_ext2=extent;
curr_ext2 < FILE_INFO->extents;
curr_len = a2[curr_ext].a_len * 512, curr_pos += curr_len, curr_ext2++)
@@ -242,11 +242,11 @@ vstafs_read (char *addr, int len)
ret += size;
curr_len += size;
}
devread (a2[curr_ext2].a_start,offset, curr_len, curr_pos);
offset = 0;
}
return ret;
}

View File

@@ -1,5 +1,5 @@
/* fsys_xfs.c - an implementation for the SGI XFS file system */
/*
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2001,2002 Free Software Foundation, Inc.
*
@@ -107,7 +107,7 @@ le16 (__uint16_t x)
return x;
#else
return __be16_to_cpu(x);
#endif
#endif
}
static inline __uint32_t
@@ -142,7 +142,7 @@ le64 (__uint64_t x)
static xfs_fsblock_t
xt_start (xfs_bmbt_rec_32_t *r)
{
return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) |
return (((xfs_fsblock_t)(le32 (r->l1) & mask32lo(9))) << 43) |
(((xfs_fsblock_t)le32 (r->l2)) << 11) |
(((xfs_fsblock_t)le32 (r->l3)) >> 21);
}
@@ -369,7 +369,7 @@ next_dentry (xfs_ino_t *ino)
++name;
++namelen;
sfe = (xfs_dir2_sf_entry_t *)
(inode->di_u.di_c
(inode->di_u.di_c
+ sizeof(xfs_dir2_sf_hdr_t)
- xfs.i8param);
break;
@@ -466,7 +466,7 @@ xfs_mount (void)
if (!devread (0, 0, sizeof(super), (char *)&super)
|| (le32(super.sb_magicnum) != XFS_SB_MAGIC)
|| ((le16(super.sb_versionnum)
|| ((le16(super.sb_versionnum)
& XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4) ) {
return 0;
}
@@ -513,7 +513,7 @@ xfs_read (char *buf, int len)
offset = xad->offset;
xadlen = xad->len;
if (isinxt (filepos >> xfs.blklog, offset, xadlen)) {
endofcur = (offset + xadlen) << xfs.blklog;
endofcur = (offset + xadlen) << xfs.blklog;
toread = (endofcur >= endpos)
? len : (endofcur - filepos);
@@ -535,7 +535,7 @@ xfs_read (char *buf, int len)
}
continue;
}
endofprev = offset + xadlen;
endofprev = offset + xadlen;
}
return filepos - startpos;

View File

@@ -23,7 +23,7 @@ int mount_fs(void);
extern int using_devsize;
/*
* some of the filesystem drivers don't correctly provide their
* some of the filesystem drivers don't correctly provide their
* prototypes. we fix this here so we can leave them untouched.
*/

View File

@@ -1,17 +1,17 @@
/*
/*
* <grubfs_fs.c>
*
*
* grub vfs
*
*
* Copyright (C) 2004 Stefan Reinauer
* Copyright (C) 2004 Samuel Rydh
*
* inspired by HFS code from Samuel Rydh
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*
*/
#include "openbios/config.h"
@@ -34,7 +34,7 @@ char FSYS_BUF[FSYS_BUFLEN];
/* we fake this for now, assuming that the filesystem is not corrupt */
unsigned long part_length=(unsigned long)-1;
/* these are not even used by us, instead
/* these are not even used by us, instead
* the grub fs drivers want them:
*/
int fsmax;
@@ -163,7 +163,7 @@ grubfs_file_read( file_desc_t *fd, void *buf, size_t count )
filepos=file->pos;
filemax=file->len;
ret=curfs->fsys->read_func(buf, count);
file->pos=filepos;
@@ -174,7 +174,7 @@ static char *
get_path( file_desc_t *fd, char *retbuf, int len )
{
const char *path=((grubfile_t *)fd)->path;
if(strlen(path) > len)
return NULL;
@@ -208,7 +208,7 @@ open_path( fs_ops_t *fs, const char *path )
ret->len=filemax;
ret->path=strdup(path);
ret->fs=fs;
return (file_desc_t *)ret;
}
@@ -217,7 +217,7 @@ close_fs( fs_ops_t *fs )
{
free( fs->fs_data );
fs->fs_data = NULL;
/* callers responsibility to call free(fs) */
}
@@ -226,7 +226,7 @@ grubfs_get_fstype( fs_ops_t *fs )
{
grubfs_t *gfs = (grubfs_t*)fs->fs_data;
return gfs->fsys->name;
}
}
static const fs_ops_t grubfs_ops = {
.close_fs = close_fs,
@@ -285,7 +285,7 @@ devread( unsigned long sector, unsigned long byte_offset,
#ifdef CONFIG_DEBUG_FS
//printk("devread s=%x buf=%x, fd=%x\n",sector, buf, curfs->dev_fd);
#endif
if( !curfs ) {
#ifdef CONFIG_DEBUG_FS
printk("devread: fsys == NULL!\n");
@@ -309,4 +309,4 @@ file_read( void *buf, unsigned long len )
len = filemax - filepos;
errnum = 0;
return curfs->fsys->read_func( buf, len );
}
}

View File

@@ -1,22 +1,22 @@
/* jfs.h - an extractions from linux/include/linux/jfs/jfs* into one file */
/*
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000 International Business Machines Corp.
* Copyright (C) 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
@@ -177,7 +177,7 @@ struct jfs_superblock
s64 s_size; /* 8: aggregate size in hardware/LVM blocks;
* VFS: number of blocks
*/
s32 s_bsize; /* 4: aggregate block size in bytes;
s32 s_bsize; /* 4: aggregate block size in bytes;
* VFS: fragment size
*/
s16 s_l2bsize; /* 2: log2 of s_bsize */
@@ -191,7 +191,7 @@ struct jfs_superblock
u32 s_flag; /* 4: aggregate attributes:
* see jfs_filsys.h
*/
u32 s_state; /* 4: mount/unmount/recovery state:
u32 s_state; /* 4: mount/unmount/recovery state:
* see jfs_filsys.h
*/
s32 s_compress; /* 4: > 0 if data compression */
@@ -212,11 +212,11 @@ struct jfs_superblock
struct timestruc_t s_time; /* 8: time last updated */
s32 s_fsckloglen; /* 4: Number of filesystem blocks reserved for
* the fsck service log.
* the fsck service log.
* N.B. These blocks are divided among the
* versions kept. This is not a per
* version size.
* N.B. These blocks are included in the
* N.B. These blocks are included in the
* length field of s_fsckpxd.
*/
s8 s_fscklog; /* 1: which fsck service log is most recent
@@ -224,7 +224,7 @@ struct jfs_superblock
* 1 => the first one
* 2 => the 2nd one
*/
char s_fpack[11]; /* 11: file system volume name
char s_fpack[11]; /* 11: file system volume name
* N.B. This must be 11 bytes to
* conform with the OS/2 BootSector
* requirements
@@ -237,7 +237,7 @@ struct jfs_superblock
/* - 128 byte boundary - */
/*
* DFS VFS support (preliminary)
* DFS VFS support (preliminary)
*/
char s_attach; /* 1: VFS: flag: set when aggregate is attached
*/
@@ -246,22 +246,22 @@ struct jfs_superblock
u64 totalUsable; /* 8: VFS: total of 1K blocks which are
* available to "normal" (non-root) users.
*/
u64 minFree; /* 8: VFS: # of 1K blocks held in reserve for
u64 minFree; /* 8: VFS: # of 1K blocks held in reserve for
* exclusive use of root. This value can be 0,
* and if it is then totalUsable will be equal
* and if it is then totalUsable will be equal
* to # of blocks in aggregate. I believe this
* means that minFree + totalUsable = # blocks.
* In that case, we don't need to store both
* In that case, we don't need to store both
* totalUsable and minFree since we can compute
* one from the other. I would guess minFree
* would be the one we should store, and
* totalUsable would be the one we should
* one from the other. I would guess minFree
* would be the one we should store, and
* totalUsable would be the one we should
* compute. (Just a guess...)
*/
u64 realFree; /* 8: VFS: # of free 1K blocks can be used by
u64 realFree; /* 8: VFS: # of free 1K blocks can be used by
* "normal" users. It may be this is something
* we should compute when asked for instead of
* we should compute when asked for instead of
* storing in the superblock. I don't know how
* often this information is needed.
*/
@@ -318,7 +318,7 @@ typedef struct {
/*
* dir_table used for directory traversal during readdir
*/
*/
/*
* Maximum entry in inline directory table
@@ -562,8 +562,8 @@ typedef struct dinode dinode_t;
/*
* inode allocation map:
*
* inode allocation map consists of
*
* inode allocation map consists of
* . the inode map control page and
* . inode allocation group pages (per 4096 inodes)
* which are addressed by standard JFS xtree.

View File

@@ -55,7 +55,7 @@
* the ``cgbase(fs, cg)'' macro.
*
* Depending on the architecture and the media, the superblock may
* reside in any one of four places. For tiny media where every block
* reside in any one of four places. For tiny media where every block
* counts, it is placed at the very front of the partition. Historically,
* UFS1 placed it 8K from the front to leave room for the disk label and
* a small bootstrap. For UFS2 it got moved to 64K from the front to leave
@@ -338,7 +338,7 @@ struct fs {
int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */
int32_t fs_sparecon32[26]; /* reserved for future constants */
int32_t fs_flags; /* see FS_ flags below */
int32_t fs_contigsumsize; /* size of cluster summary array */
int32_t fs_contigsumsize; /* size of cluster summary array */
int32_t fs_maxsymlinklen; /* max length of an internal symlink */
int32_t fs_old_inodefmt; /* format of on-disk inodes */
uint64_t fs_maxfilesize; /* maximum representable file size */

View File

@@ -1,35 +1,35 @@
/* xfs.h - an extraction from xfsprogs-1.3.5/include/xfs* into one file */
/*
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (C) 2001 Free Software Foundation, Inc.
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc.,
* with this program; if not, write the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
@@ -132,7 +132,7 @@ typedef struct xfs_sb
__uint8_t sb_shared_vn; /* shared version number */
xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
__uint32_t sb_unit; /* stripe or raid unit */
__uint32_t sb_width; /* stripe or raid width */
__uint32_t sb_width; /* stripe or raid width */
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
__uint8_t sb_dummy[7]; /* padding */
} xfs_sb_t;

View File

@@ -37,7 +37,7 @@ int b_init(hfsvol *vol)
{
bcache *cache;
int i;
ASSERT(vol->cache == 0);
cache = ALLOC(bcache, 1);

View File

@@ -69,7 +69,7 @@ hfsvol *hfs_mount( int os_fd, int pnum)
{
hfsvol *vol, *check;
int mode = HFS_MODE_RDONLY;
/* see if the volume is already mounted */
for (check = hfs_mounts; check; check = check->next)
{

View File

@@ -1,17 +1,17 @@
/*
/*
* Creation Date: <2001/05/06 22:47:23 samuel>
* Time-stamp: <2004/01/12 10:24:35 samuel>
*
*
* <hfs_fs.c>
*
*
* HFS world interface
*
*
* Copyright (C) 2001-2004 Samuel Rydh (samuel@ibrium.se)
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*
*/
#include "openbios/config.h"
@@ -39,7 +39,7 @@ _find_file( hfsvol *vol, const char *path, ulong type, ulong creator )
hfsdirent ent;
hfsdir *dir;
int ret=1;
if( !(dir=hfs_opendir(vol, path)) )
return 1;
@@ -76,24 +76,24 @@ _search( hfsvol *vol, const char *path, const char *sname, file_desc_t **ret_fd
while( status && !hfs_readdir(dir, &ent) ) {
ulong type, creator;
*p = 0;
topdir = 0;
strncat( buf, ent.name, sizeof(buf) );
if( (status=_search(vol, buf, sname, ret_fd)) != 2 )
continue;
topdir = 1;
/* name search? */
if( sname ) {
status = strcasecmp( ent.name, sname );
continue;
}
type = *(ulong*)ent.u.file.type;
creator = *(ulong*)ent.u.file.creator;
/* look for Mac OS ROM, System and Finder in the same directory */
if( type == MAC_OS_ROM_TYPE && creator == MAC_OS_ROM_CREATOR ) {
if( strcasecmp(ent.name, MAC_OS_ROM_NAME) )
@@ -113,11 +113,11 @@ _search( hfsvol *vol, const char *path, const char *sname, file_desc_t **ret_fd
}
static file_desc_t *
_do_search( fs_ops_t *fs, const char *sname )
_do_search( fs_ops_t *fs, const char *sname )
{
hfsvol *vol = hfs_getvol( NULL );
file_desc_t *ret_fd = NULL;
(void)_search( vol, ":", sname, &ret_fd );
return ret_fd;
}
@@ -183,7 +183,7 @@ get_path( file_desc_t *fd, char *retbuf, int len )
hfsdirent ent;
int start, ns;
ulong id;
hfs_fstat( file, &ent );
start = sizeof(buf) - strlen(ent.name) - 1;
if( start <= 0 )
@@ -202,7 +202,7 @@ get_path( file_desc_t *fd, char *retbuf, int len )
}
if( strlen(buf + start) >= len )
return NULL;
strcpy( retbuf, buf+start );
return retbuf;
}
@@ -220,7 +220,7 @@ open_path( fs_ops_t *fs, const char *path )
hfsvol *vol = (hfsvol*)fs->fs_data;
const char *s;
char buf[256];
if( !strncmp(path, "\\\\", 2) ) {
hfsvolent ent;
@@ -231,7 +231,7 @@ open_path( fs_ops_t *fs, const char *path )
} else {
hfs_chdir( vol, ":" );
}
for( path-- ;; ) {
int n;
@@ -241,7 +241,7 @@ open_path( fs_ops_t *fs, const char *path )
n = MIN( sizeof(buf)-1, (path-s) );
if( !n )
continue;
strncpy( buf, s, n );
buf[n] = 0;
if( hfs_chdir(vol, buf) )
@@ -254,16 +254,16 @@ open_path( fs_ops_t *fs, const char *path )
file_desc_t *ret = NULL;
hfsdirent ent;
hfsdir *dir;
s++;
id = oldid;
hfs_dirinfo( vol, &id, buf );
hfs_setcwd( vol, id );
if( !(dir=hfs_opendir(vol, buf)) )
return NULL;
hfs_setcwd( vol, oldid );
while( !hfs_readdir(dir, &ent) ) {
if( ent.flags & HFS_ISDIR )
continue;
@@ -289,10 +289,10 @@ close_fs( fs_ops_t *fs )
}
static char *
get_fstype( fs_ops_t *fs )
get_fstype( fs_ops_t *fs )
{
return ("HFS");
}
}
static const fs_ops_t hfs_ops = {
.close_fs = close_fs,
@@ -319,6 +319,6 @@ fs_hfs_open( int os_fd, fs_ops_t *fs )
*fs = hfs_ops;
fs->fs_data = vol;
return 0;
}

View File

@@ -1,15 +1,15 @@
/*
/*
* Creation Date: <2000/09/03 23:04:27 samuel>
* Time-stamp: <2000/09/04 01:23:55 samuel>
*
*
* <hfs_mdb.h>
*
*
* HFS Master Directory Block (MDB)
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*
*/
#ifndef _H_HFS_MDB
@@ -22,7 +22,7 @@ typedef unsigned char hfs_uint_t[4];
#define hfs_get_ushort(addr) (*((unsigned short*)(addr)))
#define hfs_get_uint(addr) (*((unsigned int*)(addr)))
/*
/*
* The HFS Master Directory Block (MDB).
*
* Also known as the Volume Information Block (VIB), this structure is
@@ -64,8 +64,8 @@ typedef struct hfs_mdb {
hfs_uint_t drDirCnt; /* number of directories in the fs */
hfs_char_t drFndrInfo[32]; /* data used by the Finder */
hfs_ushort_t drEmbedSigWord; /* embedded volume signature */
hfs_uint_t drEmbedExtent; /* starting block number (xdrStABN)
and number of allocation blocks
hfs_uint_t drEmbedExtent; /* starting block number (xdrStABN)
and number of allocation blocks
(xdrNumABlks) occupied by embedded
volume */
hfs_uint_t drXTFlSize; /* bytes in the extents B-tree */

View File

@@ -5,7 +5,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original work by 1996-1998 Robert Leslie <rob@mars.org>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,8 +35,8 @@
#include "hfstime.h"
/* Initialize iterator for a given fork */
void
blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
void
blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
UInt8 forktype, UInt32 fileId)
{
b->vol = vol;
@@ -52,7 +52,7 @@ blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
}
/* get next extent record when needed */
static int
static int
blockiter_next_extent(blockiter *b)
{
btree* extents_tree = volume_get_extents_tree(b->vol);
@@ -64,7 +64,7 @@ blockiter_next_extent(blockiter *b)
err = record_next_extent(&b->er);
// Hope there is no need to check this ...
// if (b->er.key.start_block != b->curr_block)
// HFSP_ERROR(ENOENT,
// HFSP_ERROR(ENOENT,
// "Extents record inconistent");
}
else
@@ -78,10 +78,10 @@ blockiter_next_extent(blockiter *b)
}
/* find next block of the fork iterating over */
int
int
blockiter_next(blockiter *b)
{
b->curr_block ++;
b->curr_block ++;
b->block ++;
if (b->curr_block >= b->max_block)
return -1; // end of Blocks, but no error
@@ -104,7 +104,7 @@ blockiter_next(blockiter *b)
}
/* skip the indicated number of blocks */
int
int
blockiter_skip(blockiter *b, UInt32 skip)
{
while (skip > 0)
@@ -118,7 +118,7 @@ blockiter_skip(blockiter *b, UInt32 skip)
}
else
skip -= diff;
b->curr_block += diff;
b->curr_block += diff;
b->block += diff;
if (b->curr_block >= b->max_block)
return -1; // end of Blocks, but no error

View File

@@ -8,7 +8,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original 1996-1998 Robert Leslie <rob@mars.org>
* Additional work by Brad Boyer (flar@pants.nu)
* Additional work by Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ static void* btree_readnode(btree_node_desc* node, void *p)
node->num_rec = bswabU16_inc(p);
node->reserved = bswabU16_inc(p);
return p;
}
}
/* read a btree header from the given buffer and swap the bytes.
*
@@ -81,15 +81,15 @@ static void* btree_readhead(btree_head* head, void *p)
* Should be the average number of keys per node but these vary. */
#define DEPTH_FACTOR 1000
/* Cache size is height of tree + this value
/* Cache size is height of tree + this value
* Really big numbers wont help in case of ls -R
*/
#define EXTRA_CACHESIZE 3
#define EXTRA_CACHESIZE 3
/* Not in use by now ... */
#define CACHE_DIRTY 0x0001
/* Intialize cache with default cache Size,
/* Intialize cache with default cache Size,
* must call node_cache_close to deallocate memory */
static int node_cache_init(node_cache* cache, btree* tree, int size)
{
@@ -129,7 +129,7 @@ static void node_cache_close(node_cache* cache)
free(cache->entries);
}
/* Load the cach node indentified by index with
/* Load the cach node indentified by index with
* the node identified by node_index */
static node_buf* node_cache_load_buf
@@ -138,7 +138,7 @@ static node_buf* node_cache_load_buf
node_buf *result = node_buf_get(cache ,index);
UInt32 blkpernode = bt->blkpernode;
UInt32 block = node_index * blkpernode;
void* p = volume_readfromfork(bt->vol, result->node, bt->fork,
void* p = volume_readfromfork(bt->vol, result->node, bt->fork,
block, blkpernode, HFSP_EXTENT_DATA, bt->cnid);
node_entry *e = &cache->entries[index];
@@ -210,9 +210,9 @@ node_buf* btree_node_by_index(btree* bt, UInt16 index)
/** intialize the btree with the first entry in the fork */
static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
{
{
void *p;
char buf[vol->blksize];
char buf[vol->blksize];
UInt16 node_size;
btree_node_desc node;
@@ -236,7 +236,7 @@ static int btree_init(btree* bt, volume* vol, hfsp_fork_raw* fork)
node_cache_init(&bt->cache, bt, bt->head.depth + EXTRA_CACHESIZE);
// Allocate buffer
// Allocate buffer
// bt->buf = malloc(node_size);
// if (!bt->buf)
// return ENOMEM;
@@ -249,10 +249,10 @@ void btree_reset(btree* bt)
{
bt->cache.entries = NULL;
}
/** Intialize catalog btree */
int btree_init_cat(btree* bt, volume* vol, hfsp_fork_raw* fork)
{
{
int result = btree_init(bt,vol,fork); // super (...)
bt->cnid = HFSP_CAT_CNID;
bt->kcomp = record_key_compare;
@@ -262,7 +262,7 @@ int btree_init_cat(btree* bt, volume* vol, hfsp_fork_raw* fork)
/** Intialize catalog btree */
int btree_init_extent(btree* bt, volume* vol, hfsp_fork_raw* fork)
{
{
int result = btree_init(bt,vol,fork); // super (...)
bt->cnid = HFSP_EXT_CNID;
bt->kcomp = record_extent_key_compare;
@@ -280,16 +280,16 @@ void btree_close(btree* bt)
/* returns pointer to key given by index in current node.
*
* Assumes that current node is not NODE_HEAD ...
*/
*/
void* btree_key_by_index(btree* bt, node_buf* buf, UInt16 index)
{
UInt16 node_size = bt->head.node_size;
UInt16 node_size = bt->head.node_size;
// The offsets are found at the end of the node ...
UInt16 off_pos = node_size - (index +1) * sizeof(btree_record_offset);
// position of offset at end of node
btree_record_offset* offset =
btree_record_offset* offset =
(btree_record_offset*) (buf->node + off_pos);
// now we have the offset and can read the key ...
#ifdef CONFIG_LITTLE_ENDIAN
return buf->node + bswap_16(*offset);
@@ -297,7 +297,7 @@ void* btree_key_by_index(btree* bt, node_buf* buf, UInt16 index)
return buf->node + *offset;
#endif
}
#ifdef DEBUG
@@ -338,7 +338,7 @@ void btree_printhead(btree_head* head)
/* Dump all the node information to stdout */
void btree_print(btree* bt)
{
{
btree_node_desc* node;
btree_printhead(&bt->head);
@@ -350,7 +350,7 @@ void btree_print(btree* bt)
printf("num_rec : %#X\n", node->num_rec);
printf("reserved : %#X\n", node->reserved);
printf("height : %#X\n", node->height); switch(node->kind)
{
{
case HFSP_NODE_NDX :
printf("HFSP_NODE_NDX\n");
break;
@@ -365,8 +365,8 @@ void btree_print(btree* bt)
break;
default:
printf("*** Unknown Node type ***\n");
}
}
}
}
#endif

View File

@@ -1,17 +1,17 @@
/*
/*
* Creation Date: <2001/05/05 23:33:49 samuel>
* Time-stamp: <2004/01/12 10:25:39 samuel>
*
*
* <hfsp_fs.c>
*
*
* HFS+ file system interface (and ROM lookup support)
*
*
* Copyright (C) 2001, 2002, 2003, 2004 Samuel Rydh (samuel@ibrium.se)
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*
*/
#include "openbios/config.h"
@@ -95,13 +95,13 @@ root_search_files( fs_ops_t *fs, int recursive, match_proc_t proc, const void *m
return search_files( &r, recursive, proc, match_data, pt );
}
static int
static int
match_file( record *r, record *parent, const void *match_data, hfsp_file_t *pt )
{
const char *p = (const char*)match_data;
char name[256];
int ret=1;
if( r->record.type != HFSP_FILE )
return 1;
@@ -119,7 +119,7 @@ match_rom( record *r, record *par, const void *match_data, hfsp_file_t *pt )
FInfo *fi = &file->user_info;
int ret = 1;
char buf[256];
if( r->record.type == HFSP_FILE && fi->fdCreator == MAC_OS_ROM_CREATOR && fi->fdType == MAC_OS_ROM_TYPE ) {
ret = search_files( par, 0, match_file, "System", NULL )
|| search_files( par, 0, match_file, "Finder", NULL );
@@ -193,7 +193,7 @@ close_fs( fs_ops_t *fs )
}
static file_desc_t *
_create_fops( hfsp_file_t *t )
_create_fops( hfsp_file_t *t )
{
hfsp_file_t *r = malloc( sizeof(hfsp_file_t) );
@@ -208,7 +208,7 @@ open_path( fs_ops_t *fs, const char *path )
hfsp_file_t t;
volume *vol = (volume*)fs->fs_data;
record r;
/* Leading \\ means system folder. The finder info block has
* the following meaning.
*
@@ -341,7 +341,7 @@ file_read( file_desc_t *fd, void *buf, size_t count )
}
size = (count-act_count > max)? max : count-act_count;
memcpy( (char *)buf + act_count, &buf2[add], size );
curpos += blksize;
act_count += size;
@@ -360,10 +360,10 @@ vol_name( fs_ops_t *fs, char *buf, int size )
}
static char *
get_fstype( fs_ops_t *fs )
get_fstype( fs_ops_t *fs )
{
return ("HFS+");
}
}
static const fs_ops_t fs_ops = {
@@ -377,7 +377,7 @@ static const fs_ops_t fs_ops = {
.close = file_close,
.read = file_read,
.lseek = file_lseek,
.get_fstype = get_fstype
};
@@ -392,6 +392,6 @@ fs_hfsp_open( int os_fd, fs_ops_t *fs )
}
*fs = fs_ops;
fs->fs_data = vol;
return 0;
}

View File

@@ -3,10 +3,10 @@
*
* This file contains defintions that are special for Apple.
* The names match the defintions found in Apple Header files.
*
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original code 1996-1998 by Robert Leslie <rob@mars.rog>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,15 +36,15 @@ typedef unsigned long UInt32;
typedef unsigned long OSType;
typedef unsigned long long UInt64;
/* A point, normally used by Quickdraw,
* but found in Finderinformation, too
/* A point, normally used by Quickdraw,
* but found in Finderinformation, too
*/
typedef struct {
SInt16 v; /* vertical coordinate */
SInt16 h; /* horizontal coordinate */
} Point;
/* A rectancle, normally used by Quickdraw,
/* A rectancle, normally used by Quickdraw,
* but found in Finderinformation, too.
*/
typedef struct {
@@ -54,8 +54,8 @@ typedef struct {
SInt16 right; /* right edge */
} Rect;
/* Information about the location and size of a folder
* used by the Finder.
/* Information about the location and size of a folder
* used by the Finder.
*/
typedef struct {
Rect frRect; /* folder's rectangle */

View File

@@ -2,10 +2,10 @@
* libhfs - library for reading and writing Macintosh HFS volumes
*
* The iterator shown here iterates over the blocks of a fork.
*
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original work by 1996-1998 Robert Leslie <rob@mars.org>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
*/
/* Structure of the blockiterator */
typedef struct
typedef struct
{
volume* vol; // volume we iterate over
UInt32 curr_block; // current, absolute block
@@ -38,11 +38,11 @@ typedef struct
UInt8 forktype; // type of fork we iterate over
UInt8 in_extent; // boolean 0 - in file extent
// 1 - in extents file
extent_record er; // record to iterate in extents file.
extent_record er; // record to iterate in extents file.
} blockiter;
/* Initialize iterator for a given fork */
extern void blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
extern void blockiter_init(blockiter* b, volume* vol, hfsp_fork_raw* f,
UInt8 forktype, UInt32 fileId);
/* find next block of the fork iterating over */

View File

@@ -6,7 +6,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original 1996-1998 Robert Leslie <rob@mars.org>
* Additional work by Brad Boyer (flar@pants.nu)
* Additional work by Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@@ -1,11 +1,11 @@
/*
* libhfsp - library for reading and writing Macintosh HFS+ volumes
*
*
* This file includes definitions for access to old HFS structures.
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original code 1996-1998 by Robert Leslie <rob@mars.rog>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
*/
#define HFS_BLOCKSZ 512
#define HFS_BLOCKSZ 512
/* A sector for Apple is always 512 bytes */
#define HFS_BLOCKSZ_BITS 9 /* 1<<9 == 512 */
#define HFS_VOLHEAD_SIG 0x4244 /* 'BD' */

View File

@@ -1,6 +1,6 @@
/*
* libhfsp - library for reading and writing Macintosh HFS+ volumes
*
*
* This file includes definitions for the structures found on
* HFS+ Volumes. The structures are further wrapped by struct
* found in libhfsp.h. fucntions on those enhanced structures
@@ -8,7 +8,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original code 1996-1998 by Robert Leslie <rob@mars.rog>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,29 +68,29 @@ typedef struct {
*/
typedef struct hfsp_vh {
UInt16 signature; // must be HFSPLUS_VOLHEAD_SIG 'H+'
UInt16 version; // currently 4, ignored
UInt16 version; // currently 4, ignored
UInt32 attributes; // See bit constants below
UInt32 last_mount_vers;
// Use a registered creator code here (what do we use ?)
// Mac OS uses '8.10' well
UInt32 reserved;
UInt32 create_date; // local time !
UInt32 modify_date; // GMT (?)
UInt32 backup_date; // GMT (?)
UInt32 checked_date; // GMT (?) fsck ?
UInt32 file_count;
// not including special files but including DATA and RSRC forks
UInt32 folder_count; // excluding the root folder
UInt32 blocksize;
// must be multiple of HFSPLUS_SECTOR_SIZE,
// should be a multiple of 4k for harddisk
UInt32 total_blocks;
UInt32 free_blocks;
// The total number of unused allocation blocks on the disk.
UInt32 next_alloc;
// hint wher to search for next allocation blocks
UInt32 rsrc_clump_sz;
@@ -104,7 +104,7 @@ typedef struct hfsp_vh {
UInt64 encodings_bmp;
// for every encoding used on the disk a bit is set
// ignored but eventually must be cared for
Char finder_info[32];
Char finder_info[32];
hfsp_fork_raw alloc_file;
// stores bitmap of use/free blocks
hfsp_fork_raw ext_file;
@@ -162,7 +162,7 @@ typedef struct {
UInt16 depth;
// equal to height of btree_node_desc
UInt32 root;
// root node of the hierarchy
// root node of the hierarchy
UInt32 leaf_count;
UInt32 leaf_head;
UInt32 leaf_tail;
@@ -179,9 +179,9 @@ typedef struct {
// always 0 for HFS+
UInt8 reserved2;
UInt32 attributes;
// see below
// see below
UInt32 reserved3[16];
} btree_head;
} btree_head;
/* BTree attributes */
#define HFSPLUS_BAD_CLOSE 0x01
@@ -192,7 +192,7 @@ typedef struct {
#define HFSPLUS_TREE_VAR_NDXKEY_SIZE 0x04
// use variable length index nodes, always set for catalog btree,
// always cleared for extents btree.
#define HFSPLUS_TREE_UNUSED 0xFFFFFFF8
/* Some special File ID numbers */
@@ -226,7 +226,7 @@ typedef struct {
UInt8 fork_type; /* Seee below */
UInt8 filler;
UInt32 file_id;
UInt32 start_block;
UInt32 start_block;
} hfsp_extent_key;
#define HFSP_EXTENT_DATA 0x00
@@ -238,10 +238,10 @@ typedef struct {
#define HFSP_FOLDER 0x0001 // entry fo a Folder
#define HFSP_FILE 0x0002 // entry for a File
#define HFSP_FOLDER_THREAD 0x0003
#define HFSP_FOLDER_THREAD 0x0003
// Like '.' in unix, identifies the folder by its id, only
#define HFSP_FILE_THREAD 0x0004
// Im unsure if this is used by HFS+, too
#define HFSP_FILE_THREAD 0x0004
// Im unsure if this is used by HFS+, too
/* HFS+ folder data (part of an hfsp_cat_entry) */
typedef struct {

View File

@@ -5,7 +5,7 @@
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* The HFS+ dates are stored as UInt32 containing the number of seconds since
* midnight, January 1, 1904, GMT. This is slightly different from HFS,
* midnight, January 1, 1904, GMT. This is slightly different from HFS,
* where the value represents local time. A notable exception is the
* creationdate !. Linux uses times in GMT starting at January 1, 1970
*
@@ -25,7 +25,7 @@
*
* $Id: hfstime.h,v 1.2 2000/10/19 13:33:38 hasi Exp $
*/
/* The number of seconds between 1.1.1904 and 1.1.1970 */
#define HFSPTIMEDIFF 2082844800U

View File

@@ -28,7 +28,7 @@
# include "hfsp.h"
/* Last error is eventually found here */
extern const char *hfsp_error;
extern const char *hfsp_error;
# define HFSP_ERROR(code, str) \
do { hfsp_error = (str), errno = (code); goto fail; } while (0)
@@ -66,7 +66,7 @@ extern const char *hfsp_error;
/* Signatures registered with Apple to identify this driver */
/* Identifies the userland implementation */
# define HPLS_SIGNATURE 0x482B4C58 // 'H+LX'
# define HPLS_SIGNATURE 0x482B4C58 // 'H+LX'
/* Identifies the kernel module by Brad Boyer (flar@pants.nu) */
# define HPLS_SIGRES1 0x482B4C78 // 'H+Lx'
/* not jet in use ... */
@@ -81,7 +81,7 @@ extern const char *hfsp_error;
/* Othe Signatures may follow for informational purpos */
/* prototype for key comparing functions. */
typedef int (*hfsp_key_compare) (void* key1, void* key2);
@@ -92,13 +92,13 @@ struct volume; /* foreward declaration for btree needed */
/* Structures for a node cache. The cache is an array
* with linear search. (So making it to big may make
* things slower). It is searched in a round robin
* things slower). It is searched in a round robin
* fashion.
*/
typedef struct
typedef struct
{
UInt32 priority;
UInt32 priority;
// as lower this number as higher the priority.
// decremetned on any sucessfull usage
// incremented else, intial value height*DEPTHFACTOR
@@ -116,29 +116,29 @@ typedef struct
// contents of node in original byte order
} node_buf;
typedef struct
typedef struct
{
int size; // number of nodes in the cache
int currindex; // round robin index
int nodebufsize; // size of complete node_buf, including node
node_entry *entries;
node_entry *entries;
char *buffers; // actually *node_buf
} node_cache;
typedef struct
{
typedef struct
{
struct volume* vol; /* pointer to volume this tree is part of */
hfsp_fork_raw* fork; /* pointer to fork this tree is part of */
UInt32 cnid; /* (pseudo) file id for the fork */
hfsp_key_compare kcomp;
hfsp_key_compare kcomp;
/* function used for key compare in _this_ btree */
hfsp_key_read kread;
/* fucntion used to read a key int _this_ btree */
btree_head head;
UInt16 blkpernode;
/* Number of volume blocks per node (usually 1-4) */
node_cache cache;
node_cache cache;
/* Warning all functions of btrees and records may modify
the following values ! */
// UInt16 node_index; /* index of node in fork */
@@ -158,22 +158,22 @@ typedef struct volume
UInt16 blksize_bits; /* blocksize of device = 1 << blksize_bits */
UInt16 filler;
UInt32 blksize; /* always 1 << blksize_bits */
UInt32 startblock;
/* Offset from physical to logical blocks,
eventually intodruced by HFS wrapper */
UInt32 startblock;
/* Offset from physical to logical blocks,
eventually intodruced by HFS wrapper */
UInt32 maxblocks; /* maximum number of blocks in device */
// UInt32 currblock; /* value of current block, to cache blocks */
hfsp_vh vol; /* raw volume data */
// void* blockbuf; /* (single) buffer for fetching one block */
/* Buffer has double size of blksize to allow cross block reading */
btree* extents; /* is NULL by default and intialized when needed */
btree catalog; /* This is always neeeded */
} volume;
} volume;
/* Functions on volumes are defined in volume.h */
typedef struct { // may not be used as found here
typedef struct { // may not be used as found here
btree* tree; // tree where this record is contained in.
UInt16 node_index; /* index of record in btree */
UInt16 keyind; /* index of current key in btree */
@@ -181,7 +181,7 @@ typedef struct { // may not be used as found here
UInt32 child; /* child node belonging to this key */
} index_record;
typedef struct {
typedef struct {
btree* tree; // tree where this record is contained in.
UInt16 node_index; /* index of record in btree */
UInt16 keyind; /* index of current key in btree */

View File

@@ -6,7 +6,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original 1996-1998 Robert Leslie <rob@mars.org>
* Additional work by Brad Boyer (flar@pants.nu)
* Additional work by Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ extern int record_init_cnid(record* r, btree* tree, UInt32 cnid);
extern int record_init_parent(record* r, record* parent);
/* intialize the record by searching for the given string in the given folder.
*
*
* parent and r may be the same.
*/
extern int record_init_string_parent(record* r, record* parent, char* key);
@@ -65,9 +65,9 @@ extern int record_up(record* r);
*/
extern int record_next(record* r);
/* intialize the extent_record to the extent identified by
/* intialize the extent_record to the extent identified by
* a given file */
extern int record_init_file(extent_record* r, btree* tree,
extern int record_init_file(extent_record* r, btree* tree,
UInt8 forktype, UInt32 fileId, UInt32 blockindex);
/* move foreward to next entent record. */

View File

@@ -24,5 +24,5 @@ int unicode_uni2asc(char *astr, const hfsp_unistr255 *ustr, int maxlen);
/* similar to strcmp for unicode, pascal strings */
SInt32 fast_unicode_compare (const hfsp_unistr255 *ustr1,
SInt32 fast_unicode_compare (const hfsp_unistr255 *ustr1,
const hfsp_unistr255 *ustr2);

View File

@@ -34,8 +34,8 @@ extern int volume_close(volume* vol);
*
* returns given pointer or NULL on failure.
*/
extern void* volume_readfromfork(volume* vol, void* buf,
hfsp_fork_raw* f, UInt32 block,
extern void* volume_readfromfork(volume* vol, void* buf,
hfsp_fork_raw* f, UInt32 block,
UInt32 count, UInt8 forktype, UInt32 fileId);
/* Fill a given buffer with the given block in volume.
@@ -57,7 +57,7 @@ extern int volume_allocated(volume* v, UInt32 block);
/* Read a raw hfsp_extent_rec from memory. */
extern void* volume_readextent(void *p, hfsp_extent_rec er);
/* Read fork information from raw memory */
/* Read fork information from raw memory */
extern void* volume_readfork(void *p, hfsp_fork_raw* f);
/* internal function used to create the extents btree,
@@ -70,7 +70,7 @@ static inline btree* volume_get_extents_tree(volume* vol) {
volume_create_extents_tree(vol);
return vol->extents;
}
#ifdef DEBUG
/* Print raw fork information to stdout */

View File

@@ -25,4 +25,4 @@
#include "openbios/config.h"
#include "libhfsp.h"
const char *hfsp_error = "no error"; /* static error string */
const char *hfsp_error = "no error"; /* static error string */

View File

@@ -6,7 +6,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original 1996-1998 Robert Leslie <rob@mars.org>
* Additional work by Brad Boyer (flar@pants.nu)
* Additional work by Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ void* record_readkey(void* p, void* buf)
/* check if keylenght was correct */
if (key_length != ((char*) p) - ((char*) check))
HFSP_ERROR(EINVAL, "Invalid key length in record_readkey");
return p;
return p;
fail:
return NULL;
}
@@ -70,7 +70,7 @@ void* record_extent_readkey(void* p, void* buf)
HFSP_ERROR(-1, "Invalid key length in record_extent_readkey");
key->file_id = bswabU32_inc(p);
key->start_block = bswabU32_inc(p);
return p;
return p;
fail:
return NULL;
}
@@ -282,7 +282,7 @@ int record_key_compare(void* k1, void* k2)
hfsp_cat_key* key2 = (hfsp_cat_key*) k2;
int diff = key2->parent_cnid - key1->parent_cnid;
if (!diff) // same parent
diff = fast_unicode_compare(&key1->name, &key2->name);
diff = fast_unicode_compare(&key1->name, &key2->name);
return diff;
}
@@ -333,7 +333,7 @@ static node_buf* record_find_node(btree* tree, void *key)
start = mid + 1;
else if (comp < 0)
end = mid;
else
else
break;
}
if (!p) // Empty tree, fascinating ...
@@ -349,7 +349,7 @@ static node_buf* record_find_node(btree* tree, void *key)
if (!p)
HFSP_ERROR(-1, "record_find_node: unexpected error");
}
index = bswabU32_inc(p);
node = btree_node_by_index(tree, index);
}
@@ -359,7 +359,7 @@ static node_buf* record_find_node(btree* tree, void *key)
}
/* search for the given key in the btree.
*
*
* returns pointer to memory just after key or NULL
* In any case *keyind recives the index where the
* key was found (or could be inserted.)
@@ -392,7 +392,7 @@ record_find_key(btree* tree, void* key, int* keyind, UInt16* node_index)
start = mid + 1;
else if (comp < 0)
end = mid;
else
else
break;
}
if (!p) // Empty tree, fascinating ...
@@ -408,7 +408,7 @@ record_find_key(btree* tree, void* key, int* keyind, UInt16* node_index)
}
/* intialize the record by searching for the given key in the btree.
*
*
* r is umodified on error.
*/
static int
@@ -417,7 +417,7 @@ record_init_key(record* r, btree* tree, hfsp_cat_key* key)
int keyind;
UInt16 node_index;
void *p = record_find_key(tree, key, &keyind, &node_index);
if (p)
{
r -> tree = tree;
@@ -438,14 +438,14 @@ record_init_key(record* r, btree* tree, hfsp_cat_key* key)
*
* forktype: either HFSP_EXTEND_DATA or HFSP_EXTEND_RSRC
*/
int record_init_file(extent_record* r, btree* tree,
int record_init_file(extent_record* r, btree* tree,
UInt8 forktype, UInt32 fileId, UInt32 blockindex)
{
int keyind;
UInt16 node_index;
hfsp_extent_key key = { 10, forktype, 0, fileId, blockindex };
void *p = record_find_key(tree, &key, &keyind, &node_index);
if (p)
{
r -> tree = tree;
@@ -466,7 +466,7 @@ int record_init_file(extent_record* r, btree* tree,
int record_init_cnid(record* r, btree* tree, UInt32 cnid)
{
hfsp_cat_key thread_key; // the thread is the first record
thread_key.key_length = 6; // null name (like '.' in unix )
thread_key.parent_cnid = cnid;
thread_key.name.strlen = 0;
@@ -486,7 +486,7 @@ int record_init_parent(record* r, record* parent)
*r = *parent; // The folder thread is in fact the first entry, like '.'
return 0;
}
HFSP_ERROR(EINVAL,
HFSP_ERROR(EINVAL,
"record_init_parent: parent is neither folder nor folder thread.");
fail:
@@ -513,9 +513,9 @@ static node_buf* prepare_next(btree* tree, UInt16 node_index, UInt16* pindex)
}
return buf;
}
/* move record foreward to next entry.
/* move record foreward to next entry.
*
* In case of an error the value of *r is undefined !
* In case of an error the value of *r is undefined !
*/
int record_next(record* r)
{
@@ -523,10 +523,10 @@ int record_next(record* r)
UInt16 index = r->keyind +1;
UInt32 parent;
node_buf* buf = prepare_next(tree, r->node_index, &index);
if (!buf)
return ENOENT; // No (more) such file or directory
parent = r->key.parent_cnid;
if (record_init(r, tree, buf, index))
@@ -539,9 +539,9 @@ int record_next(record* r)
return 0;
}
/* move record foreward to next extent record.
/* move record foreward to next extent record.
*
* In case of an error the value of *r is undefined !
* In case of an error the value of *r is undefined !
*/
int record_next_extent(extent_record* r)
{
@@ -553,7 +553,7 @@ int record_next_extent(extent_record* r)
if (!buf)
return ENOENT; // No (more) such file or directory
file_id = r->key.file_id;
fork_type = r->key.fork_type;
@@ -569,13 +569,13 @@ int record_next_extent(extent_record* r)
}
/* intialize the record by searching for the given string in the given folder.
*
*
* parent and r may be the same.
*/
int record_init_string_parent(record* r, record* parent, char* name)
{
hfsp_cat_key key;
if (parent->record.type == HFSP_FOLDER)
key.parent_cnid = parent->record.u.folder.id;
else if(parent->record.type == HFSP_FOLDER_THREAD)
@@ -632,8 +632,8 @@ static void record_print_Rect(Rect* r)
/* print the key of a record */
static void record_print_key(hfsp_cat_key* key)
{
char buf[255]; // mh this _might_ overflow
unicode_uni2asc(buf, &key->name, 255);
char buf[255]; // mh this _might_ overflow
unicode_uni2asc(buf, &key->name, 255);
printf("parent cnid : %ld\n", key->parent_cnid);
printf("name : %s\n", buf);
}
@@ -687,7 +687,7 @@ static void record_print_FInfo(FInfo* finfo)
printf( "fdLocation :\t"); record_print_Point(&finfo->fdLocation);
printf("\nfdFldr :\t%d\n", finfo->fdFldr);
}
/* print extended File info */
static void record_print_FXInfo(FXInfo* xinfo)
{
@@ -695,7 +695,7 @@ static void record_print_FXInfo(FXInfo* xinfo)
// xinfo -> fdUnused;
printf( "fdComment :\t%d\n", xinfo->fdComment);
printf( "fdPutAway :\t%ld\n", xinfo->fdPutAway);
}
}
/* print folder entry */
@@ -719,8 +719,8 @@ static void record_print_file(hfsp_cat_file* file)
/* print info for a file or folder thread */
static void record_print_thread(hfsp_cat_thread* entry)
{
char buf[255]; // mh this _might_ overflow
unicode_uni2asc(buf, &entry->nodeName, 255);
char buf[255]; // mh this _might_ overflow
unicode_uni2asc(buf, &entry->nodeName, 255);
printf("parent cnid :\t%ld\n", entry->parentID);
printf("name :\t%s\n" , buf);
}

View File

@@ -18,7 +18,7 @@ static int
asc2uni( unsigned char *ustr, const char *astr, int maxlen )
{
int len;
if( maxlen <= 0 )
return 0;
@@ -35,10 +35,10 @@ static int
uni2asc( char *astr, const unsigned char *ustr, int ustrlen, int maxlen )
{
int len;
if( maxlen <= 0 )
return 0;
for( len=0; ustrlen-- > 0 && len < maxlen-1 ; ustr += 2 ) {
/* might be unrepresentable (or too complicated for us) */
if( ustr[0] || !ustr[1] )
@@ -70,7 +70,7 @@ fastUnicodeCompare - Compare two Unicode strings; produce a relative ordering
static const UInt16 gLowerCaseTable[];
SInt32 fast_unicode_compare ( const hfsp_unistr255 *ustr1,
SInt32 fast_unicode_compare ( const hfsp_unistr255 *ustr1,
const hfsp_unistr255 *ustr2)
{
register UInt16 c1,c2;

View File

@@ -5,7 +5,7 @@
*
* Copyright (C) 2000 Klaus Halfmann <khalfmann@libra.de>
* Original work by 1996-1998 Robert Leslie <rob@mars.org>
* other work 2000 from Brad Boyer (flar@pants.nu)
* other work 2000 from Brad Boyer (flar@pants.nu)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,15 +36,15 @@
/* Fill a given buffer with the given block in volume.
*/
int
int
volume_readinbuf(volume * vol,void* buf, long block)
{
UInt16 blksize_bits;
ASSERT( block < vol->maxblocks);
blksize_bits = vol->blksize_bits;
blksize_bits = vol->blksize_bits;
block += vol->startblock;
if( os_seek(vol->os_fd, block, blksize_bits) == block)
if( os_seek(vol->os_fd, block, blksize_bits) == block)
if( 1 == os_read(vol->os_fd, buf, 1, blksize_bits))
return 0;
return -1;
@@ -54,9 +54,9 @@ volume_readinbuf(volume * vol,void* buf, long block)
*
* returns given pinter or NULL on failure.
*/
void*
volume_readfromfork(volume* vol, void* buf,
hfsp_fork_raw* f, UInt32 block,
void*
volume_readfromfork(volume* vol, void* buf,
hfsp_fork_raw* f, UInt32 block,
UInt32 count, UInt8 forktype, UInt32 fileId)
{
blockiter iter;
@@ -71,7 +71,7 @@ volume_readfromfork(volume* vol, void* buf,
if( volume_readinbuf(vol, cbuf, blockiter_curr(&iter)))
return NULL;
cbuf += vol->blksize;
if( count > 0 && blockiter_next(&iter))
if( count > 0 && blockiter_next(&iter))
return NULL;
}
return buf;
@@ -79,7 +79,7 @@ volume_readfromfork(volume* vol, void* buf,
/* Read a raw hfsp_extent_rec from memory.
*
*
* return pointer right after the structure.
*/
void*
@@ -97,10 +97,10 @@ volume_readextent(void *p, hfsp_extent_rec er)
}
/* Read a raw hfsp_fork from memory.
*
*
* return pointer right after the structure.
*/
void*
void*
volume_readfork(void *p, hfsp_fork_raw* f)
{
f->total_size = bswabU64_inc(p);
@@ -111,18 +111,18 @@ volume_readfork(void *p, hfsp_fork_raw* f)
}
/* Read the volume from the given buffer and swap the bytes.
*
* ToDo: add more consitency checks.
*
* ToDo: add more consitency checks.
*/
static int
volume_readbuf(hfsp_vh* vh, char * p)
{
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
if( (vh->signature = bswabU16_inc(p)) != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This is not a HFS+ volume");
vh->version = bswabU16_inc(p);
vh->attributes = bswabU32_inc(p);
vh->last_mount_vers = bswabU32_inc(p);
vh->attributes = bswabU32_inc(p);
vh->last_mount_vers = bswabU32_inc(p);
vh->reserved = bswabU32_inc(p);
vh->create_date = bswabU32_inc(p);
vh->modify_date = bswabU32_inc(p);
@@ -139,7 +139,7 @@ volume_readbuf(hfsp_vh* vh, char * p)
vh->next_cnid = bswabU32_inc(p);
vh->write_count = bswabU32_inc(p);
vh->encodings_bmp = bswabU64_inc(p);
memcpy(vh->finder_info, p, 32);
memcpy(vh->finder_info, p, 32);
p += 32; // So finderinfo must be swapped later, ***
p = volume_readfork(p, &vh->alloc_file );
p = volume_readfork(p, &vh->ext_file );
@@ -150,9 +150,9 @@ volume_readbuf(hfsp_vh* vh, char * p)
fail:
return -1;
}
/* Read the volume from the given block */
static int
static int
volume_read(volume * vol, hfsp_vh* vh, UInt32 block)
{
char buf[vol->blksize];
@@ -163,7 +163,7 @@ volume_read(volume * vol, hfsp_vh* vh, UInt32 block)
}
/* Find out wether the volume is wrapped and unwrap it eventually */
static int
static int
volume_read_wrapper(volume * vol, hfsp_vh* vh)
{
UInt16 signature;
@@ -179,19 +179,19 @@ volume_read_wrapper(volume * vol, hfsp_vh* vh)
UInt32 sect_per_block; /* how may block build an hfs sector */
UInt16 drAlBlSt; /* first allocation block in volume */
UInt16 embeds, embedl; /* Start/lenght of embedded area in blocks */
p += 0x12; /* skip unneded HFS vol fields */
drAlBlkSiz = bswabU32_inc(p); /* offset 0x14 */
p += 0x4; /* skip unneded HFS vol fields */
drAlBlSt = bswabU16_inc(p); /* offset 0x1C */
p += 0x5E; /* skip unneded HFS vol fields */
signature = bswabU16_inc(p); /* offset 0x7C, drEmbedSigWord */
if( signature != HFSP_VOLHEAD_SIG)
HFSP_ERROR(-1, "This looks like a normal HFS volume");
embeds = bswabU16_inc(p);
embedl = bswabU16_inc(p);
sect_per_block = (drAlBlkSiz / HFSP_BLOCKSZ);
sect_per_block = (drAlBlkSiz / HFSP_BLOCKSZ);
// end is absolute (not relative to HFS+ start)
vol->maxblocks = embedl * sect_per_block;
vol->startblock = drAlBlSt + embeds * sect_per_block;
@@ -207,7 +207,7 @@ fail:
return -1;
}
/* Open the device, read and verify the volume header
(and its backup) */
int
@@ -223,12 +223,12 @@ volume_open( volume* vol, int os_fd )
vol->maxblocks = 3;
/* this should be enough until we find the volume descriptor */
vol->extents = NULL; /* Thanks to Jeremias Sauceda */
btree_reset(&vol->catalog);
vol->os_fd = os_fd;
// vol->maxblocks = os_seek(vol->os_fd, -1, HFSP_BLOCKSZ_BITS);
// This wont work for /dev/... but we do not really need it
// vol->maxblocks = os_seek(vol->os_fd, -1, HFSP_BLOCKSZ_BITS);
// This wont work for /dev/... but we do not really need it
if( volume_read_wrapper(vol, &vol->vol))
return -1;
@@ -249,17 +249,17 @@ volume_open( volume* vol, int os_fd )
shift++;
} /* shift = 3 */
}
vol -> blksize_bits += shift;
vol -> blksize_bits += shift;
vol -> blksize = 1 << vol->blksize_bits;
vol -> startblock >>= shift;
vol -> maxblocks = vol->vol.total_blocks; /* cant calculate via shift ? */
if( btree_init_cat(&vol->catalog, vol, &vol->vol.cat_file))
return -1;
return 0;
}
/* Write back all data eventually cached and close the device */
int
volume_close(volume* vol)
@@ -274,7 +274,7 @@ volume_close(volume* vol)
/* internal fucntion used to create the extents btree,
is called by inline function when needed */
void
void
volume_create_extents_tree(volume* vol)
{
btree* result = (btree*) ALLOC(btree*, sizeof(btree));
@@ -285,5 +285,5 @@ volume_create_extents_tree(volume* vol)
return;
}
fail:
vol->extents = NULL;
vol->extents = NULL;
}

View File

@@ -1,17 +1,17 @@
/*
/*
* Creation Date: <2001/05/06 22:27:09 samuel>
* Time-stamp: <2003/12/12 02:24:56 samuel>
*
*
* <fs.c>
*
*
* I/O API used by the filesystem code
*
*
* Copyright (C) 2001, 2002, 2003 Samuel Rydh (samuel@ibrium.se)
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*
*/
#include "openbios/config.h"