boot loader: Almost removed use of kernel_cpp.h.

* For some reason that is beyond me, fat/CachedBlock.cpp needs this header,
  or else building the boot loader fails.
This commit is contained in:
Axel Dörfler
2013-05-11 19:34:22 +02:00
parent c3e68d8d92
commit 4b723e3fb8
24 changed files with 110 additions and 126 deletions
+1 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2006, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -7,7 +7,6 @@
#include "RootFileSystem.h" #include "RootFileSystem.h"
#include <OS.h> #include <OS.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
@@ -9,7 +9,6 @@
#include "File.h" #include "File.h"
#include <StorageDefs.h> #include <StorageDefs.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -18,6 +17,7 @@
namespace FFS { namespace FFS {
Directory::Directory(Volume &volume, int32 block) Directory::Directory(Volume &volume, int32 block)
: :
fVolume(volume) fVolume(volume)
@@ -165,4 +165,5 @@ Directory::Inode() const
return fNode.HeaderKey(); return fNode.HeaderKey();
} }
} // namespace FFS } // namespace FFS
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
@@ -10,11 +10,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <util/kernel_cpp.h>
namespace FFS { namespace FFS {
class Stream { class Stream {
public: public:
Stream(int device, FileBlock &node); Stream(int device, FileBlock &node);
@@ -255,4 +254,5 @@ File::Inode() const
return fNode.HeaderKey(); return fNode.HeaderKey();
} }
} // namespace FFS } // namespace FFS
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
@@ -9,7 +9,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
@@ -8,7 +8,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Axel Dörfler, [email protected]. * Copyright 2003-2013, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -10,7 +10,6 @@
#include <StorageDefs.h> #include <StorageDefs.h>
#include <KernelExport.h> #include <KernelExport.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -1,16 +1,15 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * This file may be used under the terms of the MIT License.
*/ */
#include "File.h" #include "File.h"
#include <util/kernel_cpp.h>
namespace BFS { namespace BFS {
File::File(Volume &volume, block_run run) File::File(Volume &volume, block_run run)
: :
fStream(volume, run) fStream(volume, run)
@@ -89,4 +88,5 @@ File::Inode() const
return fStream.ID(); return fStream.ID();
} }
} // namespace BFS } // namespace BFS
@@ -1,16 +1,15 @@
/* /*
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2004-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * This file may be used under the terms of the MIT License.
*/ */
#include "Link.h" #include "Link.h"
#include <util/kernel_cpp.h>
namespace BFS { namespace BFS {
Link::Link(Volume &volume, block_run run) Link::Link(Volume &volume, block_run run)
: File(volume, run) : File(volume, run)
{ {
@@ -63,4 +62,5 @@ Link::Type() const
return S_IFLNK; return S_IFLNK;
} }
} // namespace BFS } // namespace BFS
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Axel Dörfler, [email protected]. * Copyright 2003-2013, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License. * This file may be used under the terms of the MIT License.
*/ */
@@ -12,8 +12,6 @@
#include "File.h" #include "File.h"
#include "Link.h" #include "Link.h"
#include <util/kernel_cpp.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2009, Axel Dörfler, [email protected]. * Copyright 2003-2013, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -12,7 +12,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <boot/vfs.h> #include <boot/vfs.h>
#include <util/kernel_cpp.h>
#include "Volume.h" #include "Volume.h"
#include "Directory.h" #include "Directory.h"
@@ -9,16 +9,12 @@
#define CACHED_BLOCK_H #define CACHED_BLOCK_H
#include <SupportDefs.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include "Volume.h" #include "Volume.h"
namespace FATFS { namespace FATFS {
class CachedBlock { class CachedBlock {
public: public:
enum { enum {
@@ -1,6 +1,7 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Copyright 2008, François Revol <[email protected]>
* Distributed under the terms of the MIT License.
*/ */
@@ -14,7 +15,6 @@
#include <new> #include <new>
#include <StorageDefs.h> #include <StorageDefs.h>
#include <util/kernel_cpp.h>
#include "CachedBlock.h" #include "CachedBlock.h"
#include "File.h" #include "File.h"
@@ -24,8 +24,10 @@
//#define TRACE(x) dprintf x //#define TRACE(x) dprintf x
#define TRACE(x) do {} while (0) #define TRACE(x) do {} while (0)
namespace FATFS { namespace FATFS {
struct dir_entry { struct dir_entry {
void *Buffer() const { return (void *)fName; }; void *Buffer() const { return (void *)fName; };
const char *BaseName() const { return fName; }; const char *BaseName() const { return fName; };
@@ -328,7 +330,7 @@ Directory::Open(void **_cookie, int mode)
TRACE(("FASFS::Directory::%s(, %d)\n", __FUNCTION__, mode)); TRACE(("FASFS::Directory::%s(, %d)\n", __FUNCTION__, mode));
_inherited::Open(_cookie, mode); _inherited::Open(_cookie, mode);
struct dir_cookie *c = new struct dir_cookie; dir_cookie *c = new(nothrow) dir_cookie;
if (c == NULL) if (c == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -1,6 +1,7 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Copyright 2008, François Revol <[email protected]>
* Distributed under the terms of the MIT License.
*/ */
@@ -9,8 +10,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <util/kernel_cpp.h>
#include "Directory.h" #include "Directory.h"
@@ -137,4 +136,5 @@ File::Inode() const
return fStream.FirstCluster() << 16; return fStream.FirstCluster() << 16;
} }
} // namespace FATFS } // namespace FATFS
@@ -17,12 +17,12 @@
#include <algorithm> #include <algorithm>
#include <boot/FileMapDisk.h> #include <boot/FileMapDisk.h>
#include <util/kernel_cpp.h>
#include "CachedBlock.h" #include "CachedBlock.h"
#include "Directory.h" #include "Directory.h"
#include "File.h" #include "File.h"
//#define TRACE(x) dprintf x //#define TRACE(x) dprintf x
#define TRACE(x) do {} while (0) #define TRACE(x) do {} while (0)
@@ -1,6 +1,7 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2003-2013, Axel Dörfler, [email protected].
** Distributed under the terms of the OpenBeOS License. * Copyright 2008, François Revol <[email protected]>
* Distributed under the terms of the MIT License.
*/ */
@@ -10,7 +11,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -18,9 +18,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
//#define TRACE(x) dprintf x //#define TRACE(x) dprintf x
#define TRACE(x) do {} while (0) #define TRACE(x) do {} while (0)
using namespace FATFS; using namespace FATFS;
@@ -33,7 +35,7 @@ Volume::Volume(boot::Partition *partition)
if ((fDevice = open_node(partition, O_RDONLY)) < B_OK) if ((fDevice = open_node(partition, O_RDONLY)) < B_OK)
return; return;
fCachedBlock = new CachedBlock(*this); fCachedBlock = new(nothrow) CachedBlock(*this);
if (fCachedBlock == NULL) if (fCachedBlock == NULL)
return; return;
@@ -135,13 +137,13 @@ Volume::Volume(boot::Partition *partition)
fFatBits = 16; fFatBits = 16;
goto err1; goto err1;
} }
TRACE(("%s: block size %d, sector size %d, sectors/cluster %d\n", __FUNCTION__, TRACE(("%s: block size %d, sector size %d, sectors/cluster %d\n",
fBlockSize, fBytesPerSector, fSectorsPerCluster)); __FUNCTION__, fBlockSize, fBytesPerSector, fSectorsPerCluster));
TRACE(("%s: block shift %d, sector shift %d, cluster shift %d\n", __FUNCTION__, TRACE(("%s: block shift %d, sector shift %d, cluster shift %d\n",
fBlockShift, fSectorShift, fClusterShift)); __FUNCTION__, fBlockShift, fSectorShift, fClusterShift));
TRACE(("%s: reserved %d, max root entries %d, media %02x, sectors/fat %d\n", __FUNCTION__, TRACE(("%s: reserved %d, max root entries %d, media %02x, sectors/fat %d\n",
fReservedSectors, fMaxRootEntries, fMediaDesc, fSectorsPerFat)); __FUNCTION__, fReservedSectors, fMaxRootEntries, fMediaDesc,
fSectorsPerFat));
//if (fTotalSectors > partition->sectors_per_track * partition->cylinder_count * partition->head_count) //if (fTotalSectors > partition->sectors_per_track * partition->cylinder_count * partition->head_count)
if ((off_t)fTotalSectors * fBytesPerSector > partition->size) if ((off_t)fTotalSectors * fBytesPerSector > partition->size)
@@ -150,7 +152,7 @@ Volume::Volume(boot::Partition *partition)
TRACE(("%s: found fat%d filesystem, root dir at cluster %d\n", __FUNCTION__, TRACE(("%s: found fat%d filesystem, root dir at cluster %d\n", __FUNCTION__,
fFatBits, fRootDirCluster)); fFatBits, fRootDirCluster));
fRoot = new Directory(*this, 0, fRootDirCluster, "/"); fRoot = new(nothrow) Directory(*this, 0, fRootDirCluster, "/");
return; return;
err1: err1:
@@ -413,7 +415,7 @@ static status_t
dosfs_get_file_system(boot::Partition *partition, ::Directory **_root) dosfs_get_file_system(boot::Partition *partition, ::Directory **_root)
{ {
TRACE(("%s()\n", __FUNCTION__)); TRACE(("%s()\n", __FUNCTION__));
Volume *volume = new Volume(partition); Volume *volume = new(nothrow) Volume(partition);
if (volume == NULL) if (volume == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -1,6 +1,6 @@
/* /*
** Copyright 2003, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2008, François Revol <[email protected]>
** Distributed under the terms of the OpenBeOS License. * Distributed under the terms of the MIT License.
*/ */
@@ -8,7 +8,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -1,5 +1,5 @@
/* /*
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2005-2013, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -8,7 +8,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -1,6 +1,6 @@
/* /*
* Copyright 2005-2007, Ingo Weinhold, [email protected]. * Copyright 2005-2007, Ingo Weinhold, [email protected].
* Copyright 2005-2009, Axel Dörfler, [email protected]. * Copyright 2005-2013, Axel Dörfler, [email protected].
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -21,7 +21,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#include <util/DoublyLinkedList.h> #include <util/DoublyLinkedList.h>
@@ -39,6 +38,7 @@ static const size_t kTarRegionSize = 8 * 1024 * 1024; // 8 MB
namespace TarFS { namespace TarFS {
struct RegionDelete { struct RegionDelete {
inline void operator()(void* memory) inline void operator()(void* memory)
{ {
@@ -813,7 +813,6 @@ TarFS::Volume::_Inflate(boot::Partition* partition, void* cookie, off_t offset,
} }
// #pragma mark - // #pragma mark -
+1 -2
View File
@@ -1,12 +1,11 @@
/* /*
* Copyright 2003-2009, Axel Dörfler, [email protected]. * Copyright 2003-2013, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <boot/heap.h> #include <boot/heap.h>
#include <boot/platform.h> #include <boot/platform.h>
#include <util/kernel_cpp.h>
#ifdef HEAP_TEST #ifdef HEAP_TEST
# include <stdio.h> # include <stdio.h>
+1 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -14,8 +14,6 @@
#include <boot/heap.h> #include <boot/heap.h>
#include <boot/stdio.h> #include <boot/stdio.h>
#include <util/kernel_cpp.h>
//#define TRACE_MAIN //#define TRACE_MAIN
#ifdef TRACE_MAIN #ifdef TRACE_MAIN
+1 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2010, Axel Dörfler, axeld@pinc-software.de. * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
* Copyright 2011, Rene Gollent, rene@gollent.com. * Copyright 2011, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -21,7 +21,6 @@
#include <boot/platform/generic/text_console.h> #include <boot/platform/generic/text_console.h>
#include <boot/stdio.h> #include <boot/stdio.h>
#include <safemode.h> #include <safemode.h>
#include <util/kernel_cpp.h>
#include <util/ring_buffer.h> #include <util/ring_buffer.h>
#include "kernel_debug_config.h" #include "kernel_debug_config.h"
+3 -4
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -16,7 +16,6 @@
#include <boot/stdio.h> #include <boot/stdio.h>
#include <boot/vfs.h> #include <boot/vfs.h>
#include <ddm_modules.h> #include <ddm_modules.h>
#include <util/kernel_cpp.h>
#include "RootFileSystem.h" #include "RootFileSystem.h"
@@ -212,7 +211,7 @@ Partition::Type() const
Partition * Partition *
Partition::AddChild() Partition::AddChild()
{ {
Partition *child = new Partition(fFD); Partition *child = new(nothrow) Partition(fFD);
TRACE(("%p Partition::AddChild %p\n", this, child)); TRACE(("%p Partition::AddChild %p\n", this, child));
if (child == NULL) if (child == NULL)
return NULL; return NULL;
@@ -426,7 +425,7 @@ add_partitions_for(int fd, bool mountFileSystems, bool isBootDevice)
TRACE(("add_partitions_for(fd = %d, mountFS = %s)\n", fd, TRACE(("add_partitions_for(fd = %d, mountFS = %s)\n", fd,
mountFileSystems ? "yes" : "no")); mountFileSystems ? "yes" : "no"));
Partition *partition = new Partition(fd); Partition *partition = new(nothrow) Partition(fd);
// set some magic/default values // set some magic/default values
partition->block_size = 512; partition->block_size = 512;
+1 -2
View File
@@ -1,12 +1,11 @@
/* /*
* Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <boot/vfs.h> #include <boot/vfs.h>
#include <boot/stdio.h> #include <boot/stdio.h>
#include <util/kernel_cpp.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
+1 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. * Copyright 2003-2013, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -18,7 +18,6 @@
#include <boot/partitions.h> #include <boot/partitions.h>
#include <boot/stdio.h> #include <boot/stdio.h>
#include <boot/stage2.h> #include <boot/stage2.h>
#include <util/kernel_cpp.h>
#include <syscall_utils.h> #include <syscall_utils.h>
#include "RootFileSystem.h" #include "RootFileSystem.h"