File systems are modules now.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7806 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-06-07 17:20:59 +00:00
parent 34c763c98f
commit 093015033f
3 changed files with 84 additions and 55 deletions
+38 -30
View File
@@ -19,8 +19,6 @@
#include <string.h>
#include <stdio.h>
#include "builtin_fs.h"
#define BOOTFS_TRACE 0
#if BOOTFS_TRACE
@@ -909,17 +907,52 @@ bootfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
static status_t
bootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int statMask)
bootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, uint32 statMask)
{
// cannot change anything
return EROFS;
}
// #pragma mark -
static status_t
bootfs_std_ops(int32 op, ...)
{
switch (op) {
case B_MODULE_INIT:
{
area_id area;
area_info areaInfo;
// find the bootdir and set it up
area = find_area("bootdir");
if (area < 0) {
dprintf("bootstrap_bootfs: no bootdir area found!\n");
return B_ENTRY_NOT_FOUND;
}
get_area_info(area, &areaInfo);
bootdir = (char *)areaInfo.address;
bootdir_len = areaInfo.size;
bootdir_region = areaInfo.area;
return B_OK;
}
case B_MODULE_UNINIT:
return B_OK;
default:
return B_ERROR;
}
}
static struct fs_ops bootfs_ops = {
file_system_info gBootFileSystem = {
{
"file_systems/bootfs" B_CURRENT_FS_API_VERSION,
0,
bootfs_std_ops,
},
&bootfs_mount,
&bootfs_unmount,
&bootfs_read_fs_info,
@@ -972,28 +1005,3 @@ static struct fs_ops bootfs_ops = {
// the other operations are not supported (attributes, indices, queries)
NULL,
};
status_t
bootstrap_bootfs(void)
{
area_id area;
area_info areaInfo;
TRACE(("bootstrap_bootfs: entry\n"));
// find the bootdir and set it up
area = find_area("bootdir");
if (area < 0)
panic("bootstrap_bootfs: no bootdir area found!\n");
get_area_info(area, &areaInfo);
bootdir = (char *)areaInfo.address;
bootdir_len = areaInfo.size;
bootdir_region = areaInfo.area;
TRACE(("bootstrap_bootfs: found bootdir at %p\n", bootdir));
return vfs_register_file_system("bootfs", &bootfs_ops);
}
+24 -12
View File
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <sys/stat.h>
#include "builtin_fs.h"
// ToDo: handles file names suboptimally - it has all file names
// in a singly linked list, no hash lookups or whatever.
@@ -1251,10 +1250,32 @@ pipefs_read_stat(fs_volume _volume, fs_vnode _node, struct stat *stat)
}
// #pragma mark -
static status_t
pipefs_std_ops(int32 op, ...)
{
switch (op) {
case B_MODULE_INIT:
return B_OK;
case B_MODULE_UNINIT:
return B_OK;
default:
return B_ERROR;
}
}
} // namespace pipefs
using namespace pipefs;
file_system_info gPipeFileSystem = {
{
"file_systems/pipefs" B_CURRENT_FS_API_VERSION,
0,
pipefs_std_ops,
},
static struct fs_ops pipefs_ops = {
&pipefs_mount,
&pipefs_unmount,
NULL,
@@ -1308,12 +1329,3 @@ static struct fs_ops pipefs_ops = {
NULL,
};
} // namespace pipefs
extern "C" status_t
bootstrap_pipefs(void)
{
TRACE(("bootstrap_pipefs: entry\n"));
return vfs_register_file_system("pipefs", &pipefs::pipefs_ops);
}
+22 -13
View File
@@ -20,8 +20,6 @@
#include <string.h>
#include <stdio.h>
#include "builtin_fs.h"
//#define TRACE_ROOTFS
#ifdef TRACE_ROOTFS
@@ -889,7 +887,7 @@ rootfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
static status_t
rootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
rootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, uint32 statMask)
{
#ifdef TRACE_ROOTFS
struct rootfs_vnode *v = _v;
@@ -901,10 +899,29 @@ rootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_
}
// #pragma mark -
static status_t
rootfs_std_ops(int32 op, ...)
{
switch (op) {
case B_MODULE_INIT:
return B_OK;
case B_MODULE_UNINIT:
return B_OK;
default:
return B_ERROR;
}
}
static struct fs_ops rootfs_ops = {
file_system_info gRootFileSystem = {
{
"file_systems/rootfs" B_CURRENT_FS_API_VERSION,
0,
rootfs_std_ops,
},
&rootfs_mount,
&rootfs_unmount,
NULL,
@@ -958,11 +975,3 @@ static struct fs_ops rootfs_ops = {
NULL,
};
status_t
bootstrap_rootfs(void)
{
TRACE(("bootstrap_rootfs: entry\n"));
return vfs_register_file_system("rootfs", &rootfs_ops);
}