]> git.ozlabs.org Git - yaboot.git/blobdiff - second/fs_xfs.c
Version 1.3.15
[yaboot.git] / second / fs_xfs.c
index 14793bbc73659e46f6dddba4682b2de2129beec6..04d6cf3a4db03943a444636abec51c27bc26c6d7 100644 (file)
@@ -1,11 +1,11 @@
 /*
- *  fsys_xfs.c - an implementation for the SGI XFS file system
+ *  fs_xfs.c - an implementation for the SGI XFS file system
  *
- *  Copyright (C) 2001  Ethan Benson
+ *  Copyright (C) 2001, 2002 Ethan Benson
  *
  *  Adapted from Grub
  *
- *  Copyright (C) 2001  Serguei Tzukanov
+ *  Copyright (C) 2001 Serguei Tzukanov
  *
  *  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
@@ -19,7 +19,7 @@
  *
  *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
 #include "types.h"
@@ -30,6 +30,7 @@
 #include "xfs/xfs.h"
 #include "errors.h"
 #include "debug.h"
+#include "bootinfo.h"
 
 #define SECTOR_BITS 9
 
@@ -77,7 +78,9 @@ xfs_open(struct boot_file_t *file, const char *dev_name,
        else
                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 */
        DEBUG_F("Trying to open dev_name=%s; filename=%s; partition offset=%Lu\n",
                buffer, file_name, partition_offset);
        file->of_device = prom_open(buffer);
@@ -92,7 +95,7 @@ xfs_open(struct boot_file_t *file, const char *dev_name,
        DEBUG_F("%p was successfully opened\n", file->of_device);
 
        xfs_file = file;
-    
+
        if (xfs_mount() != 1)
        {
                DEBUG_F("Couldn't open XFS @ %s/%Lu\n", buffer, partition_offset);
@@ -241,7 +244,7 @@ ino2offset (xfs_ino_t ino)
 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);
 }
@@ -512,7 +515,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;
@@ -666,7 +669,7 @@ xfs_read_data (char *buf, int len)
                offset = xad->offset;
                xadlen = xad->len;
                if (isinxt (xfs_file->pos >> xfs.blklog, offset, xadlen)) {
-                       endofcur = (offset + xadlen) << xfs.blklog; 
+                       endofcur = (offset + xadlen) << xfs.blklog;
                        toread = (endofcur >= endpos)
                                  ? len : (endofcur - xfs_file->pos);
                        read_disk_block(xfs_file, fsb2daddr (xad->start),
@@ -684,7 +687,7 @@ xfs_read_data (char *buf, int len)
                        }
                        continue;
                }
-               endofprev = offset + xadlen; 
+               endofprev = offset + xadlen;
        }
 
        return xfs_file->pos - startpos;
@@ -778,7 +781,7 @@ xfs_dir (char *dirname)
        }
 }
 
-/* 
+/*
  * Local variables:
  * c-file-style: "k&r"
  * c-basic-offset: 8