Include kerrors.h where it's required.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@105 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
David Reid 2002-07-11 22:21:56 +00:00
parent f6327bfa2e
commit d2de8b3867
24 changed files with 52 additions and 38 deletions

View File

@ -7,6 +7,7 @@
#include <string.h>
#include <stdio.h>
#include <Errors.h>
#include <kerrors.h>
#include <elf32.h>
#include <user_runtime.h>
#include <syscalls.h>

View File

@ -9,6 +9,7 @@
#include <debug.h>
#include <smp.h>
#include <Errors.h>
#include <kerrors.h>
#include <stage2.h>

View File

@ -11,6 +11,7 @@
#include <smp.h>
#include <syscalls.h>
#include <Errors.h>
#include <kerrors.h>
#include <vm_priv.h>
#include <ksyscalls.h>

View File

@ -9,6 +9,7 @@
#include <vm_priv.h>
#include <debug.h>
#include <Errors.h>
#include <kerrors.h>
#include <arch/vm.h>
#include <arch/int.h>

View File

@ -16,6 +16,7 @@
#include <string.h>
#include <stage2.h>
#include <Errors.h>
#include <kerrors.h>
#include <arch/cpu.h>
#include <arch/vm_translation_map.h>

View File

@ -9,6 +9,7 @@
#include <arch/debug.h>
#include <cbuf.h>
#include <arch/cpu.h>
#include <kerrors.h>
#include <Errors.h>
#include <debug.h>
#include <int.h>

View File

@ -7,6 +7,7 @@
#include <kernel.h>
#include <Errors.h>
#include <kerrors.h>
#include <elf.h>
#include <vfs.h>
#include <vm.h>

View File

@ -61,7 +61,7 @@ new_fd(struct io_context *ioctx, struct file_descriptor *f)
}
}
if (fd < 0) {
fd = ERR_NO_MORE_HANDLES;
fd = EMFILE;
goto err;
}

View File

