ram_fs: coding style, license headers

Issue #1635
This commit is contained in:
Norman Feske 2015-07-22 15:54:22 +02:00 committed by Christian Helmuth
parent f996697fd5
commit 1feaf75605
5 changed files with 714 additions and 682 deletions

View File

@ -5,7 +5,7 @@
*/ */
/* /*
* Copyright (C) 2012-2013 Genode Labs GmbH * Copyright (C) 2012-2015 Genode Labs GmbH
* *
* This file is part of the Genode OS framework, which is distributed * This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2. * under the terms of the GNU General Public License version 2.
@ -22,14 +22,20 @@
namespace File_system { namespace File_system {
using namespace Genode; using Genode::Noncopyable;
class Chunk_base;
template <unsigned> class Chunk;
template <unsigned, typename> class Chunk_index;
}
/** /**
* Common base class of both 'Chunk' and 'Chunk_index' * Common base class of both 'Chunk' and 'Chunk_index'
*/ */
class Chunk_base : Noncopyable class File_system::Chunk_base : Noncopyable
{ {
public: public:
class Index_out_of_range { }; class Index_out_of_range { };
@ -83,15 +89,15 @@ namespace File_system {
* Return true if chunk has no allocated sub chunks * Return true if chunk has no allocated sub chunks
*/ */
bool empty() const { return _num_entries == 0; } bool empty() const { return _num_entries == 0; }
}; };
/** /**
* Chunk of bytes used as leaf in hierarchy of chunk indices * Chunk of bytes used as leaf in hierarchy of chunk indices
*/ */
template <unsigned CHUNK_SIZE> template <unsigned CHUNK_SIZE>
class Chunk : public Chunk_base class File_system::Chunk : public Chunk_base
{ {
private: private:
char _data[CHUNK_SIZE]; char _data[CHUNK_SIZE];
@ -166,12 +172,12 @@ namespace File_system {
_num_entries = local_offset; _num_entries = local_offset;
} }
}; };
template <unsigned NUM_ENTRIES, typename ENTRY_TYPE> template <unsigned NUM_ENTRIES, typename ENTRY_TYPE>
class Chunk_index : public Chunk_base class File_system::Chunk_index : public Chunk_base
{ {
public: public:
typedef ENTRY_TYPE Entry; typedef ENTRY_TYPE Entry;
@ -435,7 +441,6 @@ namespace File_system {
_num_entries--; _num_entries--;
} }
} }
};
}; };
#endif /* _INCLUDE__RAM_FS__CHUNK_H_ */ #endif /* _INCLUDE__RAM_FS__CHUNK_H_ */

View File

@ -4,6 +4,13 @@
* \date 2012-04-11 * \date 2012-04-11
*/ */
/*
* Copyright (C) 2011-2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__RAM_FS__DIRECTORY_H_ #ifndef _INCLUDE__RAM_FS__DIRECTORY_H_
#define _INCLUDE__RAM_FS__DIRECTORY_H_ #define _INCLUDE__RAM_FS__DIRECTORY_H_
@ -15,10 +22,11 @@
#include <ram_fs/file.h> #include <ram_fs/file.h>
#include <ram_fs/symlink.h> #include <ram_fs/symlink.h>
namespace File_system { namespace File_system { class Directory; }
class Directory : public Node
{ class File_system::Directory : public Node
{
private: private:
List<Node> _entries; List<Node> _entries;
@ -215,7 +223,6 @@ namespace File_system {
} }
size_t num_entries() const { return _num_entries; } size_t num_entries() const { return _num_entries; }
}; };
}
#endif /* _INCLUDE__RAM_FS__DIRECTORY_H_ */ #endif /* _INCLUDE__RAM_FS__DIRECTORY_H_ */

View File

@ -4,6 +4,13 @@
* \date 2012-04-11 * \date 2012-04-11
*/ */
/*
* Copyright (C) 2012-2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__RAM_FS__FILE_H_ #ifndef _INCLUDE__RAM_FS__FILE_H_
#define _INCLUDE__RAM_FS__FILE_H_ #define _INCLUDE__RAM_FS__FILE_H_
@ -14,10 +21,11 @@
#include <ram_fs/node.h> #include <ram_fs/node.h>
#include <ram_fs/chunk.h> #include <ram_fs/chunk.h>
namespace File_system { namespace File_system { class File; }
class File : public Node
{ class File_system::File : public Node
{
private: private:
typedef Chunk<4096> Chunk_level_3; typedef Chunk<4096> Chunk_level_3;
@ -100,7 +108,6 @@ namespace File_system {
mark_as_updated(); mark_as_updated();
} }
}; };
}
#endif /* _INCLUDE__RAM_FS__FILE_H_ */ #endif /* _INCLUDE__RAM_FS__FILE_H_ */

View File

@ -4,6 +4,13 @@
* \date 2012-04-11 * \date 2012-04-11
*/ */
/*
* Copyright (C) 2012-2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__RAM_FS__NODE_H_ #ifndef _INCLUDE__RAM_FS__NODE_H_
#define _INCLUDE__RAM_FS__NODE_H_ #define _INCLUDE__RAM_FS__NODE_H_
@ -12,10 +19,11 @@
#include <file_system/node.h> #include <file_system/node.h>
#include <util/list.h> #include <util/list.h>
namespace File_system { namespace File_system { class Node; }
class Node : public Node_base, public List<Node>::Element
{ class File_system::Node : public Node_base, public List<Node>::Element
{
public: public:
typedef char Name[128]; typedef char Name[128];
@ -51,8 +59,6 @@ namespace File_system {
virtual size_t read(char *dst, size_t len, seek_off_t) = 0; virtual size_t read(char *dst, size_t len, seek_off_t) = 0;
virtual size_t write(char const *src, size_t len, seek_off_t) = 0; virtual size_t write(char const *src, size_t len, seek_off_t) = 0;
}; };
}
#endif /* _INCLUDE__RAM_FS__NODE_H_ */ #endif /* _INCLUDE__RAM_FS__NODE_H_ */

View File

@ -4,16 +4,24 @@
* \date 2012-04-11 * \date 2012-04-11
*/ */
/*
* Copyright (C) 2012-2015 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__RAM_FS__SYMLINK_H_ #ifndef _INCLUDE__RAM_FS__SYMLINK_H_
#define _INCLUDE__RAM_FS__SYMLINK_H_ #define _INCLUDE__RAM_FS__SYMLINK_H_
/* local includes */ /* local includes */
#include <ram_fs/node.h> #include <ram_fs/node.h>
namespace File_system { namespace File_system { class Symlink; }
class Symlink : public Node
{ class File_system::Symlink : public Node
{
private: private:
char _link_to[MAX_PATH_LEN]; char _link_to[MAX_PATH_LEN];
@ -41,7 +49,6 @@ namespace File_system {
} }
file_size_t length() const { return _len; } file_size_t length() const { return _len; }
}; };
}
#endif /* _INCLUDE__RAM_FS__SYMLINK_H_ */ #endif /* _INCLUDE__RAM_FS__SYMLINK_H_ */