diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index 08365705f7..e742a95e3e 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -163,20 +163,20 @@ typedef struct port_info { port_id create_port(int32, const char *); port_id find_port(const char *); -int read_port(port_id, int32 *, void *, size_t); -int read_port_etc(port_id, int32 *, void *, size_t, uint32, bigtime_t); -int write_port(port_id, int32, const void *, size_t); -int write_port_etc(port_id, int32, const void *, size_t, uint32, bigtime_t); -int close_port(port_id port); -int delete_port(port_id port); +status_t read_port(port_id, int32 *, void *, size_t); +status_t read_port_etc(port_id, int32 *, void *, size_t, uint32, bigtime_t); +status_t write_port(port_id, int32, const void *, size_t); +status_t write_port_etc(port_id, int32, const void *, size_t, uint32, bigtime_t); +status_t close_port(port_id port); +status_t delete_port(port_id port); ssize_t port_buffer_size(port_id); ssize_t port_buffer_size_etc(port_id, uint32, bigtime_t); ssize_t port_count(port_id); -int set_port_owner(port_id, team_id); +status_t set_port_owner(port_id, team_id); -int _get_port_info(port_id, port_info *, size_t); -int _get_next_port_info(team_id, int32 *, port_info *, size_t); +status_t _get_port_info(port_id, port_info *, size_t); +status_t _get_next_port_info(team_id, int32 *, port_info *, size_t); #define get_port_info(port, info) \ _get_port_info((port), (info), sizeof(*(info))) @@ -206,18 +206,18 @@ typedef struct sem_info { thread_id latest_holder; } sem_info; -sem_id create_sem_etc(int count, const char *name, team_id owner); -sem_id create_sem(int count, const char *name); -int delete_sem(sem_id id); -int delete_sem_etc(sem_id id, int return_code); -int acquire_sem(sem_id id); -int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout); -int release_sem(sem_id id); -int release_sem_etc(sem_id id, int count, int flags); -int get_sem_count(sem_id id, int32* thread_count); -int _get_sem_info(sem_id id, struct sem_info *info, size_t); -int _get_next_sem_info(team_id team, uint32 *cookie, struct sem_info *info, size_t); -int set_sem_owner(sem_id id, team_id team); +sem_id create_sem_etc(int32 count, const char *name, team_id owner); /* not public BeOS */ +sem_id create_sem(int32 count, const char *name); +status_t delete_sem(sem_id id); +status_t delete_sem_etc(sem_id id, status_t return_code); /* not public BeOS */ +status_t acquire_sem(sem_id id); +status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); +status_t release_sem(sem_id id); +status_t release_sem_etc(sem_id id, int32 count, uint32 flags); +status_t get_sem_count(sem_id id, int32* thread_count); +status_t _get_sem_info(sem_id id, struct sem_info *info, size_t); +status_t _get_next_sem_info(team_id team, int32 *cookie, struct sem_info *info, size_t); +status_t set_sem_owner(sem_id id, team_id team); #define get_sem_info(sem, info) \ _get_sem_info((sem), (info), sizeof(*(info))) diff --git a/headers/private/kernel/atomic.h b/headers/private/kernel/atomic.h index 98dd845b9f..b9cd18162a 100755 --- a/headers/private/kernel/atomic.h +++ b/headers/private/kernel/atomic.h @@ -1,6 +1,9 @@ #ifndef _KERNEL_ATOMIC_H #define _KERNEL_ATOMIC_H +#include +typedef volatile int vint32; //XXX misplaced here + /** * @file kernel/atomic.h * @brief Prototypes for kernel and user versions of atomic @@ -17,37 +20,41 @@ extern "C" { #endif -/* XXX - atomic_set is defined as using a volatile as this stops a - * compiler warning, but is there any reason why they shouldn't all - * be so defined? They were in arch/cpu.h... +/* atomic_add(), atomic_and(), atomic_or() must + * match the definitions in SupportDefs.h */ + /** * Perform an atomic addition. * @param val Pointer to an integer * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int atomic_add(int *val, int incr); +int32 atomic_add(vint32 *val, int32 incr); + /** * Atomic and operation * @param val Pointer to an integer * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int atomic_and(int *val, int incr); +int32 atomic_and(vint32 *val, int32 incr); + /** * Atomic or operation * @param val Pointer to an integer * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int atomic_or(int *val, int incr); -int atomic_set(volatile int *val, int set_to); +int32 atomic_or(vint32 *val, int32 incr); + +int32 atomic_set(vint32 *val, int32 set_to); + /* Compare the value of val with test_val. If they * are equal then set the value of 'val' to * 'set_to' */ -int test_and_set(int *val, int set_to, int test_val); +int32 test_and_set(vint32 *val, int32 set_to, int32 test_val); /** * Atomic add (user version) @@ -55,29 +62,33 @@ int test_and_set(int *val, int set_to, int test_val); * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int user_atomic_add(int *val, int incr); +int32 user_atomic_add(vint32 *val, int32 incr); + /** * Atomic and (user version) * @param val Pointer to an integer * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int user_atomic_and(int *val, int incr); +int32 user_atomic_and(vint32 *val, int32 incr); + /** * Atomic or (user version) * @param val Pointer to an integer * @param incr The increment to add (may be -ve) * @note Returns value of val before addition */ -int user_atomic_or(int *val, int incr); -int user_atomic_set(int *val, int set_to); +int32 user_atomic_or(vint32 *val, int32 incr); + +int32 user_atomic_set(vint32 *val, int32 set_to); + /* Compare the value of val with test_val. If they * are equal then set the value of 'val' to * 'set_to' * @note This is the user version and should not be used within * the kernel. */ -int user_test_and_set(int *val, int set_to, int test_val); +int32 user_test_and_set(vint32 *val, int32 set_to, int32 test_val); #ifdef __cplusplus } diff --git a/headers/private/kernel/bootfs.h b/headers/private/kernel/bootfs.h index a957d2067f..790a50bd6b 100755 --- a/headers/private/kernel/bootfs.h +++ b/headers/private/kernel/bootfs.h @@ -5,6 +5,6 @@ #ifndef _NEWOS_KERNEL_FS_BOOTFS_H #define _NEWOS_KERNEL_FS_BOOTFS_H -int bootstrap_bootfs(void); +status_t bootstrap_bootfs(void); #endif diff --git a/headers/private/kernel/devfs.h b/headers/private/kernel/devfs.h index 15fe9f3797..6fe03c8274 100755 --- a/headers/private/kernel/devfs.h +++ b/headers/private/kernel/devfs.h @@ -8,9 +8,9 @@ #include #include -int bootstrap_devfs(void); +status_t bootstrap_devfs(void); /* api drivers will use to publish devices */ -int devfs_publish_device(const char *path, void *ident, device_hooks *calls); +status_t devfs_publish_device(const char *path, void *ident, device_hooks *calls); #endif /* _DEVFS_H */ diff --git a/headers/private/kernel/port.h b/headers/private/kernel/port.h index 515d911206..3035c52d6e 100755 --- a/headers/private/kernel/port.h +++ b/headers/private/kernel/port.h @@ -11,7 +11,7 @@ #define PORT_FLAG_USE_USER_MEMCPY 0x80000000 -int port_init(kernel_args *ka); +status_t port_init(kernel_args *ka); int delete_owned_ports(team_id owner); // temp: test @@ -20,25 +20,25 @@ int port_test_thread_func(void* arg); // user-level API port_id user_create_port(int32 queue_length, const char *name); -int user_close_port(port_id id); -int user_delete_port(port_id id); +status_t user_close_port(port_id id); +status_t user_delete_port(port_id id); port_id user_find_port(const char *port_name); -int user_get_port_info(port_id id, struct port_info *info); -int user_get_next_port_info(team_id team, - uint32 *cookie, +status_t user_get_port_info(port_id id, struct port_info *info); +status_t user_get_next_port_info(team_id team, + int32 *cookie, struct port_info *info); ssize_t user_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout); -int32 user_port_count(port_id port); -ssize_t user_read_port_etc(port_id port, +ssize_t user_port_count(port_id port); +status_t user_read_port_etc(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout); -int user_set_port_owner(port_id port, team_id team); -int user_write_port_etc(port_id port, +status_t user_set_port_owner(port_id port, team_id team); +status_t user_write_port_etc(port_id port, int32 msg_code, void *msg_buffer, size_t buffer_size, diff --git a/headers/private/kernel/rootfs.h b/headers/private/kernel/rootfs.h index 41bccdfde2..d8c66703a9 100755 --- a/headers/private/kernel/rootfs.h +++ b/headers/private/kernel/rootfs.h @@ -5,6 +5,6 @@ #ifndef _NEWOS_KERNEL_FS_ROOTFS_H #define _NEWOS_KERNEL_FS_ROOTFS_H -int bootstrap_rootfs(void); +status_t bootstrap_rootfs(void); #endif diff --git a/headers/private/kernel/sem.h b/headers/private/kernel/sem.h index 4c09fd9a29..45726aa436 100755 --- a/headers/private/kernel/sem.h +++ b/headers/private/kernel/sem.h @@ -15,22 +15,22 @@ /* #ifdef _KERNEL_ */ -sem_id user_create_sem(int count, const char *name); -int user_delete_sem(sem_id id); -int user_delete_sem_etc(sem_id id, int return_code); -int user_acquire_sem(sem_id id); -int user_acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout); -int user_release_sem(sem_id id); -int user_release_sem_etc(sem_id id, int count, int flags); -int user_get_sem_count(sem_id id, int32* thread_count); -int user_get_sem_info(sem_id, struct sem_info *, size_t); -int user_get_next_sem_info(team_id, uint32 *, struct sem_info *, size_t); -int user_set_sem_owner(sem_id id, team_id team); +sem_id user_create_sem(int32 count, const char *name); +status_t user_delete_sem(sem_id id); +status_t user_delete_sem_etc(sem_id id, status_t return_code); +status_t user_acquire_sem(sem_id id); +status_t user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); +status_t user_release_sem(sem_id id); +status_t user_release_sem_etc(sem_id id, int32 count, uint32 flags); +status_t user_get_sem_count(sem_id id, int32* thread_count); +status_t user_get_sem_info(sem_id, struct sem_info *, size_t); +status_t user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t); +status_t user_set_sem_owner(sem_id id, team_id team); -int sem_init(kernel_args *ka); -int sem_delete_owned_sems(team_id owner); -int sem_interrupt_thread(struct thread *t); +status_t sem_init(kernel_args *ka); +int sem_delete_owned_sems(team_id owner); +status_t sem_interrupt_thread(struct thread *t); /* #endif */ #endif /* _KERNEL_SEM_H */ diff --git a/src/add-ons/kernel/drivers/arch/x86/keyboard/keyboard.c b/src/add-ons/kernel/drivers/arch/x86/keyboard/keyboard.c index d6603dbf94..ea2b4d4111 100644 --- a/src/add-ons/kernel/drivers/arch/x86/keyboard/keyboard.c +++ b/src/add-ons/kernel/drivers/arch/x86/keyboard/keyboard.c @@ -73,13 +73,15 @@ const char caps_keymap[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static void wait_for_output(void) +static void +wait_for_output(void) { while(in8(0x64) & 0x2) ; } -static void set_leds(void) +static void +set_leds(void) { wait_for_output(); out8(0xed, 0x60); @@ -87,7 +89,8 @@ static void set_leds(void) out8(leds, 0x60); } -static ssize_t _keyboard_read(void *_buf, size_t len) +static ssize_t +_keyboard_read(void *_buf, size_t len) { unsigned int saved_tail; char *buf = _buf; @@ -140,7 +143,8 @@ retry: return copied_bytes; } -static void insert_in_buf(char c) +static void +insert_in_buf(char c) { unsigned int temp_tail = tail; @@ -156,10 +160,11 @@ static void insert_in_buf(char c) release_sem_etc(keyboard_sem, 1, B_DO_NOT_RESCHEDULE); } -static int handle_keyboard_interrupt(void* data) +static int32 +handle_keyboard_interrupt(void* data) { unsigned char key; - int retval = B_HANDLED_INTERRUPT; + int32 retval = B_HANDLED_INTERRUPT; key = in8(0x60); // dprintf("handle_keyboard_interrupt: key = 0x%x\n", key); @@ -231,23 +236,27 @@ static int handle_keyboard_interrupt(void* data) return retval; } -static int keyboard_open(const char *name, uint32 flags, void * *cookie) +static status_t +keyboard_open(const char *name, uint32 flags, void * *cookie) { *cookie = NULL; return 0; } -static int keyboard_close(void * cookie) +static status_t +keyboard_close(void * cookie) { return 0; } -static int keyboard_freecookie(void * cookie) +static status_t +keyboard_freecookie(void * cookie) { return 0; } -static ssize_t keyboard_read(void * cookie, off_t pos, void *buf, size_t *len) +static ssize_t +keyboard_read(void * cookie, off_t pos, void *buf, size_t *len) { int rv; if (*len < 0) @@ -260,12 +269,14 @@ static ssize_t keyboard_read(void * cookie, off_t pos, void *buf, size_t *len) return 0; } -static ssize_t keyboard_write(void * cookie, off_t pos, const void *buf, size_t *len) +static ssize_t +keyboard_write(void * cookie, off_t pos, const void *buf, size_t *len) { return EROFS; } -static int keyboard_ioctl(void * cookie, uint32 op, void *buf, size_t len) +static status_t +keyboard_ioctl(void * cookie, uint32 op, void *buf, size_t len) { return EINVAL; } @@ -283,7 +294,8 @@ device_hooks keyboard_hooks = { NULL }; -static int setup_keyboard(void) +static int +setup_keyboard(void) { keyboard_sem = create_sem(0, "keyboard_sem"); if(keyboard_sem < 0) @@ -304,7 +316,8 @@ static int setup_keyboard(void) return 0; } -status_t init_hardware() +status_t +init_hardware() { setup_keyboard(); install_io_interrupt_handler(0x01, &handle_keyboard_interrupt, NULL, 0); @@ -312,7 +325,8 @@ status_t init_hardware() return 0; } -const char **publish_devices(void) +const char ** +publish_devices(void) { static const char *devices[] = { DEVICE_NAME, @@ -322,7 +336,8 @@ const char **publish_devices(void) return devices; } -device_hooks *find_device(const char *name) +device_hooks * +find_device(const char *name) { if (!strcmp(name, DEVICE_NAME)) return &keyboard_hooks; @@ -330,11 +345,13 @@ device_hooks *find_device(const char *name) return NULL; } -status_t init_driver() +status_t +init_driver() { return 0; } -void uninit_driver() +void +uninit_driver() { } diff --git a/src/add-ons/kernel/drivers/arch/x86/ps2mouse/ps2mouse.c b/src/add-ons/kernel/drivers/arch/x86/ps2mouse/ps2mouse.c index 0f6eef6fd2..f5d529d76c 100644 --- a/src/add-ons/kernel/drivers/arch/x86/ps2mouse/ps2mouse.c +++ b/src/add-ons/kernel/drivers/arch/x86/ps2mouse/ps2mouse.c @@ -77,7 +77,8 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; * Return value: * int, ??? */ -static int handle_mouse_interrupt(void* data) +static int32 +handle_mouse_interrupt(void* data) { char c; static int next_input = 0; @@ -123,7 +124,8 @@ static int handle_mouse_interrupt(void* data) /* * mouse_open: */ -static int mouse_open(const char *name, uint32 flags, void **cookie) +static status_t +mouse_open(const char *name, uint32 flags, void **cookie) { *cookie = NULL; return 0; @@ -132,7 +134,8 @@ static int mouse_open(const char *name, uint32 flags, void **cookie) /* * mouse_close: */ -static int mouse_close(void * cookie) +static status_t +mouse_close(void * cookie) { return 0; } // mouse_close @@ -140,7 +143,8 @@ static int mouse_close(void * cookie) /* * mouse_freecookie: */ -static int mouse_freecookie(void * cookie) +static status_t +mouse_freecookie(void * cookie) { return 0; } // mouse_freecookie @@ -154,7 +158,8 @@ static int mouse_freecookie(void * cookie) * off_t, ignored * ssize_t, buffer size, must be at least the size of the data packet */ -static ssize_t mouse_read(void * cookie, off_t pos, void* buf, size_t *len) +static ssize_t +mouse_read(void * cookie, off_t pos, void* buf, size_t *len) { // inform interrupt handler that data is being waited for in_read = true; @@ -184,7 +189,8 @@ static ssize_t mouse_read(void * cookie, off_t pos, void* buf, size_t *len) /* * mouse_write: */ -static ssize_t mouse_write(void * cookie, off_t pos, const void *buf, size_t *len) +static ssize_t +mouse_write(void * cookie, off_t pos, const void *buf, size_t *len) { *len = 0; return EROFS; @@ -193,7 +199,8 @@ static ssize_t mouse_write(void * cookie, off_t pos, const void *buf, size_t *le /* * mouse_ioctl: */ -static int mouse_ioctl(void * cookie, uint32 op, void *buf, size_t len) +static status_t +mouse_ioctl(void * cookie, uint32 op, void *buf, size_t len) { return EINVAL; } // mouse_ioctl @@ -223,7 +230,8 @@ device_hooks ps2_mouse_hooks = { * the "Input buffer full" and "Output buffer full" bits will both be set * to 0. */ -static void wait_write_ctrl() +static void +wait_write_ctrl() { while(in8(PS2_PORT_CTRL) & 0x3); } // wait_for_ctrl_output @@ -233,7 +241,8 @@ static void wait_write_ctrl() * Wait until the data port is ready to be written. This requires that * the "Input buffer full" bit will be set to 0. */ -static void wait_write_data() +static void +wait_write_data() { while(in8(PS2_PORT_CTRL) & 0x2); } // wait_write_data @@ -243,7 +252,8 @@ static void wait_write_data() * Wait until the data port can be read from. This requires that the * "Output buffer full" bit will be set to 1. */ -static void wait_read_data() +static void +wait_read_data() { while((in8(PS2_PORT_CTRL) & 0x1) == 0); } // wait_read_data @@ -254,7 +264,8 @@ static void wait_read_data() * Parameters: * unsigned char, byte to write */ -static void write_command_byte(unsigned char b) +static void +write_command_byte(unsigned char b) { wait_write_ctrl(); out8(PS2_CTRL_WRITE_CMD, PS2_PORT_CTRL); @@ -270,7 +281,8 @@ static void write_command_byte(unsigned char b) * Parameters: * unsigned char, byte to write */ -static void write_aux_byte(unsigned char b) +static void +write_aux_byte(unsigned char b) { wait_write_ctrl(); out8(PS2_CTRL_WRITE_AUX, PS2_PORT_CTRL); @@ -284,7 +296,8 @@ static void write_aux_byte(unsigned char b) * Return value: * unsigned char, byte read */ -static unsigned char read_data_byte() +static unsigned char +read_data_byte() { wait_read_data(); return in8(PS2_PORT_DATA); @@ -292,7 +305,8 @@ static unsigned char read_data_byte() -status_t init_hardware() +status_t +init_hardware() { /* XXX this driver does not have enough source code to * disable the mouse hardware again, so I can't add @@ -303,7 +317,8 @@ status_t init_hardware() } // mouse_dev_init -const char **publish_devices(void) +const char ** +publish_devices(void) { static const char *devices[] = { DEVICE_NAME, @@ -313,7 +328,8 @@ const char **publish_devices(void) return devices; } -device_hooks *find_device(const char *name) +device_hooks * +find_device(const char *name) { if (!strcmp(name, DEVICE_NAME)) return &ps2_mouse_hooks; @@ -321,7 +337,8 @@ device_hooks *find_device(const char *name) return NULL; } -status_t init_driver() +status_t +init_driver() { /* XXX parts of this do belong into init_hardware */ @@ -355,7 +372,8 @@ status_t init_driver() return 0; } -void uninit_driver() +void +uninit_driver() { remove_io_interrupt_handler(INT_PS2_MOUSE, &handle_mouse_interrupt, NULL); dprintf("removed PS/2 mouse interrupt handler\n"); diff --git a/src/kernel/core/arch/x86/arch_x86.S b/src/kernel/core/arch/x86/arch_x86.S index ff21c2e019..4b2dc78eee 100755 --- a/src/kernel/core/arch/x86/arch_x86.S +++ b/src/kernel/core/arch/x86/arch_x86.S @@ -8,7 +8,7 @@ .text -/* int atomic_add(int *val, int incr) */ +/* int32 atomic_add(vint32 *val, int32 incr) */ FUNCTION(atomic_add): movl 4(%esp),%edx movl 8(%esp),%eax @@ -16,7 +16,7 @@ FUNCTION(atomic_add): xaddl %eax,(%edx) ret -/* int atomic_and(int *val, int incr) */ +/* int32 atomic_and(vint32 *val, int32 incr) */ FUNCTION(atomic_and): movl 4(%esp),%edx @@ -32,7 +32,7 @@ _atomic_and1: ret -/* int atomic_or(int *val, int incr) */ +/* int32 atomic_or(vint32 *val, int32 incr) */ FUNCTION(atomic_or): movl 4(%esp),%edx @@ -48,14 +48,14 @@ _atomic_or1: ret -/* int atomic_set(int *val, int set_to) */ +/* int32 atomic_set(vint32 *val, int32 set_to) */ FUNCTION(atomic_set): movl 4(%esp),%edx movl 8(%esp),%eax xchg %eax,(%edx) ret -/* int test_and_set(int *val, int set_to, int test_val) */ +/* int32 test_and_set(vint32 *val, int32 set_to, int32 test_val) */ FUNCTION(test_and_set): movl 4(%esp),%edx movl 8(%esp),%ecx diff --git a/src/kernel/core/cpu.c b/src/kernel/core/cpu.c index b216af7320..ff8db47e50 100644 --- a/src/kernel/core/cpu.c +++ b/src/kernel/core/cpu.c @@ -33,21 +33,23 @@ int cpu_preboot_init(kernel_args *ka) return arch_cpu_preboot_init(ka); } -int user_atomic_add(int *uval, int incr) +int32 user_atomic_add(vint32 *uval, int32 incr) { - int val; - int ret; + int32 val; + int32 ret; if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) goto error; - if(user_memcpy(&val, uval, sizeof(val)) < 0) + if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0) goto error; + // XXX broken on non SH4-systems, or when interrupts are enabled + // XXX x86 must use the assembly functions directly in userspace and not this ones ret = val; val += incr; - if(user_memcpy(uval, &val, sizeof(val)) < 0) + if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0) goto error; return ret; @@ -57,7 +59,7 @@ error: return -1; } -int user_atomic_and(int *uval, int incr) +int32 user_atomic_and(vint32 *uval, int32 incr) { int val; int ret; @@ -65,13 +67,15 @@ int user_atomic_and(int *uval, int incr) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) goto error; - if(user_memcpy(&val, uval, sizeof(val)) < 0) + if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0) goto error; + // XXX broken on non SH4-systems, or when interrupts are enabled + // XXX x86 must use the assembly functions directly in userspace and not this ones ret = val; val &= incr; - if(user_memcpy(uval, &val, sizeof(val)) < 0) + if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0) goto error; return ret; @@ -81,7 +85,7 @@ error: return -1; } -int user_atomic_or(int *uval, int incr) +int32 user_atomic_or(vint32 *uval, int32 incr) { int val; int ret; @@ -89,13 +93,15 @@ int user_atomic_or(int *uval, int incr) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) goto error; - if(user_memcpy(&val, uval, sizeof(val)) < 0) + if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0) goto error; + // XXX broken on non SH4-systems, or when interrupts are enabled + // XXX x86 must use the assembly functions directly in userspace and not this ones ret = val; val |= incr; - if(user_memcpy(uval, &val, sizeof(val)) < 0) + if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0) goto error; return ret; @@ -105,7 +111,7 @@ error: return -1; } -int user_atomic_set(int *uval, int set_to) +int32 user_atomic_set(vint32 *uval, int32 set_to) { int val; int ret; @@ -113,13 +119,15 @@ int user_atomic_set(int *uval, int set_to) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) goto error; - if(user_memcpy(&val, uval, sizeof(val)) < 0) + if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0) goto error; + // XXX broken on non SH4-systems, or when interrupts are enabled + // XXX x86 must use the assembly functions directly in userspace and not this ones ret = val; val = set_to; - if(user_memcpy(uval, &val, sizeof(val)) < 0) + if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0) goto error; return ret; @@ -129,7 +137,7 @@ error: return -1; } -int user_test_and_set(int *uval, int set_to, int test_val) +int32 user_test_and_set(vint32 *uval, int32 set_to, int32 test_val) { int val; int ret; @@ -137,13 +145,15 @@ int user_test_and_set(int *uval, int set_to, int test_val) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) goto error; - if(user_memcpy(&val, uval, sizeof(val)) < 0) + if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0) goto error; + // XXX broken on non SH4-systems, or when interrupts are enabled + // XXX x86 must use the assembly functions directly in userspace and not this ones ret = val; if(val == test_val) { val = set_to; - if(user_memcpy(uval, &val, sizeof(val)) < 0) + if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0) goto error; } diff --git a/src/kernel/core/fs/bootfs.c b/src/kernel/core/fs/bootfs.c index b930854bbf..5abf7f4889 100755 --- a/src/kernel/core/fs/bootfs.c +++ b/src/kernel/core/fs/bootfs.c @@ -137,7 +137,7 @@ bootfs_create_vnode(struct bootfs *fs, const char *name) } -static int +static status_t 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 @@ -219,7 +219,7 @@ bootfs_find_in_dir(struct bootfs_vnode *dir, const char *path) } -static int +static status_t bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v) { if(dir->stream.type != STREAM_TYPE_DIR) @@ -233,7 +233,7 @@ bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v) } -static int +static status_t bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit) { struct bootfs_vnode *v; @@ -256,13 +256,15 @@ bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit) } -static int +/* XXX seems to be unused +static bool bootfs_is_dir_empty(struct bootfs_vnode *dir) { if(dir->stream.type != STREAM_TYPE_DIR) return false; return !dir->stream.u.dir.dir_head; } +*/ /** Creates a path of vnodes up to the last part of the passed in path. @@ -337,7 +339,7 @@ bootfs_create_path(struct bootfs *fs, char *path, struct bootfs_vnode *base, cha } -static int +static status_t bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root) { int i; @@ -384,12 +386,12 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root) // #pragma mark - -static int +static status_t bootfs_mount(fs_id id, const char *device, void *args, fs_cookie *_fs, vnode_id *root_vnid) { struct bootfs *fs; struct bootfs_vnode *v; - int err; + status_t err; TRACE(("bootfs_mount: entry\n")); @@ -454,7 +456,7 @@ err: } -static int +static status_t bootfs_unmount(fs_cookie _fs) { struct bootfs *fs = _fs; @@ -478,7 +480,7 @@ bootfs_unmount(fs_cookie _fs) } -static int +static status_t bootfs_sync(fs_cookie fs) { TRACE(("bootfs_sync: entry\n")); @@ -487,13 +489,13 @@ bootfs_sync(fs_cookie fs) } -static int +static status_t bootfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) { struct bootfs *fs = (struct bootfs *)_fs; struct bootfs_vnode *dir = (struct bootfs_vnode *)_dir; struct bootfs_vnode *vnode, *vdummy; - int status; + status_t status; TRACE(("bootfs_lookup: entry dir %p, name '%s'\n", dir, name)); @@ -523,7 +525,7 @@ err: } -static int +static status_t bootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) { struct bootfs_vnode *vnode = (struct bootfs_vnode *)_vnode; @@ -535,11 +537,10 @@ bootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffe } -static int +static status_t bootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *v, bool r) { struct bootfs *fs = (struct bootfs *)_fs; - int err; TRACE(("bootfs_get_vnode: asking for vnode 0x%Lx, r %d\n", id, r)); @@ -560,7 +561,7 @@ bootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *v, bool r) } -static int +static status_t bootfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool r) { struct bootfs_vnode *v = (struct bootfs_vnode *)_v; @@ -571,13 +572,13 @@ bootfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool r) } -static int +static status_t bootfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) { struct bootfs *fs = (struct bootfs *)_fs; struct bootfs_vnode *v = (struct bootfs_vnode *)_v; struct bootfs_vnode dummy; - int err; + status_t err; TRACE(("bootfs_remove_vnode: remove %p (0x%Lx) r %d\n", v, v->id, reenter)); @@ -601,14 +602,14 @@ err: } -static int +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) { return EROFS; } -static int +static status_t bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) { struct bootfs *fs = _fs; @@ -633,7 +634,7 @@ bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) } -static int +static status_t bootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { struct bootfs *fs = _fs; @@ -646,7 +647,7 @@ bootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t bootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { struct bootfs *fs = _fs; @@ -662,7 +663,7 @@ bootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t bootfs_fsync(fs_cookie _fs, fs_vnode _v) { return 0; @@ -733,7 +734,7 @@ bootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seek struct bootfs *fs = _fs; struct bootfs_vnode *v = _v; struct bootfs_cookie *cookie = _cookie; - int err = B_OK; + status_t err = B_OK; TRACE(("bootfs_seek: vnode %p, cookie %p, pos 0x%Lx , seek_type %d\n", v, cookie, pos, seekType)); @@ -781,20 +782,20 @@ bootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seek } -static int +static status_t bootfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) { return EROFS; } -static int +static status_t bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) { struct bootfs *fs = _fs; struct bootfs_vnode *vnode = _v; struct bootfs_cookie *cookie; - int status = 0; + status_t status = 0; TRACE(("bootfs_open_dir: vnode %p\n", vnode)); @@ -817,7 +818,7 @@ bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) } -static int +static status_t bootfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { struct bootfs_cookie *cookie = _cookie; @@ -855,7 +856,7 @@ err: } -static int +static status_t bootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) { struct bootfs *fs = _fs; @@ -871,7 +872,7 @@ bootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) } -static int +static status_t bootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_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)); @@ -879,7 +880,7 @@ bootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *bu } -static int +static status_t bootfs_can_page(fs_cookie _fs, fs_vnode _v) { struct bootfs_vnode *v = _v; @@ -936,26 +937,26 @@ bootfs_write_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) } -static int +static status_t bootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) { return EROFS; } -static int +static status_t bootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) { return EROFS; } -static int +static status_t bootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) { struct bootfs *fs = _fs; struct bootfs_vnode *v = _v; - int err = 0; + status_t err = 0; TRACE(("bootfs_rstat: fs_cookie %p vnode %p v->id 0x%Lx , stat %p\n", fs, v, v->id, stat)); @@ -989,7 +990,7 @@ err: } -static int +static status_t bootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) { struct bootfs *fs = _fs; @@ -1058,7 +1059,7 @@ static struct fs_calls bootfs_calls = { }; -int +status_t bootstrap_bootfs(void) { region_id rid; diff --git a/src/kernel/core/fs/devfs.c b/src/kernel/core/fs/devfs.c index df3d0ca714..451abd8de0 100755 --- a/src/kernel/core/fs/devfs.c +++ b/src/kernel/core/fs/devfs.c @@ -155,7 +155,7 @@ devfs_create_vnode(struct devfs *fs, const char *name) } -static int +static status_t devfs_delete_vnode(struct devfs *fs, struct devfs_vnode *v, bool force_delete) { // cant delete it if it's in a directory or is a directory @@ -240,7 +240,7 @@ devfs_find_in_dir(struct devfs_vnode *dir, const char *path) } -static int +static status_t devfs_insert_in_dir(struct devfs_vnode *dir, struct devfs_vnode *v) { if (dir->stream.type != STREAM_TYPE_DIR) @@ -254,7 +254,7 @@ devfs_insert_in_dir(struct devfs_vnode *dir, struct devfs_vnode *v) } -static int +static status_t devfs_remove_from_dir(struct devfs_vnode *dir, struct devfs_vnode *findit) { struct devfs_vnode *v; @@ -277,7 +277,8 @@ devfs_remove_from_dir(struct devfs_vnode *dir, struct devfs_vnode *findit) } -static int +/* XXX seems to be unused +static bool devfs_is_dir_empty(struct devfs_vnode *dir) { if (dir->stream.type != STREAM_TYPE_DIR) @@ -285,9 +286,10 @@ devfs_is_dir_empty(struct devfs_vnode *dir) return !dir->stream.u.dir.dir_head; } +*/ -static int +static status_t devfs_get_partition_info( struct devfs *fs, struct devfs_vnode *v, struct devfs_cookie *cookie, void *buf, size_t len) { @@ -311,7 +313,7 @@ devfs_get_partition_info( struct devfs *fs, struct devfs_vnode *v, } -static int +static status_t devfs_set_partition( struct devfs *fs, struct devfs_vnode *v, struct devfs_cookie *cookie, void *buf, size_t len) { @@ -403,12 +405,12 @@ err2: // #pragma mark - -static int +static status_t devfs_mount(fs_id id, const char *devfs, void *args, fs_cookie *_fs, vnode_id *root_vnid) { struct devfs *fs; struct devfs_vnode *v; - int err; + status_t err; TRACE(("devfs_mount: entry\n")); @@ -476,7 +478,7 @@ err: } -static int +static status_t devfs_unmount(fs_cookie _fs) { struct devfs *fs = _fs; @@ -500,7 +502,7 @@ devfs_unmount(fs_cookie _fs) } -static int +static status_t devfs_sync(fs_cookie fs) { TRACE(("devfs_sync: entry\n")); @@ -509,13 +511,13 @@ devfs_sync(fs_cookie fs) } -static int +static status_t devfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) { struct devfs *fs = (struct devfs *)_fs; struct devfs_vnode *dir = (struct devfs_vnode *)_dir; struct devfs_vnode *vnode, *vdummy; - int err; + status_t err; TRACE(("devfs_lookup: entry dir %p, name '%s'\n", dir, name)); @@ -545,7 +547,7 @@ err: } -static int +static status_t devfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) { struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode; @@ -557,7 +559,7 @@ devfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffer } -static int +static status_t devfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) { struct devfs *fs = (struct devfs *)_fs; @@ -581,7 +583,7 @@ devfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) } -static int +static status_t devfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) { #if DEVFS_TRACE @@ -594,7 +596,7 @@ devfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) } -static int +static status_t devfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) { struct devfs *fs = (struct devfs *)_fs; @@ -619,20 +621,20 @@ devfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter) } -static int +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) { return EROFS; } -static int +static status_t devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) { struct devfs *fs = _fs; struct devfs_vnode *vnode = _v; struct devfs_cookie *cookie; - int 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)); @@ -650,7 +652,7 @@ devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) } -static int +static status_t devfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { struct devfs_vnode *vnode = _v; @@ -667,7 +669,7 @@ devfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t devfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { struct devfs_vnode *vnode = _v; @@ -687,7 +689,7 @@ devfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t devfs_fsync(fs_cookie _fs, fs_vnode _v) { return 0; @@ -772,14 +774,14 @@ devfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int seekT } -static int +static status_t devfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) { return EROFS; } -static int +static status_t devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) { struct devfs *fs = _fs; @@ -806,7 +808,7 @@ devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) } -static int +static status_t devfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { struct devfs_cookie *cookie = _cookie; @@ -848,7 +850,7 @@ err: } -static int +static status_t devfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) { struct devfs *fs = _fs; @@ -868,7 +870,7 @@ devfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) } -static int +static status_t devfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf, size_t len) { struct devfs *fs = _fs; @@ -969,13 +971,13 @@ static ssize_t devfs_writepage(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t p } */ -static int +static status_t devfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) { struct devfs *fs = _fs; struct devfs_vnode *dir = _dir; struct devfs_vnode *vnode; - int status = B_NO_ERROR; + status_t status = B_NO_ERROR; mutex_lock(&fs->lock); @@ -1004,14 +1006,14 @@ err: } -static int +static status_t devfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) { return EROFS; } -static int +static status_t devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) { struct devfs_vnode *vnode = _v; @@ -1027,7 +1029,7 @@ devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) } -static int +static status_t devfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) { #if DEVFS_TRACE @@ -1096,7 +1098,7 @@ static struct fs_calls devfs_calls = { }; -int +status_t bootstrap_devfs(void) { @@ -1106,7 +1108,7 @@ bootstrap_devfs(void) } -int +status_t devfs_publish_device(const char *path, void *ident, device_hooks *calls) { int err = 0; diff --git a/src/kernel/core/fs/rootfs.c b/src/kernel/core/fs/rootfs.c index 483d3caf42..02c14317e0 100755 --- a/src/kernel/core/fs/rootfs.c +++ b/src/kernel/core/fs/rootfs.c @@ -114,7 +114,7 @@ rootfs_create_vnode(struct rootfs *fs) } -static int +static status_t rootfs_delete_vnode(struct rootfs *fs, struct rootfs_vnode *v, bool force_delete) { // cant delete it if it's in a directory or is a directory @@ -185,7 +185,7 @@ rootfs_find_in_dir(struct rootfs_vnode *dir, const char *path) } -static int +static status_t rootfs_insert_in_dir(struct rootfs_vnode *dir, struct rootfs_vnode *v) { v->dir_next = dir->stream.dir.dir_head; @@ -194,7 +194,7 @@ rootfs_insert_in_dir(struct rootfs_vnode *dir, struct rootfs_vnode *v) } -static int +static status_t rootfs_remove_from_dir(struct rootfs_vnode *dir, struct rootfs_vnode *findit) { struct rootfs_vnode *v; @@ -217,18 +217,18 @@ rootfs_remove_from_dir(struct rootfs_vnode *dir, struct rootfs_vnode *findit) } -static int +static bool rootfs_is_dir_empty(struct rootfs_vnode *dir) { return !dir->stream.dir.dir_head; } -static int +static status_t rootfs_remove(struct rootfs *fs, struct rootfs_vnode *dir, const char *name, bool isDirectory) { struct rootfs_vnode *vnode; - int status = B_OK; + status_t status = B_OK; mutex_lock(&fs->lock); @@ -260,12 +260,12 @@ err: // #pragma mark - -static int +static status_t rootfs_mount(fs_id id, const char *device, void *args, fs_cookie *_fs, vnode_id *root_vnid) { struct rootfs *fs; struct rootfs_vnode *vnode; - int err; + status_t err; TRACE(("rootfs_mount: entry\n")); @@ -325,7 +325,7 @@ err1: } -static int +static status_t rootfs_unmount(fs_cookie _fs) { struct rootfs *fs = (struct rootfs *)_fs; @@ -352,7 +352,7 @@ rootfs_unmount(fs_cookie _fs) } -static int +static status_t rootfs_sync(fs_cookie fs) { TRACE(("rootfs_sync: entry\n")); @@ -361,14 +361,14 @@ rootfs_sync(fs_cookie fs) } -static int +static status_t rootfs_lookup(fs_cookie _fs, fs_vnode _dir, const char *name, vnode_id *_id, int *_type) { struct rootfs *fs = (struct rootfs *)_fs; struct rootfs_vnode *dir = (struct rootfs_vnode *)_dir; struct rootfs_vnode *vnode,*vdummy; struct rootfs_vnode *v1; - int status; + status_t status; TRACE(("rootfs_lookup: entry dir %p, name '%s'\n", dir, name)); if (dir->stream.type != STREAM_TYPE_DIR) @@ -397,7 +397,7 @@ err: } -static int +static status_t rootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t bufferSize) { struct rootfs_vnode *vnode = (struct rootfs_vnode *)_vnode; @@ -409,7 +409,7 @@ rootfs_get_vnode_name(fs_cookie _fs, fs_vnode _vnode, char *buffer, size_t buffe } -static int +static status_t rootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) { struct rootfs *fs = (struct rootfs *)_fs; @@ -433,7 +433,7 @@ rootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter) } -static int +static status_t rootfs_put_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) { #if ROOTFS_TRACE @@ -445,7 +445,7 @@ rootfs_put_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) } -static int +static status_t rootfs_remove_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) { struct rootfs *fs = (struct rootfs *)_fs; @@ -470,14 +470,14 @@ rootfs_remove_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter) } -static int +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) { return EINVAL; } -static int +static status_t rootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) { // allow to open the file, but it can't be done anything with it @@ -485,7 +485,7 @@ rootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) } -static int +static status_t rootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { #if ROOTFS_TRACE @@ -498,7 +498,7 @@ rootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t rootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) { struct rootfs_cookie *cookie = _cookie; @@ -514,7 +514,7 @@ rootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie) } -static int +static status_t rootfs_fsync(fs_cookie _fs, fs_vnode _v) { return 0; @@ -544,14 +544,14 @@ rootfs_seek(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, off_t pos, int st) } -static int +static status_t rootfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid) { struct rootfs *fs = _fs; struct rootfs_vnode *dir = _dir; struct rootfs_vnode *vnode; bool created_vnode = false; - int status = 0; + status_t status = 0; TRACE(("rootfs_create_dir: dir %p, name = '%s', perms = %d, id = 0x%Lx pointer id = %p\n", dir, name, perms,*new_vnid, new_vnid)); @@ -597,7 +597,7 @@ err: } -static int +static status_t rootfs_remove_dir(fs_cookie _fs, fs_vnode _dir, const char *name) { struct rootfs *fs = _fs; @@ -609,7 +609,7 @@ rootfs_remove_dir(fs_cookie _fs, fs_vnode _dir, const char *name) } -static int +static status_t rootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) { struct rootfs *fs = (struct rootfs *)_fs; @@ -639,7 +639,7 @@ rootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) } -static int +static status_t rootfs_read_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { struct rootfs_cookie *cookie = _cookie; @@ -679,7 +679,7 @@ err: } -static int +static status_t rootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) { struct rootfs *fs = _fs; @@ -695,7 +695,7 @@ rootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie) } -static int +static status_t rootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_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)); @@ -704,7 +704,7 @@ rootfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *bu } -static int +static status_t rootfs_can_page(fs_cookie _fs, fs_vnode _v) { return -1; @@ -725,7 +725,7 @@ rootfs_write_page(fs_cookie _fs, fs_vnode _v, iovecs *vecs, off_t pos) } -static int +static status_t rootfs_read_link(fs_cookie _fs, fs_vnode _link, char *buffer, size_t bufferSize) { struct rootfs *fs = _fs; @@ -742,14 +742,14 @@ rootfs_read_link(fs_cookie _fs, fs_vnode _link, char *buffer, size_t bufferSize) } -static int +static status_t rootfs_symlink(fs_cookie _fs, fs_vnode _dir, const char *name, const char *path, int mode) { struct rootfs *fs = _fs; struct rootfs_vnode *dir = _dir; struct rootfs_vnode *vnode; bool created_vnode = false; - int status = 0; + status_t status = 0; TRACE(("rootfs_symlink: dir %p, name = '%s', path = %s\n", dir, name, path)); @@ -798,7 +798,7 @@ err: } -static int +static status_t rootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) { struct rootfs *fs = _fs; @@ -810,14 +810,14 @@ rootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name) } -static int +static status_t rootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) { struct rootfs *fs = _fs; struct rootfs_vnode *olddir = _olddir; struct rootfs_vnode *newdir = _newdir; struct rootfs_vnode *v1, *v2; - int err; + status_t err; TRACE(("rootfs_rename: olddir %p (0x%Lx), oldname '%s', newdir %p (0x%Lx), newname '%s'\n", olddir, olddir->id, oldname, newdir, newdir->id, newname)); @@ -882,7 +882,7 @@ err: } -static int +static status_t rootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) { struct rootfs_vnode *vnode = _v; @@ -898,7 +898,7 @@ rootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) } -static int +static status_t rootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask) { #if ROOTFS_TRACE @@ -968,7 +968,7 @@ static struct fs_calls rootfs_calls = { }; -int +status_t bootstrap_rootfs(void) { dprintf("bootstrap_rootfs: entry\n"); diff --git a/src/kernel/core/fs/vfs.c b/src/kernel/core/fs/vfs.c index db6e6ffd93..db469f8010 100755 --- a/src/kernel/core/fs/vfs.c +++ b/src/kernel/core/fs/vfs.c @@ -73,7 +73,7 @@ struct vnode { fs_vnode private_node; struct fs_mount *mount; struct vnode *covered_by; - int ref_count; + int32 ref_count; bool delete_me; bool busy; }; @@ -1039,7 +1039,7 @@ vfs_get_cache_ptr(void *vnode) int vfs_set_cache_ptr(void *vnode, void *cache) { - if (test_and_set((int *)&(((struct vnode *)vnode)->cache), (int)cache, 0) == 0) + if (test_and_set((int32 *)&(((struct vnode *)vnode)->cache), (int32)cache, 0) == 0) return 0; return -1; diff --git a/src/kernel/libroot/libroot.c b/src/kernel/libroot/libroot.c index f6ff08882d..c0fc0fff5d 100755 --- a/src/kernel/libroot/libroot.c +++ b/src/kernel/libroot/libroot.c @@ -113,7 +113,7 @@ status_t acquire_sem(sem_id sem) { return sys_acquire_sem(sem); } // Have to modify flags ??? -int acquire_sem_etc(sem_id sem, int32 count, int32 flags, bigtime_t timeout) +status_t acquire_sem_etc(sem_id sem, int32 count, uint32 flags, bigtime_t timeout) { return sys_acquire_sem_etc(sem, count, flags, timeout); } // OK @@ -121,7 +121,7 @@ status_t release_sem(sem_id sem) { return sys_release_sem(sem); } // Have to modify flags ??? -status_t release_sem_etc(sem_id sem, int32 count, int32 flags) +status_t release_sem_etc(sem_id sem, int32 count, uint32 flags) { return sys_release_sem_etc(sem, count, flags); } // OK @@ -137,7 +137,7 @@ status_t _get_sem_info(sem_id sem, sem_info *info, size_t size) { return sys_get_sem_info(sem,info, size); } // OK -int _get_next_sem_info(team_id team, uint32 *cookie, sem_info *info, size_t size) +int _get_next_sem_info(team_id team, int32 *cookie, sem_info *info, size_t size) { return sys_get_next_sem_info(team,cookie,info, size); } // TO DO