@ -11,6 +11,7 @@
#include <lock.h>
#include <vm.h>
#include <Errors.h>
#include <kerrors.h>
#include <arch/cpu.h>
#include <sys/stat.h>
@ -138,7 +139,7 @@ bootfs_delete_vnode(struct bootfs *fs, struct bootfs_vnode *v, bool force_delete
// cant delete it if it's in a directory or is a directory
// and has children
if(!force_delete && ((v->stream.type == STREAM_TYPE_DIR && v->stream.u.dir.dir_head != NULL) || v->dir_next != NULL)) {
return ERR_NOT_ALLOWED;
return EPERM;
}
// remove it from the global hash table
@ -218,7 +219,7 @@ static int
bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v)
{
if(dir->stream.type != STREAM_TYPE_DIR)
return ERR_INVALID_ARGS;
return EINVAL;
v->dir_next = dir->stream.u.dir.dir_head;
dir->stream.u.dir.dir_head = v;
@ -355,7 +356,7 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
new_vnode = bootfs_create_vnode(fs, leaf);
if(new_vnode == NULL)
return ERR_NO_MEMORY;
return ENOMEM;
// set up the new node
new_vnode->stream.type = STREAM_TYPE_FILE;
@ -390,7 +391,7 @@ bootfs_mount(fs_cookie *_fs, fs_id id, const char *device, void *args, vnode_id
fs = kmalloc(sizeof(struct bootfs));
if(fs == NULL) {
err = ERR_NO_MEMORY;
err = ENOMEM;
goto err;
}
@ -405,14 +406,14 @@ bootfs_mount(fs_cookie *_fs, fs_id id, const char *device, void *args, vnode_id
fs->vnode_list_hash = hash_init(BOOTFS_HASH_SIZE, (addr)&v->all_next - (addr)v,
&bootfs_vnode_compare_func, &bootfs_vnode_hash_func);
if(fs->vnode_list_hash == NULL) {
err = ERR_NO_MEMORY;
err = ENOMEM;
goto err2;
}
// create a vnode
v = bootfs_create_vnode(fs, "");
if(v == NULL) {
err = ERR_NO_MEMORY;
err = ENOMEM;
goto err3;
}
@ -494,7 +495,7 @@ bootfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *id)
TRACE(("bootfs_lookup: entry dir 0x%x, name '%s'\n", dir, name));
if (dir->stream.type != STREAM_TYPE_DIR)
return ERR_VFS_NOT_DIR;
return ENOTDIR;
mutex_lock(&fs->lock);
@ -605,7 +606,7 @@ bootfs_open(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie, stream_type st, in
cookie = kmalloc(sizeof(struct bootfs_cookie));
if (cookie == NULL) {
err = ERR_NO_MEMORY;
err = ENOMEM;
goto err;
}
@ -783,12 +784,12 @@ bootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int st)
cookie->u.file.pos = pos + cookie->s->u.file.len;
break;
default:
err = ERR_INVALID_ARGS;
err = EINVAL;
}
break;
default:
err = ERR_INVALID_ARGS;
err = EINVAL;
}
mutex_unlock(&fs->lock);
@ -819,7 +820,7 @@ bootfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dire
dirent->d_reclen = strlen(cookie->u.dir.ptr->name);
if (sizeof(struct dirent) + dirent->d_reclen + 1 > bufferSize) {
status = ERR_VFS_INSUFFICIENT_BUF;
status = ENOBUFS;
goto err;
}
@ -912,28 +913,28 @@ bootfs_writepage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos)
TRACE(("bootfs_writepage: vnode 0x%x, vecs 0x%x, pos 0x%x 0x%x\n", v, vecs, pos));
return ERR_NOT_ALLOWED;
return EPERM;
}
static int
bootfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, stream_type st, void *create_args, vnode_id *new_vnid)
{
return ERR_VFS_READONLY_FS;
return EROFS;
}
static int
bootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name)
{
return ERR_VFS_READONLY_FS;
return EROFS;
}
static int
bootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{
return ERR_VFS_READONLY_FS;
return EROFS;
}
@ -985,7 +986,7 @@ bootfs_wstat(fs_cookie _fs, fs_vnode _v, struct stat *stat, int stat_mask)
TRACE(("bootfs_wstat: vnode 0x%x (0x%x 0x%x), stat 0x%x\n", v, v->id, stat));
// cannot change anything
return ERR_VFS_READONLY_FS;
return EROFS;
}

View File

@ -13,6 +13,7 @@
#include <lock.h>
#include <vm.h>
#include <Errors.h>
#include <kerrors.h>
#include <drivers.h>
#include <sys/stat.h>

View File

@ -11,6 +11,7 @@
#include <lock.h>
#include <vm.h>
#include <Errors.h>
#include <kerrors.h>
#include <sys/stat.h>
#include <rootfs.h>

View File

@ -21,6 +21,7 @@
#include <bootfs.h>
#include <devfs.h>
#include <Errors.h>
#include <kerrors.h>
#include <atomic.h>
#include <OS.h>
#include <fd.h>

View File

@ -106,7 +106,7 @@ int hash_remove(void *_hash_table, void *e)
}
}
return ERR_GENERAL;
return B_ERROR;
}
void *hash_find(void *_hash_table, void *e)

View File

