Adapted the VFS and internal file systems with respect to changes made

in fs_interface.h.
Fixed many warnings due to the int/int32/status_t changes.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1137 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-09-23 23:24:12 +00:00
parent 88e54ccc26
commit e58fbc960b
6 changed files with 176 additions and 137 deletions

View File

@ -2,6 +2,7 @@
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
#include <stage2.h> #include <stage2.h>
#include <kernel.h> #include <kernel.h>
#include <console.h> #include <console.h>
@ -30,14 +31,18 @@ static unsigned int cpu_apic_version[SMP_MAX_CPUS] = { 0, 0};
static unsigned int *ioapic = NULL; static unsigned int *ioapic = NULL;
static unsigned int apic_timer_tics_per_sec = 0; static unsigned int apic_timer_tics_per_sec = 0;
static int i386_timer_interrupt(void* data)
static int32
i386_timer_interrupt(void *data)
{ {
arch_smp_ack_interrupt(); arch_smp_ack_interrupt();
return apic_timer_interrupt(); return apic_timer_interrupt();
} }
static int i386_ici_interrupt(void* data)
static int32
i386_ici_interrupt(void *data)
{ {
// gin-u-wine inter-cpu interrupt // gin-u-wine inter-cpu interrupt
// dprintf("inter-cpu interrupt on cpu %d\n", arch_smp_get_current_cpu()); // dprintf("inter-cpu interrupt on cpu %d\n", arch_smp_get_current_cpu());
@ -46,7 +51,9 @@ static int i386_ici_interrupt(void* data)
return smp_intercpu_int_handler(); return smp_intercpu_int_handler();
} }
static int i386_spurious_interrupt(void* data)
static int32
i386_spurious_interrupt(void *data)
{ {
// spurious interrupt // spurious interrupt
// dprintf("spurious interrupt on cpu %d\n", arch_smp_get_current_cpu()); // dprintf("spurious interrupt on cpu %d\n", arch_smp_get_current_cpu());
@ -54,7 +61,9 @@ static int i386_spurious_interrupt(void* data)
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
static int i386_smp_error_interrupt(void* data)
static int32
i386_smp_error_interrupt(void *data)
{ {
// smp error interrupt // smp error interrupt
// dprintf("smp error interrupt on cpu %d\n", arch_smp_get_current_cpu()); // dprintf("smp error interrupt on cpu %d\n", arch_smp_get_current_cpu());
@ -62,17 +71,23 @@ static int i386_smp_error_interrupt(void* data)
return B_HANDLED_INTERRUPT; return B_HANDLED_INTERRUPT;
} }
static unsigned int apic_read(unsigned int *addr)
static unsigned int
apic_read(unsigned int *addr)
{ {
return *addr; return *addr;
} }
static void apic_write(unsigned int *addr, unsigned int data)
static void
apic_write(unsigned int *addr, unsigned int data)
{ {
*addr = data; *addr = data;
} }
int arch_smp_init(kernel_args *ka)
int
arch_smp_init(kernel_args *ka)
{ {
dprintf("arch_smp_init: entry\n"); dprintf("arch_smp_init: entry\n");
@ -102,7 +117,9 @@ int arch_smp_init(kernel_args *ka)
return 0; return 0;
} }
void arch_smp_send_broadcast_ici(void)
void
arch_smp_send_broadcast_ici(void)
{ {
int config; int config;
int state = disable_interrupts(); int state = disable_interrupts();
@ -113,7 +130,9 @@ void arch_smp_send_broadcast_ici(void)
restore_interrupts(state); restore_interrupts(state);
} }
void arch_smp_send_ici(int target_cpu)
void
arch_smp_send_ici(int target_cpu)
{ {
int config; int config;
int state = disable_interrupts(); int state = disable_interrupts();
@ -127,23 +146,26 @@ void arch_smp_send_ici(int target_cpu)
restore_interrupts(state); restore_interrupts(state);
} }
void arch_smp_ack_interrupt(void)
void
arch_smp_ack_interrupt(void)
{ {
apic_write(APIC_EOI, 0); apic_write(APIC_EOI, 0);
} }
#define MIN_TIMEOUT 1000 #define MIN_TIMEOUT 1000
int arch_smp_set_apic_timer(bigtime_t relative_timeout) int
arch_smp_set_apic_timer(bigtime_t relative_timeout)
{ {
unsigned int config; unsigned int config;
int state; int state;
unsigned int ticks; unsigned int ticks;
if(apic == NULL) if (apic == NULL)
return -1; return -1;
if(relative_timeout < MIN_TIMEOUT) if (relative_timeout < MIN_TIMEOUT)
relative_timeout = MIN_TIMEOUT; relative_timeout = MIN_TIMEOUT;
// calculation should be ok, since it's going to be 64-bit // calculation should be ok, since it's going to be 64-bit
@ -166,12 +188,14 @@ int arch_smp_set_apic_timer(bigtime_t relative_timeout)
return 0; return 0;
} }
int arch_smp_clear_apic_timer(void)
int
arch_smp_clear_apic_timer(void)
{ {
unsigned int config; unsigned int config;
int state; int state;
if(apic == NULL) if (apic == NULL)
return -1; return -1;
state = disable_interrupts(); state = disable_interrupts();

View File

@ -387,7 +387,7 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
static status_t static status_t
bootfs_mount(fs_id id, const char *device, void *args, fs_cookie *_fs, vnode_id *root_vnid) bootfs_mount(fs_id id, const char *device, void *args, fs_volume *_fs, vnode_id *root_vnid)
{ {
struct bootfs *fs; struct bootfs *fs;
struct bootfs_vnode *v; struct bootfs_vnode *v;
@ -457,7 +457,7 @@ err:
static status_t static status_t
bootfs_unmount(fs_cookie _fs) bootfs_unmount(fs_volume _fs)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v; struct bootfs_vnode *v;
@ -481,7 +481,7 @@ bootfs_unmount(fs_cookie _fs)
static status_t static status_t
bootfs_sync(fs_cookie fs) bootfs_sync(fs_volume fs)
{ {
TRACE(("bootfs_sync: entry\n")); TRACE(("bootfs_sync: entry\n"));
@ -490,7 +490,7 @@ bootfs_sync(fs_cookie fs)
static status_t static status_t
bootfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) bootfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type)
{ {
struct bootfs *fs = (struct bootfs *)_fs; struct bootfs *fs = (struct bootfs *)_fs;
struct bootfs_vnode *dir = (struct bootfs_vnode *)_dir; struct bootfs_vnode *dir = (struct bootfs_vnode *)_dir;
@ -526,7 +526,7 @@ err:
static status_t static status_t
bootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) bootfs_get_vnode_name(fs_volume _fs, fs_vnode _vnode, char *buffer, size_t bufferSize)
{ {
struct bootfs_vnode *vnode = (struct bootfs_vnode *)_vnode; struct bootfs_vnode *vnode = (struct bootfs_vnode *)_vnode;
@ -538,7 +538,7 @@ bootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffe
static status_t static status_t
bootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *v, bool r) bootfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *v, bool r)
{ {
struct bootfs *fs = (struct bootfs *)_fs; struct bootfs *fs = (struct bootfs *)_fs;
@ -562,7 +562,7 @@ bootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *v, bool r)
static status_t static status_t
bootfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool r) bootfs_put_vnode(fs_volume _fs, fs_vnode _v, bool r)
{ {
struct bootfs_vnode *v = (struct bootfs_vnode *)_v; struct bootfs_vnode *v = (struct bootfs_vnode *)_v;
@ -573,7 +573,7 @@ bootfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool r)
static status_t static status_t
bootfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) bootfs_remove_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
{ {
struct bootfs *fs = (struct bootfs *)_fs; struct bootfs *fs = (struct bootfs *)_fs;
struct bootfs_vnode *v = (struct bootfs_vnode *)_v; struct bootfs_vnode *v = (struct bootfs_vnode *)_v;
@ -603,14 +603,14 @@ err:
static status_t static status_t
bootfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid) bootfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int omode, int perms, fs_cookie *_cookie, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) bootfs_open(fs_volume _fs, fs_vnode _v, int oflags, fs_cookie *_cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *vnode = _v; struct bootfs_vnode *vnode = _v;
@ -635,7 +635,7 @@ bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie)
static status_t static status_t
bootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) bootfs_close(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -648,7 +648,7 @@ bootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
bootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) bootfs_free_cookie(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -664,14 +664,14 @@ bootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
bootfs_fsync(fs_cookie _fs, fs_vnode _v) bootfs_fsync(fs_volume _fs, fs_vnode _v)
{ {
return 0; return 0;
} }
static ssize_t static ssize_t
bootfs_read(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, void *buf, size_t *len) bootfs_read(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, void *buf, size_t *len)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -720,7 +720,7 @@ err:
static ssize_t static ssize_t
bootfs_write(fs_cookie fs, fs_vnode v, file_cookie cookie, off_t pos, const void *buf, size_t *len) bootfs_write(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *buf, size_t *len)
{ {
TRACE(("bootfs_write: vnode %p, cookie %p, pos 0x%Lx , len 0x%lx\n", v, cookie, pos, *len)); TRACE(("bootfs_write: vnode %p, cookie %p, pos 0x%Lx , len 0x%lx\n", v, cookie, pos, *len));
@ -729,7 +729,7 @@ bootfs_write(fs_cookie fs, fs_vnode v, file_cookie cookie, off_t pos, const void
static off_t static off_t
bootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seekType) bootfs_seek(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, int seekType)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -783,14 +783,14 @@ bootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seek
static status_t static status_t
bootfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) bootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) bootfs_open_dir(fs_volume _fs, fs_vnode _v, fs_cookie *_cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *vnode = _v; struct bootfs_vnode *vnode = _v;
@ -819,13 +819,13 @@ bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
static status_t static status_t
bootfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) bootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num)
{ {
struct bootfs_cookie *cookie = _cookie; struct bootfs_cookie *cookie = _cookie;
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
status_t status; status_t status;
TRACE(("bootfs_read_dir(fs_cookie = %p vnode = %p, file_cookie = %p, buffer = %p, bufferSize = %ld, num = %d)\n",_fs, _vnode, cookie, dirent, bufferSize, *_num)); TRACE(("bootfs_read_dir(fs_volume = %p vnode = %p, fs_cookie = %p, buffer = %p, bufferSize = %ld, num = %ld)\n",_fs, _vnode, cookie, dirent, bufferSize, *_num));
mutex_lock(&fs->lock); mutex_lock(&fs->lock);
@ -857,7 +857,7 @@ err:
static status_t static status_t
bootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) bootfs_rewind_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *vnode = _vnode; struct bootfs_vnode *vnode = _vnode;
@ -873,15 +873,15 @@ bootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
static status_t static status_t
bootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf, size_t len) bootfs_ioctl(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, ulong op, void *buf, size_t len)
{ {
TRACE(("bootfs_ioctl: fs_cookie %p vnode %p, file_cookie %p, op %lu, buf %p, len %ld\n", _fs, _v, _cookie, op, buf, len)); TRACE(("bootfs_ioctl: fs_volume %p vnode %p, fs_cookie %p, op %lu, buf %p, len %ld\n", _fs, _v, _cookie, op, buf, len));
return EINVAL; return EINVAL;
} }
static status_t static status_t
bootfs_can_page(fs_cookie _fs, fs_vnode _v) bootfs_can_page(fs_volume _fs, fs_vnode _v)
{ {
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -895,7 +895,7 @@ bootfs_can_page(fs_cookie _fs, fs_vnode _v)
static ssize_t static ssize_t
bootfs_read_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) bootfs_read_page(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -926,7 +926,7 @@ bootfs_read_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos)
static ssize_t static ssize_t
bootfs_write_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) bootfs_write_page(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -938,21 +938,21 @@ bootfs_write_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos)
static status_t static status_t
bootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) bootfs_unlink(fs_volume _fs, fs_vnode _dir, const char *name)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
bootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) bootfs_rename(fs_volume _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
bootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) bootfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -991,7 +991,7 @@ err:
static status_t static status_t
bootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) bootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
@ -1056,6 +1056,9 @@ static struct fs_calls bootfs_calls = {
&bootfs_free_cookie, // and files here - that's intended, not by accident &bootfs_free_cookie, // and files here - that's intended, not by accident
&bootfs_read_dir, &bootfs_read_dir,
&bootfs_rewind_dir, &bootfs_rewind_dir,
// the other operations are not supported (attributes, indices, queries)
NULL,
}; };

View File

@ -347,7 +347,7 @@ devfs_set_partition( struct devfs *fs, struct devfs_vnode *v,
part_map->session = info.session; part_map->session = info.session;
part_map->partition = info.partition; part_map->partition = info.partition;
sprintf(part_name, "%i_%i", info.session, info.partition); sprintf(part_name, "%li_%li", info.session, info.partition);
mutex_lock(&gDeviceFileSystem->lock); mutex_lock(&gDeviceFileSystem->lock);
@ -406,7 +406,7 @@ err2:
static status_t static status_t
devfs_mount(fs_id id, const char *devfs, void *args, fs_cookie *_fs, vnode_id *root_vnid) devfs_mount(fs_id id, const char *devfs, void *args, fs_volume *_fs, vnode_id *root_vnid)
{ {
struct devfs *fs; struct devfs *fs;
struct devfs_vnode *v; struct devfs_vnode *v;
@ -479,7 +479,7 @@ err:
static status_t static status_t
devfs_unmount(fs_cookie _fs) devfs_unmount(fs_volume _fs)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *v; struct devfs_vnode *v;
@ -503,7 +503,7 @@ devfs_unmount(fs_cookie _fs)
static status_t static status_t
devfs_sync(fs_cookie fs) devfs_sync(fs_volume fs)
{ {
TRACE(("devfs_sync: entry\n")); TRACE(("devfs_sync: entry\n"));
@ -512,7 +512,7 @@ devfs_sync(fs_cookie fs)
static status_t static status_t
devfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) devfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
struct devfs_vnode *dir = (struct devfs_vnode *)_dir; struct devfs_vnode *dir = (struct devfs_vnode *)_dir;
@ -548,7 +548,7 @@ err:
static status_t static status_t
devfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) devfs_get_vnode_name(fs_volume _fs, fs_vnode _vnode, char *buffer, size_t bufferSize)
{ {
struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode; struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode;
@ -560,7 +560,7 @@ devfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffer
static status_t static status_t
devfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) devfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
@ -584,7 +584,7 @@ devfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
static status_t static status_t
devfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) devfs_put_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
{ {
#if DEVFS_TRACE #if DEVFS_TRACE
struct devfs_vnode *vnode = (struct devfs_vnode *)_v; struct devfs_vnode *vnode = (struct devfs_vnode *)_v;
@ -597,7 +597,7 @@ devfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool reenter)
static status_t static status_t
devfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) devfs_remove_vnode(fs_volume _fs, fs_vnode _v, bool reenter)
{ {
struct devfs *fs = (struct devfs *)_fs; struct devfs *fs = (struct devfs *)_fs;
struct devfs_vnode *vnode = (struct devfs_vnode *)_v; struct devfs_vnode *vnode = (struct devfs_vnode *)_v;
@ -622,21 +622,21 @@ devfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter)
static status_t static status_t
devfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid) devfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int omode, int perms, fs_cookie *_cookie, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) devfs_open(fs_volume _fs, fs_vnode _v, int oflags, fs_cookie *_cookie)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
struct devfs_cookie *cookie; struct devfs_cookie *cookie;
status_t status = 0; status_t status = 0;
TRACE(("devfs_open: fs_cookie %p vnode %p, oflags 0x%x, file_cookie %p \n", fs, vnode, oflags, _cookie)); TRACE(("devfs_open: fs_cookie %p vnode %p, oflags 0x%x, fs_cookie %p \n", fs, vnode, oflags, _cookie));
cookie = kmalloc(sizeof(struct devfs_cookie)); cookie = kmalloc(sizeof(struct devfs_cookie));
if (cookie == NULL) if (cookie == NULL)
@ -653,7 +653,7 @@ devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie)
static status_t static status_t
devfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) devfs_close(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
struct devfs_cookie *cookie = _cookie; struct devfs_cookie *cookie = _cookie;
@ -670,7 +670,7 @@ devfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
devfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) devfs_free_cookie(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
struct devfs_cookie *cookie = _cookie; struct devfs_cookie *cookie = _cookie;
@ -690,14 +690,14 @@ devfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
devfs_fsync(fs_cookie _fs, fs_vnode _v) devfs_fsync(fs_volume _fs, fs_vnode _v)
{ {
return 0; return 0;
} }
static ssize_t static ssize_t
devfs_read(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, void *buffer, size_t *length) devfs_read(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, void *buffer, size_t *length)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
@ -730,7 +730,7 @@ devfs_read(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, void *buf
static ssize_t static ssize_t
devfs_write(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, const void *buf, size_t *len) devfs_write(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, const void *buf, size_t *len)
{ {
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
struct devfs_cookie *cookie = _cookie; struct devfs_cookie *cookie = _cookie;
@ -760,7 +760,7 @@ devfs_write(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, const vo
static off_t static off_t
devfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seekType) devfs_seek(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, int seekType)
{ {
#ifdef DEBUG #ifdef DEBUG
struct devfs *fs = _fs; struct devfs *fs = _fs;
@ -775,14 +775,14 @@ devfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seekT
static status_t static status_t
devfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) devfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) devfs_open_dir(fs_volume _fs, fs_vnode _v, fs_cookie *_cookie)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
@ -809,7 +809,7 @@ devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
static status_t static status_t
devfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) devfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num)
{ {
struct devfs_cookie *cookie = _cookie; struct devfs_cookie *cookie = _cookie;
struct devfs *fs = _fs; struct devfs *fs = _fs;
@ -851,7 +851,7 @@ err:
static status_t static status_t
devfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) devfs_rewind_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_cookie *cookie = _cookie; struct devfs_cookie *cookie = _cookie;
@ -871,7 +871,7 @@ devfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
static status_t static status_t
devfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf, size_t len) devfs_ioctl(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, ulong op, void *buf, size_t len)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *v = _v; struct devfs_vnode *v = _v;
@ -895,7 +895,7 @@ devfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf
/* /*
static int devfs_canpage(fs_cookie _fs, fs_vnode _v) static int devfs_canpage(fs_volume _fs, fs_vnode _v)
{ {
struct devfs_vnode *v = _v; struct devfs_vnode *v = _v;
@ -910,7 +910,7 @@ static int devfs_canpage(fs_cookie _fs, fs_vnode _v)
} }
} }
static ssize_t devfs_readpage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) static ssize_t devfs_readpage(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct devfs_vnode *v = _v; struct devfs_vnode *v = _v;
@ -940,7 +940,7 @@ static ssize_t devfs_readpage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t po
} }
} }
static ssize_t devfs_writepage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) static ssize_t devfs_writepage(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
struct devfs_vnode *v = _v; struct devfs_vnode *v = _v;
@ -972,7 +972,7 @@ static ssize_t devfs_writepage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t p
*/ */
static status_t static status_t
devfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) devfs_unlink(fs_volume _fs, fs_vnode _dir, const char *name)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
struct devfs_vnode *dir = _dir; struct devfs_vnode *dir = _dir;
@ -1007,14 +1007,14 @@ err:
static status_t static status_t
devfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) devfs_rename(fs_volume _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{ {
return EROFS; return EROFS;
} }
static status_t static status_t
devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) devfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
{ {
struct devfs_vnode *vnode = _v; struct devfs_vnode *vnode = _v;
@ -1030,7 +1030,7 @@ devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat)
static status_t static status_t
devfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) devfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
#if DEVFS_TRACE #if DEVFS_TRACE
struct devfs_vnode *v = _v; struct devfs_vnode *v = _v;
@ -1095,6 +1095,9 @@ static struct fs_calls devfs_calls = {
&devfs_free_cookie, // and files here - that's intended, not by accident &devfs_free_cookie, // and files here - that's intended, not by accident
&devfs_read_dir, &devfs_read_dir,
&devfs_rewind_dir, &devfs_rewind_dir,
// the other operations are not supported (attributes, indices, queries)
NULL,
}; };

View File

@ -145,23 +145,26 @@ insert_cookie_in_jar(struct rootfs_vnode *dir, struct rootfs_cookie *cookie)
static void static void
remove_cookie_from_jar(struct rootfs_vnode *dir, struct rootfs_cookie *cookie) remove_cookie_from_jar(struct rootfs_vnode *dir, struct rootfs_cookie *cookie)
{ {
if(cookie->next) if (cookie->next)
cookie->next->prev = cookie->prev; cookie->next->prev = cookie->prev;
if(cookie->prev) if (cookie->prev)
cookie->prev->next = cookie->next; cookie->prev->next = cookie->next;
if(dir->stream.dir.jar_head == cookie) if (dir->stream.dir.jar_head == cookie)
dir->stream.dir.jar_head = cookie->next; dir->stream.dir.jar_head = cookie->next;
cookie->prev = cookie->next = NULL; cookie->prev = cookie->next = NULL;
} }
/* makes sure none of the dircookies point to the vnode passed in */ /* makes sure none of the dircookies point to the vnode passed in */
static void update_dircookies(struct rootfs_vnode *dir, struct rootfs_vnode *v)
static void
update_dircookies(struct rootfs_vnode *dir, struct rootfs_vnode *v)
{ {
struct rootfs_cookie *cookie; struct rootfs_cookie *cookie;
for (cookie = dir->stream.dir.jar_head; cookie; cookie = cookie->next) { for (cookie = dir->stream.dir.jar_head; cookie; cookie = cookie->next) {
if(cookie->ptr == v) if (cookie->ptr == v)
cookie->ptr = v->dir_next; cookie->ptr = v->dir_next;
} }
} }
@ -261,7 +264,7 @@ err:
static status_t static status_t
rootfs_mount(fs_id id, const char *device, void *args, fs_cookie *_fs, vnode_id *root_vnid) rootfs_mount(fs_id id, const char *device, void *args, fs_volume *_fs, vnode_id *root_vnid)
{ {
struct rootfs *fs; struct rootfs *fs;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
@ -326,7 +329,7 @@ err1:
static status_t static status_t
rootfs_unmount(fs_cookie _fs) rootfs_unmount(fs_volume _fs)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *v; struct rootfs_vnode *v;
@ -353,7 +356,7 @@ rootfs_unmount(fs_cookie _fs)
static status_t static status_t
rootfs_sync(fs_cookie fs) rootfs_sync(fs_volume fs)
{ {
TRACE(("rootfs_sync: entry\n")); TRACE(("rootfs_sync: entry\n"));
@ -362,7 +365,7 @@ rootfs_sync(fs_cookie fs)
static status_t static status_t
rootfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) rootfs_lookup(fs_volume _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir; struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir;
@ -398,7 +401,7 @@ err:
static status_t static status_t
rootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) rootfs_get_vnode_name(fs_volume _fs, fs_vnode _vnode, char *buffer, size_t bufferSize)
{ {
struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode; struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode;
@ -410,7 +413,7 @@ rootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffe
static status_t static status_t
rootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) rootfs_get_vnode(fs_volume _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
@ -434,7 +437,7 @@ rootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
static status_t static status_t
rootfs_put_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) rootfs_put_vnode(fs_volume _fs, fs_vnode _vnode, bool reenter)
{ {
#if ROOTFS_TRACE #if ROOTFS_TRACE
struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode; struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode;
@ -446,7 +449,7 @@ rootfs_put_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter)
static status_t static status_t
rootfs_remove_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) rootfs_remove_vnode(fs_volume _fs, fs_vnode _vnode, bool reenter)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode; struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode;
@ -471,14 +474,14 @@ rootfs_remove_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter)
static status_t static status_t
rootfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid) rootfs_create(fs_volume _fs, fs_vnode _dir, const char *name, int omode, int perms, fs_cookie *_cookie, vnode_id *new_vnid)
{ {
return EINVAL; return EINVAL;
} }
static status_t static status_t
rootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) rootfs_open(fs_volume _fs, fs_vnode _v, int oflags, fs_cookie *_cookie)
{ {
// allow to open the file, but it can't be done anything with it // allow to open the file, but it can't be done anything with it
@ -490,7 +493,7 @@ rootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie)
static status_t static status_t
rootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) rootfs_close(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
#if ROOTFS_TRACE #if ROOTFS_TRACE
struct rootfs_vnode *v = _v; struct rootfs_vnode *v = _v;
@ -503,7 +506,7 @@ rootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
rootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) rootfs_free_cookie(fs_volume _fs, fs_vnode _v, fs_cookie _cookie)
{ {
struct rootfs_cookie *cookie = _cookie; struct rootfs_cookie *cookie = _cookie;
#if ROOTFS_TRACE #if ROOTFS_TRACE
@ -519,21 +522,21 @@ rootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
static status_t static status_t
rootfs_fsync(fs_cookie _fs, fs_vnode _v) rootfs_fsync(fs_volume _fs, fs_vnode _v)
{ {
return 0; return 0;
} }
static ssize_t static ssize_t
rootfs_read(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, void *buf, size_t *len) rootfs_read(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, void *buf, size_t *len)
{ {
return EINVAL; return EINVAL;
} }
static ssize_t static ssize_t
rootfs_write(fs_cookie fs, fs_vnode v, file_cookie cookie, off_t pos, const void *buf, size_t *len) rootfs_write(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *buf, size_t *len)
{ {
TRACE(("rootfs_write: vnode %p, cookie %p, pos 0x%Lx , len 0x%lx\n", v, cookie, pos, *len)); TRACE(("rootfs_write: vnode %p, cookie %p, pos 0x%Lx , len 0x%lx\n", v, cookie, pos, *len));
@ -542,14 +545,14 @@ rootfs_write(fs_cookie fs, fs_vnode v, file_cookie cookie, off_t pos, const void
static off_t static off_t
rootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int st) rootfs_seek(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, off_t pos, int st)
{ {
return ESPIPE; return ESPIPE;
} }
static status_t static status_t
rootfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) rootfs_create_dir(fs_volume _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *dir = _dir; struct rootfs_vnode *dir = _dir;
@ -602,7 +605,7 @@ err:
static status_t static status_t
rootfs_remove_dir(fs_cookie _fs, fs_vnode _dir, const char *name) rootfs_remove_dir(fs_volume _fs, fs_vnode _dir, const char *name)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *dir = _dir; struct rootfs_vnode *dir = _dir;
@ -614,7 +617,7 @@ rootfs_remove_dir(fs_cookie _fs, fs_vnode _dir, const char *name)
static status_t static status_t
rootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) rootfs_open_dir(fs_volume _fs, fs_vnode _v, fs_cookie *_cookie)
{ {
struct rootfs *fs = (struct rootfs *)_fs; struct rootfs *fs = (struct rootfs *)_fs;
struct rootfs_vnode *vnode = (struct rootfs_vnode *)_v; struct rootfs_vnode *vnode = (struct rootfs_vnode *)_v;
@ -644,7 +647,7 @@ rootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
static status_t static status_t
rootfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) rootfs_read_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num)
{ {
struct rootfs_cookie *cookie = _cookie; struct rootfs_cookie *cookie = _cookie;
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
@ -684,7 +687,7 @@ err:
static status_t static status_t
rootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) rootfs_rewind_dir(fs_volume _fs, fs_vnode _vnode, fs_cookie _cookie)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *vnode = _vnode; struct rootfs_vnode *vnode = _vnode;
@ -700,7 +703,7 @@ rootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
static status_t static status_t
rootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf, size_t len) rootfs_ioctl(fs_volume _fs, fs_vnode _v, fs_cookie _cookie, ulong op, void *buf, size_t len)
{ {
TRACE(("rootfs_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n", _v, _cookie, op, buf, len)); TRACE(("rootfs_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n", _v, _cookie, op, buf, len));
@ -709,28 +712,28 @@ rootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *bu
static status_t static status_t
rootfs_can_page(fs_cookie _fs, fs_vnode _v) rootfs_can_page(fs_volume _fs, fs_vnode _v)
{ {
return -1; return -1;
} }
static ssize_t static ssize_t
rootfs_read_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) rootfs_read_page(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
return EPERM; return EPERM;
} }
static ssize_t static ssize_t
rootfs_write_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) rootfs_write_page(fs_volume _fs, fs_vnode _v, iovecs *vecs, off_t pos)
{ {
return EPERM; return EPERM;
} }
static status_t static status_t
rootfs_read_link(fs_cookie _fs, fs_vnode _link, char *buffer, size_t bufferSize) rootfs_read_link(fs_volume _fs, fs_vnode _link, char *buffer, size_t bufferSize)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *link = _link; struct rootfs_vnode *link = _link;
@ -747,7 +750,7 @@ rootfs_read_link(fs_cookie _fs, fs_vnode _link, char *buffer, size_t bufferSize)
static status_t static status_t
rootfs_symlink(fs_cookie _fs, fs_vnode _dir, const char *name, const char *path, int mode) rootfs_symlink(fs_volume _fs, fs_vnode _dir, const char *name, const char *path, int mode)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *dir = _dir; struct rootfs_vnode *dir = _dir;
@ -803,7 +806,7 @@ err:
static status_t static status_t
rootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) rootfs_unlink(fs_volume _fs, fs_vnode _dir, const char *name)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *dir = _dir; struct rootfs_vnode *dir = _dir;
@ -815,7 +818,7 @@ rootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name)
static status_t static status_t
rootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) rootfs_rename(fs_volume _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{ {
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
struct rootfs_vnode *olddir = _olddir; struct rootfs_vnode *olddir = _olddir;
@ -887,7 +890,7 @@ err:
static status_t static status_t
rootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) rootfs_read_stat(fs_volume _fs, fs_vnode _v, struct stat *stat)
{ {
struct rootfs_vnode *vnode = _v; struct rootfs_vnode *vnode = _v;
@ -903,7 +906,7 @@ rootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat)
static status_t static status_t
rootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) rootfs_write_stat(fs_volume _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
#if ROOTFS_TRACE #if ROOTFS_TRACE
struct rootfs *fs = _fs; struct rootfs *fs = _fs;
@ -969,6 +972,9 @@ static struct fs_calls rootfs_calls = {
&rootfs_free_cookie, // and files here - that's intended, not by accident &rootfs_free_cookie, // and files here - that's intended, not by accident
&rootfs_read_dir, &rootfs_read_dir,
&rootfs_rewind_dir, &rootfs_rewind_dir,
// the other operations are not supported (attributes, indices, queries)
NULL,
}; };

View File

@ -314,7 +314,7 @@ dec_vnode_ref_count(struct vnode *vnode, bool reenter)
old_ref = atomic_add(&vnode->ref_count, -1); old_ref = atomic_add(&vnode->ref_count, -1);
PRINT(("dec_vnode_ref_count: vnode 0x%p, ref now %d\n", vnode, vnode->ref_count)); PRINT(("dec_vnode_ref_count: vnode %p, ref now %ld\n", vnode, vnode->ref_count));
if (old_ref == 1) { if (old_ref == 1) {
vnode->busy = true; vnode->busy = true;
@ -351,7 +351,7 @@ static int
inc_vnode_ref_count(struct vnode *vnode) inc_vnode_ref_count(struct vnode *vnode)
{ {
atomic_add(&vnode->ref_count, 1); atomic_add(&vnode->ref_count, 1);
PRINT(("inc_vnode_ref_count: vnode 0x%p, ref now %d\n", vnode, vnode->ref_count)); PRINT(("inc_vnode_ref_count: vnode %p, ref now %ld\n", vnode, vnode->ref_count));
return 0; return 0;
} }
@ -374,7 +374,7 @@ get_vnode(fs_id fsID, vnode_id vnodeID, struct vnode **_vnode, int reenter)
struct vnode *vnode; struct vnode *vnode;
int err; int err;
FUNCTION(("get_vnode: fsid %d vnid 0x%Lx 0x%p\n", fsID, vnodeID,_vnode)); FUNCTION(("get_vnode: fsid %ld vnid 0x%Lx %p\n", fsID, vnodeID, _vnode));
mutex_lock(&gVnodeMutex); mutex_lock(&gVnodeMutex);
@ -555,7 +555,7 @@ entry_ref_to_vnode(fs_id fsID,vnode_id directoryID,const char *name,struct vnode
if (vnode == NULL) { if (vnode == NULL) {
// fs_lookup() should have left the vnode referenced, so chances // fs_lookup() should have left the vnode referenced, so chances
// are good that this will never happen // are good that this will never happen
panic("entry_ref_to_vnode: could not lookup vnode (fsid 0x%x vnid 0x%Lx)\n", fsID, id); panic("entry_ref_to_vnode: could not lookup vnode (fsid 0x%lx vnid 0x%Lx)\n", fsID, id);
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
@ -622,7 +622,7 @@ vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, stru
if (!nextVnode) { if (!nextVnode) {
// pretty screwed up here // pretty screwed up here
panic("path_to_vnode: could not lookup vnode (fsid 0x%x vnid 0x%Lx)\n", vnode->fs_id, vnodeID); panic("path_to_vnode: could not lookup vnode (fsid 0x%lx vnid 0x%Lx)\n", vnode->fs_id, vnodeID);
put_vnode(vnode); put_vnode(vnode);
return ERR_VFS_PATH_NOT_FOUND; return ERR_VFS_PATH_NOT_FOUND;
} }
@ -809,7 +809,7 @@ dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize)
mutex_unlock(&gVnodeMutex); mutex_unlock(&gVnodeMutex);
if (parentVnode == NULL) { if (parentVnode == NULL) {
panic("dir_vnode_to_path: could not lookup vnode (fsid 0x%x vnid 0x%Lx)\n", vnode->fs_id, parentID); panic("dir_vnode_to_path: could not lookup vnode (fsid 0x%lx vnid 0x%Lx)\n", vnode->fs_id, parentID);
status = B_ENTRY_NOT_FOUND; status = B_ENTRY_NOT_FOUND;
goto out; goto out;
} }
@ -845,12 +845,12 @@ dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize)
break; break;
} }
if (!FS_CALL(vnode,fs_get_vnode_name)) { if (!FS_CALL(vnode, fs_get_vnode_name)) {
// If we don't got the vnode's name yet, we have to search for it // If we don't got the vnode's name yet, we have to search for it
// in the parent directory now // in the parent directory now
file_cookie cookie; fs_cookie cookie;
status = FS_CALL(vnode,fs_open_dir)(vnode->mount->cookie,vnode->private_node,&cookie); status = FS_CALL(vnode, fs_open_dir)(vnode->mount->cookie, vnode->private_node, &cookie);
if (status >= B_OK) { if (status >= B_OK) {
struct dirent *dirent = (struct dirent *)nameBuffer; struct dirent *dirent = (struct dirent *)nameBuffer;
while (true) { while (true) {
@ -1574,7 +1574,7 @@ vfs_init(kernel_args *ka)
static int static int
new_file_fd(struct vnode *vnode, file_cookie cookie, int openMode, bool kernel) new_file_fd(struct vnode *vnode, fs_cookie cookie, int openMode, bool kernel)
{ {
struct file_descriptor *descriptor; struct file_descriptor *descriptor;
int fd; int fd;
@ -1605,7 +1605,7 @@ static int
create_vnode(struct vnode *directory, const char *name, int omode, int perms, bool kernel) create_vnode(struct vnode *directory, const char *name, int omode, int perms, bool kernel)
{ {
struct vnode *vnode; struct vnode *vnode;
file_cookie cookie; fs_cookie cookie;
vnode_id newID; vnode_id newID;
int status; int status;
@ -1645,7 +1645,7 @@ create_vnode(struct vnode *directory, const char *name, int omode, int perms, bo
static int static int
open_vnode(struct vnode *vnode, int omode, bool kernel) open_vnode(struct vnode *vnode, int omode, bool kernel)
{ {
file_cookie cookie; fs_cookie cookie;
int status; int status;
status = FS_CALL(vnode,fs_open)(vnode->mount->cookie, vnode->private_node, omode, &cookie); status = FS_CALL(vnode,fs_open)(vnode->mount->cookie, vnode->private_node, omode, &cookie);
@ -1669,7 +1669,7 @@ static int
open_dir_vnode(struct vnode *vnode, bool kernel) open_dir_vnode(struct vnode *vnode, bool kernel)
{ {
struct file_descriptor *descriptor; struct file_descriptor *descriptor;
file_cookie cookie; fs_cookie cookie;
int status, fd; int status, fd;
status = FS_CALL(vnode,fs_open_dir)(vnode->mount->cookie, vnode->private_node, &cookie); status = FS_CALL(vnode,fs_open_dir)(vnode->mount->cookie, vnode->private_node, &cookie);
@ -1728,7 +1728,7 @@ file_create(char *path, int omode, int perms, bool kernel)
{ {
char filename[SYS_MAX_NAME_LEN]; char filename[SYS_MAX_NAME_LEN];
struct vnode *directory,*vnode; struct vnode *directory,*vnode;
file_cookie cookie; fs_cookie cookie;
vnode_id newID; vnode_id newID;
int status; int status;
@ -1841,7 +1841,7 @@ dir_create_entry_ref(fs_id fsID, vnode_id parentID, const char *name, int perms,
vnode_id newID; vnode_id newID;
int status; int status;
FUNCTION(("dir_create_entry_ref(dev = %d, ino = %Ld, name = '%s', perms = %d)\n", fsID, parentID, name, perms)); FUNCTION(("dir_create_entry_ref(dev = %ld, ino = %Ld, name = '%s', perms = %d)\n", fsID, parentID, name, perms));
status = get_vnode(fsID, parentID, &vnode, kernel); status = get_vnode(fsID, parentID, &vnode, kernel);
if (status < B_OK) if (status < B_OK)

View File

@ -56,10 +56,11 @@ static void _dump_team_info(struct team *p);
static int dump_team_info(int argc, char **argv); static int dump_team_info(int argc, char **argv);
static void _dump_team_info(struct team *p) static void
_dump_team_info(struct team *p)
{ {
dprintf("TEAM: %p\n", p); dprintf("TEAM: %p\n", p);
dprintf("id: 0x%x\n", p->id); dprintf("id: 0x%lx\n", p->id);
dprintf("name: '%s'\n", p->name); dprintf("name: '%s'\n", p->name);
dprintf("next: %p\n", p->next); dprintf("next: %p\n", p->next);
dprintf("num_threads: %d\n", p->num_threads); dprintf("num_threads: %d\n", p->num_threads);
@ -67,29 +68,31 @@ static void _dump_team_info(struct team *p)
dprintf("pending_signals: 0x%x\n", p->pending_signals); dprintf("pending_signals: 0x%x\n", p->pending_signals);
dprintf("ioctx: %p\n", p->ioctx); dprintf("ioctx: %p\n", p->ioctx);
dprintf("path: '%s'\n", p->path); dprintf("path: '%s'\n", p->path);
dprintf("aspace_id: 0x%x\n", p->_aspace_id); dprintf("aspace_id: 0x%lx\n", p->_aspace_id);
dprintf("aspace: %p\n", p->aspace); dprintf("aspace: %p\n", p->aspace);
dprintf("kaspace: %p\n", p->kaspace); dprintf("kaspace: %p\n", p->kaspace);
dprintf("main_thread: %p\n", p->main_thread); dprintf("main_thread: %p\n", p->main_thread);
dprintf("thread_list: %p\n", p->thread_list); dprintf("thread_list: %p\n", p->thread_list);
} }
static int dump_team_info(int argc, char **argv)
static int
dump_team_info(int argc, char **argv)
{ {
struct team *p; struct team *p;
int id = -1; int id = -1;
unsigned long num; unsigned long num;
struct hash_iterator i; struct hash_iterator i;
if(argc < 2) { if (argc < 2) {
dprintf("team: not enough arguments\n"); dprintf("team: not enough arguments\n");
return 0; return 0;
} }
// if the argument looks like a hex number, treat it as such // if the argument looks like a hex number, treat it as such
if(strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x') { if (strlen(argv[1]) > 2 && argv[1][0] == '0' && argv[1][1] == 'x') {
num = atoul(argv[1]); num = atoul(argv[1]);
if(num > vm_get_kernel_aspace()->virtual_map.base) { if (num > vm_get_kernel_aspace()->virtual_map.base) {
// XXX semi-hack // XXX semi-hack
_dump_team_info((struct team*)num); _dump_team_info((struct team*)num);
return 0; return 0;
@ -100,8 +103,8 @@ static int dump_team_info(int argc, char **argv)
// walk through the thread list, trying to match name or id // walk through the thread list, trying to match name or id
hash_open(team_hash, &i); hash_open(team_hash, &i);
while((p = hash_next(team_hash, &i)) != NULL) { while ((p = hash_next(team_hash, &i)) != NULL) {
if((p->name && strcmp(argv[1], p->name) == 0) || p->id == id) { if ((p->name && strcmp(argv[1], p->name) == 0) || p->id == id) {
_dump_team_info(p); _dump_team_info(p);
break; break;
} }
@ -431,7 +434,7 @@ team_create_team2(void *args)
t = thread_get_current_thread(); t = thread_get_current_thread();
p = t->team; p = t->team;
dprintf("team_create_team2: entry thread %d\n", t->id); dprintf("team_create_team2: entry thread %ld\n", t->id);
// create an initial primary stack region // create an initial primary stack region
@ -440,7 +443,7 @@ team_create_team2(void *args)
sprintf(ustack_name, "%s_primary_stack", p->name); sprintf(ustack_name, "%s_primary_stack", p->name);
t->user_stack_region_id = vm_create_anonymous_region(p->_aspace_id, ustack_name, (void **)&t->user_stack_base, t->user_stack_region_id = vm_create_anonymous_region(p->_aspace_id, ustack_name, (void **)&t->user_stack_base,
REGION_ADDR_EXACT_ADDRESS, tot_top_size, REGION_WIRING_LAZY, LOCK_RW); REGION_ADDR_EXACT_ADDRESS, tot_top_size, REGION_WIRING_LAZY, LOCK_RW);
if(t->user_stack_region_id < 0) { if (t->user_stack_region_id < 0) {
panic("team_create_team2: could not create default user stack region\n"); panic("team_create_team2: could not create default user stack region\n");
return t->user_stack_region_id; return t->user_stack_region_id;
} }