]> git.ozlabs.org Git - yaboot.git/blobdiff - second/fs_reiserfs.c
Pretend to allocate/deallocate memory correctly
[yaboot.git] / second / fs_reiserfs.c
index fd5c0794b7a005db30c82d8484cb1637fe78fafe..95942374c4045ac16c3a5c69b9d363feff107c08 100644 (file)
@@ -1,26 +1,27 @@
-/* ReiserFS filesystem
-   
-   Copyright (C) 2001 Jeffrey Mahoney (jeffm@suse.com)
-
-   Adapted from GRUB
-
-   Copyright (C) 2000, 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
-   (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., 675 Mass Ave, Cambridge, MA 02139, USA.
+/*
+ *  fs_reiserfs.c - an implementation for the Reiser filesystem
+ *
+ *  Copyright (C) 2001 Jeffrey Mahoney (jeffm@suse.com)
+ *
+ *  Adapted from Grub
+ *
+ *  Copyright (C) 2000, 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
+ *  (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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
 
 
-*/
 #include "types.h"
 #include "ctype.h"
 #include "string.h"
 #include "types.h"
 #include "ctype.h"
 #include "string.h"
@@ -75,7 +76,7 @@ reiserfs_open( struct boot_file_t *file, const char *dev_name,
      if (part)
      {
          DEBUG_F( "Determining offset for partition %d\n", part->part_number );
      if (part)
      {
          DEBUG_F( "Determining offset for partition %d\n", part->part_number );
-         INFO->partition_offset = ((__u64)(part->part_start)) * ((__u64)part->blocksize);
+         INFO->partition_offset = ((uint64_t)part->part_start) * part->blocksize;
          DEBUG_F( "%Lu = %lu * %hu\n", INFO->partition_offset,
                   part->part_start,
                   part->blocksize );
          DEBUG_F( "%Lu = %lu * %hu\n", INFO->partition_offset,
                   part->part_start,
                   part->blocksize );
@@ -168,8 +169,8 @@ read_disk_block( struct boot_file_t *file, __u32 block, __u32 start,
 {
      __u16 fs_blocksize = INFO->blocksize == 0 ? REISERFS_OLD_BLOCKSIZE
          : INFO->blocksize;
 {
      __u16 fs_blocksize = INFO->blocksize == 0 ? REISERFS_OLD_BLOCKSIZE
          : INFO->blocksize;
-     unsigned long long pos = block * fs_blocksize;
-     pos += INFO->partition_offset + start;
+     unsigned long long pos = (unsigned long long)block * (unsigned long long)fs_blocksize;
+     pos += (unsigned long long)INFO->partition_offset + (unsigned long long)start;
      DEBUG_F( "Reading %u bytes, starting at block %u, disk offset %Lu\n",
              length, block, pos );
      if (!prom_lseek( file->of_device, pos )) {
      DEBUG_F( "Reading %u bytes, starting at block %u, disk offset %Lu\n",
              length, block, pos );
      if (!prom_lseek( file->of_device, pos )) {
@@ -525,6 +526,7 @@ read_tree_node( __u32 blockNr, __u16 depth )
 {
      char *cache = CACHE(depth);
      int num_cached = INFO->cached_slots;
 {
      char *cache = CACHE(depth);
      int num_cached = INFO->cached_slots;
+     errnum = 0;
 
      if ( depth < num_cached )
      {
 
      if ( depth < num_cached )
      {
@@ -670,7 +672,7 @@ search_stat( __u32 dir_id, __u32 objectid )
      int nr_item;
      int i;
      struct item_head *ih;
      int nr_item;
      int i;
      struct item_head *ih;
-
+     errnum = 0;
 
      DEBUG_F( "search_stat:\n  key %u:%u:0:0\n", le32_to_cpu(dir_id),
              le32_to_cpu(objectid) );
 
      DEBUG_F( "search_stat:\n  key %u:%u:0:0\n", le32_to_cpu(dir_id),
              le32_to_cpu(objectid) );
@@ -744,7 +746,7 @@ reiserfs_read_data( char *buf, __u32 len )
      __u32 offset;
      __u32 to_read;
      char *prev_buf = buf;
      __u32 offset;
      __u32 to_read;
      char *prev_buf = buf;
-
+     errnum = 0;
 
      DEBUG_F( "reiserfs_read_data: INFO->file->pos=%Lu len=%u, offset=%Lu\n",
              INFO->file->pos, len, (__u64) IH_KEY_OFFSET(INFO->current_ih) - 1 );
 
      DEBUG_F( "reiserfs_read_data: INFO->file->pos=%Lu len=%u, offset=%Lu\n",
              INFO->file->pos, len, (__u64) IH_KEY_OFFSET(INFO->current_ih) - 1 );
@@ -834,6 +836,7 @@ reiserfs_open_file( char *dirname )
      char linkbuf[PATH_MAX];   /* buffer for following symbolic links */
      int link_count = 0;
      int mode;
      char linkbuf[PATH_MAX];   /* buffer for following symbolic links */
      int link_count = 0;
      int mode;
+     errnum = 0;
 
      dir_id = cpu_to_le32(REISERFS_ROOT_PARENT_OBJECTID);
      objectid = cpu_to_le32(REISERFS_ROOT_OBJECTID);
 
      dir_id = cpu_to_le32(REISERFS_ROOT_PARENT_OBJECTID);
      objectid = cpu_to_le32(REISERFS_ROOT_OBJECTID);
@@ -1046,7 +1049,7 @@ uniqueness2type (__u32 uniqueness)
 
 /* 
  * Local variables:
 
 /* 
  * Local variables:
- * c-file-style: "K&R"
+ * c-file-style: "k&r"
  * c-basic-offset: 5
  * End:
  */
  * c-basic-offset: 5
  * End:
  */