@ -26,7 +26,7 @@ int recursive_lock_get_recursion(recursive_lock *lock)
int recursive_lock_create(recursive_lock *lock)
{
if(lock == NULL)
return ERR_INVALID_ARGS;
return EINVAL;
lock->holder = -1;
lock->recursion = 0;
lock->sem = create_sem(1, "recursive_lock_sem");
@ -80,7 +80,7 @@ int mutex_init(mutex *m, const char *in_name)
const char *name;
if(m == NULL)
return ERR_INVALID_ARGS;
return EINVAL;
if(in_name == NULL)
name = "mutex_sem";

View File

@ -5,10 +5,6 @@
** Distributed under the terms of the NewOS License.
*/
// TODO:
// - "offsetof" macro is missing
// -> move it to a public place
#include <kernel.h>
#include <module.h>
#include <lock.h>
@ -533,21 +529,21 @@ static inline int init_module(module *module)
case MOD_INIT:
SHOW_ERROR( 0, "circular reference to %s\n", module->name );
res = ERR_GENERAL;
res = B_ERROR;
break;
case MOD_UNINIT:
SHOW_ERROR( 0, "tried to load module %s which is currently unloading\n", module->name );
res = ERR_GENERAL;
res = B_ERROR;
break;
case MOD_ERROR:
SHOW_INFO( 0, "cannot load module %s because its earlier unloading failed\n", module->name );
res = ERR_GENERAL;
res = B_ERROR;
break;
default:
res = ERR_GENERAL;
res = B_ERROR;
}
return res;
@ -563,11 +559,11 @@ static inline int uninit_module(module *module)
case MOD_INIT:
panic( "Trying to unload module %s which is initializing\n",
module->name );
return ERR_GENERAL;
return B_ERROR;
case MOD_UNINIT:
panic( "Trying to unload module %s which is un-initializing\n", module->name );
return ERR_GENERAL;
return B_ERROR;
case MOD_RDY:
{
@ -592,7 +588,7 @@ static inline int uninit_module(module *module)
// fall through
default:
return ERR_GENERAL;
return B_ERROR;
}
}
@ -640,12 +636,12 @@ static inline int module_create_dir_iterator( module_iterator *iter, int file, c
dir = (struct module_dir_iterator *)kmalloc( sizeof( *dir ));
if (dir == NULL )
return ERR_NO_MEMORY;
return ENOMEM;
dir->name = (char *)kstrdup( name );
if (dir->name == NULL ) {
kfree( dir );
return ERR_NO_MEMORY;
return ENOMEM;
}
dir->file = file;
@ -830,7 +826,7 @@ static inline int module_enter_base_path(module_iterator *iter)
if (iter->base_path_id >= (int)num_module_paths ) {
SHOW_FLOW0( 3, "no locations left\n" );
return ERR_NOT_FOUND;
return ENOENT;
}
SHOW_FLOW(3, "trying base path (%s)\n", module_paths[iter->base_path_id]);

View File

@ -13,7 +13,7 @@
#include <cbuf.h>
#include <Errors.h>
#include <int.h>
#include <kerrors.h>
#include <string.h>
#include <stdlib.h>

View File

@ -15,6 +15,7 @@
#include <memheap.h>
#include <thread.h>
#include <Errors.h>
#include <kerrors.h>
#include <stage2.h>

View File

@ -11,7 +11,6 @@
#include <debug.h>
#include <vfs.h>
#include <thread.h>
#include <OS.h>
#include <sem.h>
#include <port.h>
#include <cpu.h>
@ -19,9 +18,10 @@
#include <resource.h>
#include <fd.h>
#include <sysctl.h>
#include <sys/socket.h>
#include <ksocket.h>
#include <sys/ioccom.h>
#include <sys/socket.h>
#include <OS.h>
#define INT32TOINT64(x, y) ((int64)(x) | ((int64)(y) << 32))

View File

@ -5,9 +5,10 @@
#include <vm.h>
#include <debug.h>
#include <memheap.h>
#include <Errors.h>
#include <sysctl.h>
#include <Errors.h>
/* Not sure where to put this definition yet (sys/param.h?),
* so just add it here
* XXX - horrible hack!

View File

@ -32,6 +32,7 @@
#include <stdlib.h>
#include <resource.h>
#include <atomic.h>
#include <kerrors.h>
struct proc_key {
proc_id id;

View File

@ -3,6 +3,7 @@
** Distributed under the terms of the NewOS License.
*/
#include <Errors.h>
#include <kerrors.h>
#include <kernel.h>
#include <vm.h>
#include <vm_priv.h>

View File

@ -8,6 +8,7 @@
#include <debug.h>
#include <vm_store_anonymous_noswap.h>
#include <Errors.h>
#include <kerrors.h>
static void anonymous_destroy(struct vm_store *store)
{

View File

@ -9,6 +9,7 @@
#include <lock.h>
#include <vm_store_device.h>
#include <Errors.h>
#include <kerrors.h>
struct device_store_data {
addr base_addr;

View File

@ -10,6 +10,7 @@
#include <vm_store_null.h>
#include <vfs.h>
#include <Errors.h>
#include <kerrors.h>
static void null_destroy(struct vm_store *store)
{