Added kernel private node_monitor.h header.
Moved definition of "struct io_context" from fd.h to vfs.h. Introduced new fs/ directory; some cleanups to come. Added node monitor syscalls. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2479 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fc3cda204e
commit
f9bdcca59c
@ -10,22 +10,9 @@
|
||||
#include <atomic.h>
|
||||
#include <memheap.h>
|
||||
#include <sys/stat.h>
|
||||
//#include <list.h>
|
||||
|
||||
|
||||
struct file_descriptor;
|
||||
struct select_sync;
|
||||
struct fs_mount;
|
||||
struct vnode;
|
||||
|
||||
/** The I/O context of a process/team, holds the fd array */
|
||||
struct io_context {
|
||||
struct vnode *cwd;
|
||||
mutex io_mutex;
|
||||
int table_size;
|
||||
int num_used_fds;
|
||||
struct file_descriptor **fds;
|
||||
};
|
||||
|
||||
struct fd_ops {
|
||||
ssize_t (*fd_read) (struct file_descriptor *, off_t pos, void *buffer, size_t *length);
|
||||
ssize_t (*fd_write)(struct file_descriptor *, off_t pos, const void *buffer, size_t *length);
|
||||
|
25
headers/private/kernel/fs/node_monitor.h
Normal file
25
headers/private/kernel/fs/node_monitor.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef _KERNEL_NODE_MONITOR_H
|
||||
#define _KERNEL_NODE_MONITOR_H
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
struct io_context;
|
||||
|
||||
// private kernel API
|
||||
extern status_t remove_node_monitors(struct io_context *context);
|
||||
extern status_t node_monitor_init(void);
|
||||
|
||||
// user-space exported calls
|
||||
extern status_t user_stop_notifying(port_id port, uint32 token);
|
||||
extern status_t user_start_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
extern status_t user_stop_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
|
||||
#endif /* _KRENEL_NODE_MONITOR_H */
|
@ -127,6 +127,9 @@ enum {
|
||||
SYSCALL_UNREGISTER_IMAGE, /* 115 */
|
||||
SYSCALL_GET_IMAGE_INFO,
|
||||
SYSCALL_GET_NEXT_IMAGE_INFO,
|
||||
SYSCALL_START_WATCHING,
|
||||
SYSCALL_STOP_WATCHING,
|
||||
SYSCALL_STOP_NOTIFYING, /* 120 */
|
||||
};
|
||||
|
||||
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
|
||||
|
@ -70,6 +70,13 @@ status_t sys_unregister_image(image_id id);
|
||||
status_t sys_get_image_info(image_id id, image_info *info, size_t size);
|
||||
status_t sys_get_next_image_info(team_id team, int32 *cookie, image_info *info, size_t size);
|
||||
|
||||
// node monitor functions
|
||||
status_t sys_stop_notifying(port_id port, uint32 token);
|
||||
status_t sys_start_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
status_t sys_stop_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
|
||||
// area functions
|
||||
region_id sys_vm_create_anonymous_region(const char *name, void **address, int addr_type,
|
||||
addr size, int wiring, int lock);
|
||||
|
@ -13,19 +13,39 @@
|
||||
#include <signal.h>
|
||||
#include <dirent.h>
|
||||
#include <fs_interface.h>
|
||||
#include <lock.h>
|
||||
#include <list.h>
|
||||
|
||||
#define DEFAULT_FD_TABLE_SIZE 128
|
||||
#define MAX_FD_TABLE_SIZE 2048
|
||||
#define MAX_NODE_MONITORS 4096
|
||||
|
||||
#include <vfs_types.h>
|
||||
|
||||
|
||||
struct file_descriptor;
|
||||
struct selectsync;
|
||||
struct pollfd;
|
||||
|
||||
|
||||
/** The I/O context of a process/team, holds the fd array among others */
|
||||
typedef struct io_context {
|
||||
struct vnode *cwd;
|
||||
mutex io_mutex;
|
||||
uint32 table_size;
|
||||
uint32 num_used_fds;
|
||||
struct file_descriptor **fds;
|
||||
struct list node_monitors;
|
||||
uint32 num_monitors;
|
||||
uint32 max_monitors;
|
||||
} io_context;
|
||||
|
||||
|
||||
/* macro to allocate a iovec array on the stack */
|
||||
#define IOVECS(name, size) \
|
||||
uint8 _##name[sizeof(iovecs) + (size)*sizeof(iovec)]; \
|
||||
iovecs *name = (iovecs *)_##name
|
||||
|
||||
struct selectsync;
|
||||
struct pollfd;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
Loading…
Reference in New Issue
Block a user