]> git.ozlabs.org Git - yaboot.git/blobdiff - second/fs_reiserfs.c
Check for valid "looking" IPs before saving them.
[yaboot.git] / second / fs_reiserfs.c
index 4ad1c2ec176dbb9bb7495e9550e0d4312c40643e..4b83a7aa1c26070f072574258a26626f520053d6 100644 (file)
 #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 );