X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=second%2Ffs_reiserfs.c;h=b0c3ac00ee6743c3c6a21c8173462921446be0c9;hb=f82dc817c486c26448514b4ef82d49b34a80dd25;hp=4ad1c2ec176dbb9bb7495e9550e0d4312c40643e;hpb=a2b7bb030d78c61ef150f8c9f6926c9558a6f1b5;p=yaboot.git diff --git a/second/fs_reiserfs.c b/second/fs_reiserfs.c index 4ad1c2e..b0c3ac0 100644 --- a/second/fs_reiserfs.c +++ b/second/fs_reiserfs.c @@ -29,11 +29,12 @@ #include "fs.h" #include "errors.h" #include "debug.h" +#include "bootinfo.h" #include "reiserfs/reiserfs.h" /* Exported in struct fs_t */ -static int reiserfs_open( struct boot_file_t *file, const char *dev_name, - struct partition_t *part, const char *file_name ); +static int reiserfs_open( struct boot_file_t *file, struct partition_t *part, + struct boot_fspec_t *fspec); static int reiserfs_read( struct boot_file_t *file, unsigned int size, void *buffer ); @@ -62,10 +63,12 @@ int errnum; static int -reiserfs_open( struct boot_file_t *file, const char *dev_name, - struct partition_t *part, const char *file_name ) +reiserfs_open( struct boot_file_t *file, struct partition_t *part, + struct boot_fspec_t *fspec) { static char buffer[1024]; + char *dev_name = fspec->dev; + char *file_name = fspec->file; DEBUG_ENTER; DEBUG_OPEN; @@ -73,7 +76,7 @@ reiserfs_open( struct boot_file_t *file, const char *dev_name, memset( INFO, 0, sizeof(struct reiserfs_state) ); INFO->file = file; - if (part) + if (fspec->part) { DEBUG_F( "Determining offset for partition %d\n", part->part_number ); INFO->partition_offset = ((uint64_t)part->part_start) * part->blocksize; @@ -84,7 +87,10 @@ reiserfs_open( struct boot_file_t *file, const char *dev_name, else INFO->partition_offset = 0; - sprintf( buffer, "%s:%d", dev_name, 0 ); /* 0 is full disk in OF */ + strncpy(buffer, dev_name, 1020); + if (_machine != _MACH_bplan) + strcat(buffer, ":0"); /* 0 is full disk in (non-buggy) OF */ + file->of_device = prom_open( buffer ); DEBUG_F( "Trying to open dev_name=%s; filename=%s; partition offset=%Lu\n", buffer, file_name, INFO->partition_offset ); @@ -150,7 +156,7 @@ reiserfs_close( struct boot_file_t *file ) static __inline__ __u32 -log2( __u32 word ) +reiserfs_log2( __u32 word ) { int i = 0; while( word && (word & (1 << ++i)) == 0 ); @@ -207,7 +213,7 @@ block_read( __u32 blockNr, __u32 start, __u32 len, char *buffer ) while ( transactions-- > 0 ) { int i = 0; - int j_len; + int j_len = 0; if ( *journal_table != 0xffffffff ) { @@ -422,7 +428,7 @@ reiserfs_read_super( void ) INFO->version = le16_to_cpu(super.s_version); INFO->blocksize = le16_to_cpu(super.s_blocksize); - INFO->blocksize_shift = log2( INFO->blocksize ); + INFO->blocksize_shift = reiserfs_log2( INFO->blocksize ); INFO->journal_block = le32_to_cpu(super.s_journal_block); INFO->journal_block_count = le32_to_cpu(super.s_orig_journal_size);