Change int into status_t, and other changes for better BeOS type compatiblitly.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@975 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2002-09-03 02:19:22 +00:00
parent 35931182a2
commit 90abd04b34
16 changed files with 292 additions and 233 deletions
+21 -21
View File
@@ -163,20 +163,20 @@ typedef struct port_info {
port_id create_port(int32, const char *); port_id create_port(int32, const char *);
port_id find_port(const char *); port_id find_port(const char *);
int read_port(port_id, int32 *, void *, size_t); status_t read_port(port_id, int32 *, void *, size_t);
int read_port_etc(port_id, int32 *, void *, size_t, uint32, bigtime_t); status_t read_port_etc(port_id, int32 *, void *, size_t, uint32, bigtime_t);
int write_port(port_id, int32, const void *, size_t); status_t write_port(port_id, int32, const void *, size_t);
int write_port_etc(port_id, int32, const void *, size_t, uint32, bigtime_t); status_t write_port_etc(port_id, int32, const void *, size_t, uint32, bigtime_t);
int close_port(port_id port); status_t close_port(port_id port);
int delete_port(port_id port); status_t delete_port(port_id port);
ssize_t port_buffer_size(port_id); ssize_t port_buffer_size(port_id);
ssize_t port_buffer_size_etc(port_id, uint32, bigtime_t); ssize_t port_buffer_size_etc(port_id, uint32, bigtime_t);
ssize_t port_count(port_id); 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); status_t _get_port_info(port_id, port_info *, size_t);
int _get_next_port_info(team_id, int32 *, port_info *, size_t); status_t _get_next_port_info(team_id, int32 *, port_info *, size_t);
#define get_port_info(port, info) \ #define get_port_info(port, info) \
_get_port_info((port), (info), sizeof(*(info))) _get_port_info((port), (info), sizeof(*(info)))
@@ -206,18 +206,18 @@ typedef struct sem_info {
thread_id latest_holder; thread_id latest_holder;
} sem_info; } sem_info;
sem_id create_sem_etc(int count, const char *name, team_id owner); sem_id create_sem_etc(int32 count, const char *name, team_id owner); /* not public BeOS */
sem_id create_sem(int count, const char *name); sem_id create_sem(int32 count, const char *name);
int delete_sem(sem_id id); status_t delete_sem(sem_id id);
int delete_sem_etc(sem_id id, int return_code); status_t delete_sem_etc(sem_id id, status_t return_code); /* not public BeOS */
int acquire_sem(sem_id id); status_t acquire_sem(sem_id id);
int acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout); status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
int release_sem(sem_id id); status_t release_sem(sem_id id);
int release_sem_etc(sem_id id, int count, int flags); status_t release_sem_etc(sem_id id, int32 count, uint32 flags);
int get_sem_count(sem_id id, int32* thread_count); status_t get_sem_count(sem_id id, int32* thread_count);
int _get_sem_info(sem_id id, struct sem_info *info, size_t); status_t _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); status_t _get_next_sem_info(team_id team, int32 *cookie, struct sem_info *info, size_t);
int set_sem_owner(sem_id id, team_id team); status_t set_sem_owner(sem_id id, team_id team);
#define get_sem_info(sem, info) \ #define get_sem_info(sem, info) \
_get_sem_info((sem), (info), sizeof(*(info))) _get_sem_info((sem), (info), sizeof(*(info)))
+24 -13
View File
@@ -1,6 +1,9 @@
#ifndef _KERNEL_ATOMIC_H #ifndef _KERNEL_ATOMIC_H
#define _KERNEL_ATOMIC_H #define _KERNEL_ATOMIC_H
#include <ktypes.h>
typedef volatile int vint32; //XXX misplaced here
/** /**
* @file kernel/atomic.h * @file kernel/atomic.h
* @brief Prototypes for kernel and user versions of atomic * @brief Prototypes for kernel and user versions of atomic
@@ -17,37 +20,41 @@
extern "C" { extern "C" {
#endif #endif
/* XXX - atomic_set is defined as using a volatile as this stops a /* atomic_add(), atomic_and(), atomic_or() must
* compiler warning, but is there any reason why they shouldn't all * match the definitions in SupportDefs.h
* be so defined? They were in arch/cpu.h...
*/ */
/** /**
* Perform an atomic addition. * Perform an atomic addition.
* @param val Pointer to an integer * @param val Pointer to an integer
* @param incr The increment to add (may be -ve) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @note Returns value of val before addition
*/ */
int atomic_add(int *val, int incr); int32 atomic_add(vint32 *val, int32 incr);
/** /**
* Atomic and operation * Atomic and operation
* @param val Pointer to an integer * @param val Pointer to an integer
* @param incr The increment to add (may be -ve) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @note Returns value of val before addition
*/ */
int atomic_and(int *val, int incr); int32 atomic_and(vint32 *val, int32 incr);
/** /**
* Atomic or operation * Atomic or operation
* @param val Pointer to an integer * @param val Pointer to an integer
* @param incr The increment to add (may be -ve) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @note Returns value of val before addition
*/ */
int atomic_or(int *val, int incr); int32 atomic_or(vint32 *val, int32 incr);
int atomic_set(volatile int *val, int set_to);
int32 atomic_set(vint32 *val, int32 set_to);
/* Compare the value of val with test_val. If they /* Compare the value of val with test_val. If they
* are equal then set the value of 'val' to * are equal then set the value of 'val' to
* 'set_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) * 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) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @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) * Atomic and (user version)
* @param val Pointer to an integer * @param val Pointer to an integer
* @param incr The increment to add (may be -ve) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @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) * Atomic or (user version)
* @param val Pointer to an integer * @param val Pointer to an integer
* @param incr The increment to add (may be -ve) * @param incr The increment to add (may be -ve)
* @note Returns value of val before addition * @note Returns value of val before addition
*/ */
int user_atomic_or(int *val, int incr); int32 user_atomic_or(vint32 *val, int32 incr);
int user_atomic_set(int *val, int set_to);
int32 user_atomic_set(vint32 *val, int32 set_to);
/* Compare the value of val with test_val. If they /* Compare the value of val with test_val. If they
* are equal then set the value of 'val' to * are equal then set the value of 'val' to
* 'set_to' * 'set_to'
* @note This is the user version and should not be used within * @note This is the user version and should not be used within
* the kernel. * 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 #ifdef __cplusplus
} }
+1 -1
View File
@@ -5,6 +5,6 @@
#ifndef _NEWOS_KERNEL_FS_BOOTFS_H #ifndef _NEWOS_KERNEL_FS_BOOTFS_H
#define _NEWOS_KERNEL_FS_BOOTFS_H #define _NEWOS_KERNEL_FS_BOOTFS_H
int bootstrap_bootfs(void); status_t bootstrap_bootfs(void);
#endif #endif
+2 -2
View File
@@ -8,9 +8,9 @@
#include <vfs.h> #include <vfs.h>
#include <Drivers.h> #include <Drivers.h>
int bootstrap_devfs(void); status_t bootstrap_devfs(void);
/* api drivers will use to publish devices */ /* 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 */ #endif /* _DEVFS_H */
+10 -10
View File
@@ -11,7 +11,7 @@
#define PORT_FLAG_USE_USER_MEMCPY 0x80000000 #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); int delete_owned_ports(team_id owner);
// temp: test // temp: test
@@ -20,25 +20,25 @@ int port_test_thread_func(void* arg);
// user-level API // user-level API
port_id user_create_port(int32 queue_length, const char *name); port_id user_create_port(int32 queue_length, const char *name);
int user_close_port(port_id id); status_t user_close_port(port_id id);
int user_delete_port(port_id id); status_t user_delete_port(port_id id);
port_id user_find_port(const char *port_name); port_id user_find_port(const char *port_name);
int user_get_port_info(port_id id, struct port_info *info); status_t user_get_port_info(port_id id, struct port_info *info);
int user_get_next_port_info(team_id team, status_t user_get_next_port_info(team_id team,
uint32 *cookie, int32 *cookie,
struct port_info *info); struct port_info *info);
ssize_t user_port_buffer_size_etc(port_id port, ssize_t user_port_buffer_size_etc(port_id port,
uint32 flags, uint32 flags,
bigtime_t timeout); bigtime_t timeout);
int32 user_port_count(port_id port); ssize_t user_port_count(port_id port);
ssize_t user_read_port_etc(port_id port, status_t user_read_port_etc(port_id port,
int32 *msg_code, int32 *msg_code,
void *msg_buffer, void *msg_buffer,
size_t buffer_size, size_t buffer_size,
uint32 flags, uint32 flags,
bigtime_t timeout); bigtime_t timeout);
int user_set_port_owner(port_id port, team_id team); status_t user_set_port_owner(port_id port, team_id team);
int user_write_port_etc(port_id port, status_t user_write_port_etc(port_id port,
int32 msg_code, int32 msg_code,
void *msg_buffer, void *msg_buffer,
size_t buffer_size, size_t buffer_size,
+1 -1
View File
@@ -5,6 +5,6 @@
#ifndef _NEWOS_KERNEL_FS_ROOTFS_H #ifndef _NEWOS_KERNEL_FS_ROOTFS_H
#define _NEWOS_KERNEL_FS_ROOTFS_H #define _NEWOS_KERNEL_FS_ROOTFS_H
int bootstrap_rootfs(void); status_t bootstrap_rootfs(void);
#endif #endif
+14 -14
View File
@@ -15,22 +15,22 @@
/* #ifdef _KERNEL_ */ /* #ifdef _KERNEL_ */
sem_id user_create_sem(int count, const char *name); sem_id user_create_sem(int32 count, const char *name);
int user_delete_sem(sem_id id); status_t user_delete_sem(sem_id id);
int user_delete_sem_etc(sem_id id, int return_code); status_t user_delete_sem_etc(sem_id id, status_t return_code);
int user_acquire_sem(sem_id id); status_t user_acquire_sem(sem_id id);
int user_acquire_sem_etc(sem_id id, int count, int flags, bigtime_t timeout); status_t user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
int user_release_sem(sem_id id); status_t user_release_sem(sem_id id);
int user_release_sem_etc(sem_id id, int count, int flags); status_t user_release_sem_etc(sem_id id, int32 count, uint32 flags);
int user_get_sem_count(sem_id id, int32* thread_count); status_t user_get_sem_count(sem_id id, int32* thread_count);
int user_get_sem_info(sem_id, struct sem_info *, size_t); status_t 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); status_t user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t);
int user_set_sem_owner(sem_id id, team_id team); status_t user_set_sem_owner(sem_id id, team_id team);
int sem_init(kernel_args *ka); status_t sem_init(kernel_args *ka);
int sem_delete_owned_sems(team_id owner); int sem_delete_owned_sems(team_id owner);
int sem_interrupt_thread(struct thread *t); status_t sem_interrupt_thread(struct thread *t);
/* #endif */ /* #endif */
#endif /* _KERNEL_SEM_H */ #endif /* _KERNEL_SEM_H */
@@ -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 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) while(in8(0x64) & 0x2)
; ;
} }
static void set_leds(void) static void
set_leds(void)
{ {
wait_for_output(); wait_for_output();
out8(0xed, 0x60); out8(0xed, 0x60);
@@ -87,7 +89,8 @@ static void set_leds(void)
out8(leds, 0x60); 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; unsigned int saved_tail;
char *buf = _buf; char *buf = _buf;
@@ -140,7 +143,8 @@ retry:
return copied_bytes; return copied_bytes;
} }
static void insert_in_buf(char c) static void
insert_in_buf(char c)
{ {
unsigned int temp_tail = tail; 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); 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; unsigned char key;
int retval = B_HANDLED_INTERRUPT; int32 retval = B_HANDLED_INTERRUPT;
key = in8(0x60); key = in8(0x60);
// dprintf("handle_keyboard_interrupt: key = 0x%x\n", key); // dprintf("handle_keyboard_interrupt: key = 0x%x\n", key);
@@ -231,23 +236,27 @@ static int handle_keyboard_interrupt(void* data)
return retval; 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; *cookie = NULL;
return 0; return 0;
} }
static int keyboard_close(void * cookie) static status_t
keyboard_close(void * cookie)
{ {
return 0; return 0;
} }
static int keyboard_freecookie(void * cookie) static status_t
keyboard_freecookie(void * cookie)
{ {
return 0; 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; int rv;
if (*len < 0) if (*len < 0)
@@ -260,12 +269,14 @@ static ssize_t keyboard_read(void * cookie, off_t pos, void *buf, size_t *len)
return 0; 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; 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; return EINVAL;
} }
@@ -283,7 +294,8 @@ device_hooks keyboard_hooks = {
NULL NULL
}; };
static int setup_keyboard(void) static int
setup_keyboard(void)
{ {
keyboard_sem = create_sem(0, "keyboard_sem"); keyboard_sem = create_sem(0, "keyboard_sem");
if(keyboard_sem < 0) if(keyboard_sem < 0)
@@ -304,7 +316,8 @@ static int setup_keyboard(void)
return 0; return 0;
} }
status_t init_hardware() status_t
init_hardware()
{ {
setup_keyboard(); setup_keyboard();
install_io_interrupt_handler(0x01, &handle_keyboard_interrupt, NULL, 0); install_io_interrupt_handler(0x01, &handle_keyboard_interrupt, NULL, 0);
@@ -312,7 +325,8 @@ status_t init_hardware()
return 0; return 0;
} }
const char **publish_devices(void) const char **
publish_devices(void)
{ {
static const char *devices[] = { static const char *devices[] = {
DEVICE_NAME, DEVICE_NAME,
@@ -322,7 +336,8 @@ const char **publish_devices(void)
return devices; return devices;
} }
device_hooks *find_device(const char *name) device_hooks *
find_device(const char *name)
{ {
if (!strcmp(name, DEVICE_NAME)) if (!strcmp(name, DEVICE_NAME))
return &keyboard_hooks; return &keyboard_hooks;
@@ -330,11 +345,13 @@ device_hooks *find_device(const char *name)
return NULL; return NULL;
} }
status_t init_driver() status_t
init_driver()
{ {
return 0; return 0;
} }
void uninit_driver() void
uninit_driver()
{ {
} }
@@ -77,7 +77,8 @@ int32 api_version = B_CUR_DRIVER_API_VERSION;
* Return value: * Return value:
* int, ??? * int, ???
*/ */
static int handle_mouse_interrupt(void* data) static int32
handle_mouse_interrupt(void* data)
{ {
char c; char c;
static int next_input = 0; static int next_input = 0;
@@ -123,7 +124,8 @@ static int handle_mouse_interrupt(void* data)
/* /*
* mouse_open: * 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; *cookie = NULL;
return 0; return 0;
@@ -132,7 +134,8 @@ static int mouse_open(const char *name, uint32 flags, void **cookie)
/* /*
* mouse_close: * mouse_close:
*/ */
static int mouse_close(void * cookie) static status_t
mouse_close(void * cookie)
{ {
return 0; return 0;
} // mouse_close } // mouse_close
@@ -140,7 +143,8 @@ static int mouse_close(void * cookie)
/* /*
* mouse_freecookie: * mouse_freecookie:
*/ */
static int mouse_freecookie(void * cookie) static status_t
mouse_freecookie(void * cookie)
{ {
return 0; return 0;
} // mouse_freecookie } // mouse_freecookie
@@ -154,7 +158,8 @@ static int mouse_freecookie(void * cookie)
* off_t, ignored * off_t, ignored
* ssize_t, buffer size, must be at least the size of the data packet * 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 // inform interrupt handler that data is being waited for
in_read = true; in_read = true;
@@ -184,7 +189,8 @@ static ssize_t mouse_read(void * cookie, off_t pos, void* buf, size_t *len)
/* /*
* mouse_write: * 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; *len = 0;
return EROFS; return EROFS;
@@ -193,7 +199,8 @@ static ssize_t mouse_write(void * cookie, off_t pos, const void *buf, size_t *le
/* /*
* mouse_ioctl: * 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; return EINVAL;
} // mouse_ioctl } // mouse_ioctl
@@ -223,7 +230,8 @@ device_hooks ps2_mouse_hooks = {
* the "Input buffer full" and "Output buffer full" bits will both be set * the "Input buffer full" and "Output buffer full" bits will both be set
* to 0. * to 0.
*/ */
static void wait_write_ctrl() static void
wait_write_ctrl()
{ {
while(in8(PS2_PORT_CTRL) & 0x3); while(in8(PS2_PORT_CTRL) & 0x3);
} // wait_for_ctrl_output } // 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 * Wait until the data port is ready to be written. This requires that
* the "Input buffer full" bit will be set to 0. * 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); while(in8(PS2_PORT_CTRL) & 0x2);
} // wait_write_data } // 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 * Wait until the data port can be read from. This requires that the
* "Output buffer full" bit will be set to 1. * "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); while((in8(PS2_PORT_CTRL) & 0x1) == 0);
} // wait_read_data } // wait_read_data
@@ -254,7 +264,8 @@ static void wait_read_data()
* Parameters: * Parameters:
* unsigned char, byte to write * unsigned char, byte to write
*/ */
static void write_command_byte(unsigned char b) static void
write_command_byte(unsigned char b)
{ {
wait_write_ctrl(); wait_write_ctrl();
out8(PS2_CTRL_WRITE_CMD, PS2_PORT_CTRL); out8(PS2_CTRL_WRITE_CMD, PS2_PORT_CTRL);
@@ -270,7 +281,8 @@ static void write_command_byte(unsigned char b)
* Parameters: * Parameters:
* unsigned char, byte to write * unsigned char, byte to write
*/ */
static void write_aux_byte(unsigned char b) static void
write_aux_byte(unsigned char b)
{ {
wait_write_ctrl(); wait_write_ctrl();
out8(PS2_CTRL_WRITE_AUX, PS2_PORT_CTRL); out8(PS2_CTRL_WRITE_AUX, PS2_PORT_CTRL);
@@ -284,7 +296,8 @@ static void write_aux_byte(unsigned char b)
* Return value: * Return value:
* unsigned char, byte read * unsigned char, byte read
*/ */
static unsigned char read_data_byte() static unsigned char
read_data_byte()
{ {
wait_read_data(); wait_read_data();
return in8(PS2_PORT_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 /* XXX this driver does not have enough source code to
* disable the mouse hardware again, so I can't add * disable the mouse hardware again, so I can't add
@@ -303,7 +317,8 @@ status_t init_hardware()
} // mouse_dev_init } // mouse_dev_init
const char **publish_devices(void) const char **
publish_devices(void)
{ {
static const char *devices[] = { static const char *devices[] = {
DEVICE_NAME, DEVICE_NAME,
@@ -313,7 +328,8 @@ const char **publish_devices(void)
return devices; return devices;
} }
device_hooks *find_device(const char *name) device_hooks *
find_device(const char *name)
{ {
if (!strcmp(name, DEVICE_NAME)) if (!strcmp(name, DEVICE_NAME))
return &ps2_mouse_hooks; return &ps2_mouse_hooks;
@@ -321,7 +337,8 @@ device_hooks *find_device(const char *name)
return NULL; return NULL;
} }
status_t init_driver() status_t
init_driver()
{ {
/* XXX parts of this do belong into init_hardware */ /* XXX parts of this do belong into init_hardware */
@@ -355,7 +372,8 @@ status_t init_driver()
return 0; return 0;
} }
void uninit_driver() void
uninit_driver()
{ {
remove_io_interrupt_handler(INT_PS2_MOUSE, &handle_mouse_interrupt, NULL); remove_io_interrupt_handler(INT_PS2_MOUSE, &handle_mouse_interrupt, NULL);
dprintf("removed PS/2 mouse interrupt handler\n"); dprintf("removed PS/2 mouse interrupt handler\n");
+5 -5
View File
@@ -8,7 +8,7 @@
.text .text
/* int atomic_add(int *val, int incr) */ /* int32 atomic_add(vint32 *val, int32 incr) */
FUNCTION(atomic_add): FUNCTION(atomic_add):
movl 4(%esp),%edx movl 4(%esp),%edx
movl 8(%esp),%eax movl 8(%esp),%eax
@@ -16,7 +16,7 @@ FUNCTION(atomic_add):
xaddl %eax,(%edx) xaddl %eax,(%edx)
ret ret
/* int atomic_and(int *val, int incr) */ /* int32 atomic_and(vint32 *val, int32 incr) */
FUNCTION(atomic_and): FUNCTION(atomic_and):
movl 4(%esp),%edx movl 4(%esp),%edx
@@ -32,7 +32,7 @@ _atomic_and1:
ret ret
/* int atomic_or(int *val, int incr) */ /* int32 atomic_or(vint32 *val, int32 incr) */
FUNCTION(atomic_or): FUNCTION(atomic_or):
movl 4(%esp),%edx movl 4(%esp),%edx
@@ -48,14 +48,14 @@ _atomic_or1:
ret ret
/* int atomic_set(int *val, int set_to) */ /* int32 atomic_set(vint32 *val, int32 set_to) */
FUNCTION(atomic_set): FUNCTION(atomic_set):
movl 4(%esp),%edx movl 4(%esp),%edx
movl 8(%esp),%eax movl 8(%esp),%eax
xchg %eax,(%edx) xchg %eax,(%edx)
ret 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): FUNCTION(test_and_set):
movl 4(%esp),%edx movl 4(%esp),%edx
movl 8(%esp),%ecx movl 8(%esp),%ecx
+27 -17
View File
@@ -33,21 +33,23 @@ int cpu_preboot_init(kernel_args *ka)
return arch_cpu_preboot_init(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; int32 val;
int ret; int32 ret;
if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP)
goto error; goto error;
if(user_memcpy(&val, uval, sizeof(val)) < 0) if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0)
goto error; 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; ret = val;
val += incr; val += incr;
if(user_memcpy(uval, &val, sizeof(val)) < 0) if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0)
goto error; goto error;
return ret; return ret;
@@ -57,7 +59,7 @@ error:
return -1; return -1;
} }
int user_atomic_and(int *uval, int incr) int32 user_atomic_and(vint32 *uval, int32 incr)
{ {
int val; int val;
int ret; int ret;
@@ -65,13 +67,15 @@ int user_atomic_and(int *uval, int incr)
if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP)
goto error; goto error;
if(user_memcpy(&val, uval, sizeof(val)) < 0) if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0)
goto error; 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; ret = val;
val &= incr; val &= incr;
if(user_memcpy(uval, &val, sizeof(val)) < 0) if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0)
goto error; goto error;
return ret; return ret;
@@ -81,7 +85,7 @@ error:
return -1; return -1;
} }
int user_atomic_or(int *uval, int incr) int32 user_atomic_or(vint32 *uval, int32 incr)
{ {
int val; int val;
int ret; int ret;
@@ -89,13 +93,15 @@ int user_atomic_or(int *uval, int incr)
if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP)
goto error; goto error;
if(user_memcpy(&val, uval, sizeof(val)) < 0) if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0)
goto error; 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; ret = val;
val |= incr; val |= incr;
if(user_memcpy(uval, &val, sizeof(val)) < 0) if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0)
goto error; goto error;
return ret; return ret;
@@ -105,7 +111,7 @@ error:
return -1; return -1;
} }
int user_atomic_set(int *uval, int set_to) int32 user_atomic_set(vint32 *uval, int32 set_to)
{ {
int val; int val;
int ret; int ret;
@@ -113,13 +119,15 @@ int user_atomic_set(int *uval, int set_to)
if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP)
goto error; goto error;
if(user_memcpy(&val, uval, sizeof(val)) < 0) if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0)
goto error; 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; ret = val;
val = set_to; val = set_to;
if(user_memcpy(uval, &val, sizeof(val)) < 0) if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0)
goto error; goto error;
return ret; return ret;
@@ -129,7 +137,7 @@ error:
return -1; 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 val;
int ret; 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) if((addr)uval >= KERNEL_BASE && (addr)uval <= KERNEL_TOP)
goto error; goto error;
if(user_memcpy(&val, uval, sizeof(val)) < 0) if(user_memcpy(&val, (int32 *)uval, sizeof(val)) < 0)
goto error; 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; ret = val;
if(val == test_val) { if(val == test_val) {
val = set_to; val = set_to;
if(user_memcpy(uval, &val, sizeof(val)) < 0) if(user_memcpy((int32 *)uval, &val, sizeof(val)) < 0)
goto error; goto error;
} }
+37 -36
View File
@@ -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) 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 // 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) bootfs_insert_in_dir(struct bootfs_vnode *dir, struct bootfs_vnode *v)
{ {
if(dir->stream.type != STREAM_TYPE_DIR) 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) bootfs_remove_from_dir(struct bootfs_vnode *dir, struct bootfs_vnode *findit)
{ {
struct bootfs_vnode *v; 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) bootfs_is_dir_empty(struct bootfs_vnode *dir)
{ {
if(dir->stream.type != STREAM_TYPE_DIR) if(dir->stream.type != STREAM_TYPE_DIR)
return false; return false;
return !dir->stream.u.dir.dir_head; return !dir->stream.u.dir.dir_head;
} }
*/
/** Creates a path of vnodes up to the last part of the passed in path. /** 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) bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
{ {
int i; int i;
@@ -384,12 +386,12 @@ bootfs_create_vnode_tree(struct bootfs *fs, struct bootfs_vnode *root)
// #pragma mark - // #pragma mark -
static int 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_cookie *_fs, vnode_id *root_vnid)
{ {
struct bootfs *fs; struct bootfs *fs;
struct bootfs_vnode *v; struct bootfs_vnode *v;
int err; status_t err;
TRACE(("bootfs_mount: entry\n")); TRACE(("bootfs_mount: entry\n"));
@@ -454,7 +456,7 @@ err:
} }
static int static status_t
bootfs_unmount(fs_cookie _fs) bootfs_unmount(fs_cookie _fs)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
@@ -478,7 +480,7 @@ bootfs_unmount(fs_cookie _fs)
} }
static int static status_t
bootfs_sync(fs_cookie fs) bootfs_sync(fs_cookie fs)
{ {
TRACE(("bootfs_sync: entry\n")); 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) bootfs_lookup(fs_cookie _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;
struct bootfs_vnode *vnode, *vdummy; struct bootfs_vnode *vnode, *vdummy;
int status; status_t status;
TRACE(("bootfs_lookup: entry dir %p, name '%s'\n", dir, name)); 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) bootfs_get_vnode_name(fs_cookie _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;
@@ -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) bootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *v, bool r)
{ {
struct bootfs *fs = (struct bootfs *)_fs; struct bootfs *fs = (struct bootfs *)_fs;
int err;
TRACE(("bootfs_get_vnode: asking for vnode 0x%Lx, r %d\n", id, r)); 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) bootfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool r)
{ {
struct bootfs_vnode *v = (struct bootfs_vnode *)_v; 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) bootfs_remove_vnode(fs_cookie _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;
struct bootfs_vnode dummy; struct bootfs_vnode dummy;
int err; status_t err;
TRACE(("bootfs_remove_vnode: remove %p (0x%Lx) r %d\n", v, v->id, reenter)); 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) bootfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static int static status_t
bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) bootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie)
{ {
struct bootfs *fs = _fs; 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) bootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
struct bootfs *fs = _fs; 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) bootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
struct bootfs *fs = _fs; 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) bootfs_fsync(fs_cookie _fs, fs_vnode _v)
{ {
return 0; 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 *fs = _fs;
struct bootfs_vnode *v = _v; struct bootfs_vnode *v = _v;
struct bootfs_cookie *cookie = _cookie; 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)); 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) bootfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static int static status_t
bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) bootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
struct bootfs_vnode *vnode = _v; struct bootfs_vnode *vnode = _v;
struct bootfs_cookie *cookie; struct bootfs_cookie *cookie;
int status = 0; status_t status = 0;
TRACE(("bootfs_open_dir: vnode %p\n", vnode)); 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) 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; 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) bootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
{ {
struct bootfs *fs = _fs; 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) 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)); 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) bootfs_can_page(fs_cookie _fs, fs_vnode _v)
{ {
struct bootfs_vnode *v = _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) bootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name)
{ {
return EROFS; return EROFS;
} }
static int static status_t
bootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname) bootfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{ {
return EROFS; return EROFS;
} }
static int static status_t
bootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) bootfs_read_stat(fs_cookie _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;
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)); 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) bootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
struct bootfs *fs = _fs; struct bootfs *fs = _fs;
@@ -1058,7 +1059,7 @@ static struct fs_calls bootfs_calls = {
}; };
int status_t
bootstrap_bootfs(void) bootstrap_bootfs(void)
{ {
region_id rid; region_id rid;
+36 -34
View File
@@ -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) 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 // 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) devfs_insert_in_dir(struct devfs_vnode *dir, struct devfs_vnode *v)
{ {
if (dir->stream.type != STREAM_TYPE_DIR) 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) devfs_remove_from_dir(struct devfs_vnode *dir, struct devfs_vnode *findit)
{ {
struct devfs_vnode *v; 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) devfs_is_dir_empty(struct devfs_vnode *dir)
{ {
if (dir->stream.type != STREAM_TYPE_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; return !dir->stream.u.dir.dir_head;
} }
*/
static int static status_t
devfs_get_partition_info( struct devfs *fs, struct devfs_vnode *v, devfs_get_partition_info( struct devfs *fs, struct devfs_vnode *v,
struct devfs_cookie *cookie, void *buf, size_t len) 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, devfs_set_partition( struct devfs *fs, struct devfs_vnode *v,
struct devfs_cookie *cookie, void *buf, size_t len) struct devfs_cookie *cookie, void *buf, size_t len)
{ {
@@ -403,12 +405,12 @@ err2:
// #pragma mark - // #pragma mark -
static int 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_cookie *_fs, vnode_id *root_vnid)
{ {
struct devfs *fs; struct devfs *fs;
struct devfs_vnode *v; struct devfs_vnode *v;
int err; status_t err;
TRACE(("devfs_mount: entry\n")); TRACE(("devfs_mount: entry\n"));
@@ -476,7 +478,7 @@ err:
} }
static int static status_t
devfs_unmount(fs_cookie _fs) devfs_unmount(fs_cookie _fs)
{ {
struct devfs *fs = _fs; struct devfs *fs = _fs;
@@ -500,7 +502,7 @@ devfs_unmount(fs_cookie _fs)
} }
static int static status_t
devfs_sync(fs_cookie fs) devfs_sync(fs_cookie fs)
{ {
TRACE(("devfs_sync: entry\n")); 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) devfs_lookup(fs_cookie _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;
struct devfs_vnode *vnode, *vdummy; struct devfs_vnode *vnode, *vdummy;
int err; status_t err;
TRACE(("devfs_lookup: entry dir %p, name '%s'\n", dir, name)); 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) devfs_get_vnode_name(fs_cookie _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;
@@ -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) devfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
{ {
struct devfs *fs = (struct devfs *)_fs; 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) devfs_put_vnode(fs_cookie _fs, fs_vnode _v, bool reenter)
{ {
#if DEVFS_TRACE #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) devfs_remove_vnode(fs_cookie _fs, fs_vnode _v, bool reenter)
{ {
struct devfs *fs = (struct devfs *)_fs; 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) devfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static int static status_t
devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) devfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_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;
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)); 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) devfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
struct devfs_vnode *vnode = _v; 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) devfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
struct devfs_vnode *vnode = _v; 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) devfs_fsync(fs_cookie _fs, fs_vnode _v)
{ {
return 0; 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) devfs_create_dir(fs_cookie _fs, fs_vnode _dir, const char *name, int perms, vnode_id *new_vnid)
{ {
return EROFS; return EROFS;
} }
static int static status_t
devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie) devfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
{ {
struct devfs *fs = _fs; 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) 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; 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) devfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
{ {
struct devfs *fs = _fs; 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) devfs_ioctl(fs_cookie _fs, fs_vnode _v, file_cookie _cookie, ulong op, void *buf, size_t len)
{ {
struct devfs *fs = _fs; 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) devfs_unlink(fs_cookie _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;
struct devfs_vnode *vnode; struct devfs_vnode *vnode;
int status = B_NO_ERROR; status_t status = B_NO_ERROR;
mutex_lock(&fs->lock); 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) devfs_rename(fs_cookie _fs, fs_vnode _olddir, const char *oldname, fs_vnode _newdir, const char *newname)
{ {
return EROFS; return EROFS;
} }
static int static status_t
devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat) devfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat)
{ {
struct devfs_vnode *vnode = _v; 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) devfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
#if DEVFS_TRACE #if DEVFS_TRACE
@@ -1096,7 +1098,7 @@ static struct fs_calls devfs_calls = {
}; };
int status_t
bootstrap_devfs(void) bootstrap_devfs(void)
{ {
@@ -1106,7 +1108,7 @@ bootstrap_devfs(void)
} }
int status_t
devfs_publish_device(const char *path, void *ident, device_hooks *calls) devfs_publish_device(const char *path, void *ident, device_hooks *calls)
{ {
int err = 0; int err = 0;
+38 -38
View File
@@ -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) 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 // 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) rootfs_insert_in_dir(struct rootfs_vnode *dir, struct rootfs_vnode *v)
{ {
v->dir_next = dir->stream.dir.dir_head; 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) rootfs_remove_from_dir(struct rootfs_vnode *dir, struct rootfs_vnode *findit)
{ {
struct rootfs_vnode *v; 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) rootfs_is_dir_empty(struct rootfs_vnode *dir)
{ {
return !dir->stream.dir.dir_head; 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) rootfs_remove(struct rootfs *fs, struct rootfs_vnode *dir, const char *name, bool isDirectory)
{ {
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
int status = B_OK; status_t status = B_OK;
mutex_lock(&fs->lock); mutex_lock(&fs->lock);
@@ -260,12 +260,12 @@ err:
// #pragma mark - // #pragma mark -
static int 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_cookie *_fs, vnode_id *root_vnid)
{ {
struct rootfs *fs; struct rootfs *fs;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
int err; status_t err;
TRACE(("rootfs_mount: entry\n")); TRACE(("rootfs_mount: entry\n"));
@@ -325,7 +325,7 @@ err1:
} }
static int static status_t
rootfs_unmount(fs_cookie _fs) rootfs_unmount(fs_cookie _fs)
{ {
struct rootfs *fs = (struct rootfs *)_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) rootfs_sync(fs_cookie fs)
{ {
TRACE(("rootfs_sync: entry\n")); 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) rootfs_lookup(fs_cookie _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;
struct rootfs_vnode *vnode,*vdummy; struct rootfs_vnode *vnode,*vdummy;
struct rootfs_vnode *v1; struct rootfs_vnode *v1;
int status; status_t status;
TRACE(("rootfs_lookup: entry dir %p, name '%s'\n", dir, name)); TRACE(("rootfs_lookup: entry dir %p, name '%s'\n", dir, name));
if (dir->stream.type != STREAM_TYPE_DIR) 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) rootfs_get_vnode_name(fs_cookie _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;
@@ -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) rootfs_get_vnode(fs_cookie _fs, vnode_id id, fs_vnode *_vnode, bool reenter)
{ {
struct rootfs *fs = (struct rootfs *)_fs; 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) rootfs_put_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter)
{ {
#if ROOTFS_TRACE #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) rootfs_remove_vnode(fs_cookie _fs, fs_vnode _vnode, bool reenter)
{ {
struct rootfs *fs = (struct rootfs *)_fs; 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) rootfs_create(fs_cookie _fs, fs_vnode _dir, const char *name, int omode, int perms, file_cookie *_cookie, vnode_id *new_vnid)
{ {
return EINVAL; return EINVAL;
} }
static int static status_t
rootfs_open(fs_cookie _fs, fs_vnode _v, int oflags, file_cookie *_cookie) 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 // 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) rootfs_close(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
#if ROOTFS_TRACE #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) rootfs_free_cookie(fs_cookie _fs, fs_vnode _v, file_cookie _cookie)
{ {
struct rootfs_cookie *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) rootfs_fsync(fs_cookie _fs, fs_vnode _v)
{ {
return 0; 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) rootfs_create_dir(fs_cookie _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;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
bool created_vnode = false; 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)); 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) rootfs_remove_dir(fs_cookie _fs, fs_vnode _dir, const char *name)
{ {
struct rootfs *fs = _fs; 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) rootfs_open_dir(fs_cookie _fs, fs_vnode _v, file_cookie *_cookie)
{ {
struct rootfs *fs = (struct rootfs *)_fs; 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) 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; 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) rootfs_rewind_dir(fs_cookie _fs, fs_vnode _vnode, file_cookie _cookie)
{ {
struct rootfs *fs = _fs; 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) 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)); 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) rootfs_can_page(fs_cookie _fs, fs_vnode _v)
{ {
return -1; 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) rootfs_read_link(fs_cookie _fs, fs_vnode _link, char *buffer, size_t bufferSize)
{ {
struct rootfs *fs = _fs; 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) rootfs_symlink(fs_cookie _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;
struct rootfs_vnode *vnode; struct rootfs_vnode *vnode;
bool created_vnode = false; bool created_vnode = false;
int status = 0; status_t status = 0;
TRACE(("rootfs_symlink: dir %p, name = '%s', path = %s\n", dir, name, path)); 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) rootfs_unlink(fs_cookie _fs, fs_vnode _dir, const char *name)
{ {
struct rootfs *fs = _fs; 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) rootfs_rename(fs_cookie _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;
struct rootfs_vnode *newdir = _newdir; struct rootfs_vnode *newdir = _newdir;
struct rootfs_vnode *v1, *v2; 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", TRACE(("rootfs_rename: olddir %p (0x%Lx), oldname '%s', newdir %p (0x%Lx), newname '%s'\n",
olddir, olddir->id, oldname, newdir, newdir->id, newname)); 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) rootfs_read_stat(fs_cookie _fs, fs_vnode _v, struct stat *stat)
{ {
struct rootfs_vnode *vnode = _v; 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) rootfs_write_stat(fs_cookie _fs, fs_vnode _v, const struct stat *stat, int stat_mask)
{ {
#if ROOTFS_TRACE #if ROOTFS_TRACE
@@ -968,7 +968,7 @@ static struct fs_calls rootfs_calls = {
}; };
int status_t
bootstrap_rootfs(void) bootstrap_rootfs(void)
{ {
dprintf("bootstrap_rootfs: entry\n"); dprintf("bootstrap_rootfs: entry\n");
+2 -2
View File
@@ -73,7 +73,7 @@ struct vnode {
fs_vnode private_node; fs_vnode private_node;
struct fs_mount *mount; struct fs_mount *mount;
struct vnode *covered_by; struct vnode *covered_by;
int ref_count; int32 ref_count;
bool delete_me; bool delete_me;
bool busy; bool busy;
}; };
@@ -1039,7 +1039,7 @@ vfs_get_cache_ptr(void *vnode)
int int
vfs_set_cache_ptr(void *vnode, void *cache) 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 0;
return -1; return -1;
+3 -3
View File
@@ -113,7 +113,7 @@ status_t acquire_sem(sem_id sem)
{ return sys_acquire_sem(sem); } { return sys_acquire_sem(sem); }
// Have to modify flags ??? // 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); } { return sys_acquire_sem_etc(sem, count, flags, timeout); }
// OK // OK
@@ -121,7 +121,7 @@ status_t release_sem(sem_id sem)
{ return sys_release_sem(sem); } { return sys_release_sem(sem); }
// Have to modify flags ??? // 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); } { return sys_release_sem_etc(sem, count, flags); }
// OK // 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); } { return sys_get_sem_info(sem,info, size); }
// OK // 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); } { return sys_get_next_sem_info(team,cookie,info, size); }
// TO DO // TO DO