xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h (revision c77f643a2b3f3990e6f355d6c333537b9cbfd88f)
1 // kernel_emu.h
2 
3 #include <stdarg.h>
4 
5 #include <OS.h>
6 
7 #include "FSCapabilities.h"
8 
9 
10 struct selectsync;
11 struct file_io_vec;
12 
13 namespace UserlandFS {
14 namespace KernelEmu {
15 
16 int new_path(const char *path, char **copy);
17 void free_path(char *p);
18 
19 status_t notify_listener(int32 operation, uint32 details, dev_t device,
20 	ino_t oldDirectory, ino_t directory, ino_t node,
21 	const char* oldName, const char* name);
22 status_t notify_select_event(selectsync *sync, uint8 event,
23 	bool unspecifiedEvent);
24 status_t notify_query(port_id port, int32 token, int32 operation,
25 	dev_t device, ino_t directory, const char* name, ino_t node);
26 
27 status_t get_vnode(dev_t nsid, ino_t vnid, void** node);
28 status_t put_vnode(dev_t nsid, ino_t vnid);
29 status_t acquire_vnode(dev_t nsid, ino_t vnodeID);
30 status_t new_vnode(dev_t nsid, ino_t vnid, void* data,
31 	const FSVNodeCapabilities& capabilities);
32 status_t publish_vnode(dev_t nsid, ino_t vnid, void* data, int type,
33 	uint32 flags, const FSVNodeCapabilities& capabilities);
34 status_t publish_vnode(dev_t nsid, ino_t vnid, void* data,
35 	const FSVNodeCapabilities& capabilities);
36 status_t remove_vnode(dev_t nsid, ino_t vnid);
37 status_t unremove_vnode(dev_t nsid, ino_t vnid);
38 status_t get_vnode_removed(dev_t nsid, ino_t vnid, bool* removed);
39 
40 status_t file_cache_create(dev_t mountID, ino_t vnodeID, off_t size);
41 status_t file_cache_delete(dev_t mountID, ino_t vnodeID);
42 status_t file_cache_set_enabled(dev_t mountID, ino_t vnodeID, bool enabled);
43 status_t file_cache_set_size(dev_t mountID, ino_t vnodeID, off_t size);
44 status_t file_cache_sync(dev_t mountID, ino_t vnodeID);
45 
46 status_t file_cache_read(dev_t mountID, ino_t vnodeID, void *cookie,
47 	off_t offset, void *bufferBase, size_t *_size);
48 status_t file_cache_write(dev_t mountID, ino_t vnodeID, void *cookie,
49 	off_t offset, const void *buffer, size_t *_size);
50 
51 status_t do_iterative_fd_io(dev_t volumeID, int fd, int32 requestID,
52 	void* cookie, const file_io_vec* vecs, uint32 vecCount);
53 status_t read_from_io_request(dev_t volumeID, int32 requestID, void* buffer,
54 	size_t size);
55 status_t write_to_io_request(dev_t volumeID, int32 requestID, const void* buffer,
56 	size_t size);
57 status_t notify_io_request(dev_t volumeID, int32 requestID, status_t status);
58 
59 status_t add_node_listener(dev_t device, ino_t node, uint32 flags,
60 	void* listener);
61 status_t remove_node_listener(dev_t device, ino_t node, void* listener);
62 
63 void kernel_debugger(const char *message);
64 void vpanic(const char *format, va_list args);
65 void panic(const char *format, ...) __attribute__ ((format (__printf__, 1, 2)));
66 
67 void vdprintf(const char *format, va_list args);
68 void dprintf(const char *format, ...)
69 	__attribute__ ((format (__printf__, 1, 2)));
70 
71 void dump_block(const char *buffer, int size, const char *prefix);
72 
73 int add_debugger_command(char *name, int (*func)(int argc, char **argv),
74 	char *help);
75 int remove_debugger_command(char *name, int (*func)(int argc, char **argv));
76 uint32 parse_expression(const char *string);
77 
78 thread_id spawn_kernel_thread(thread_entry function, const char *threadName,
79 	long priority, void *arg);
80 
81 
82 }	// namespace KernelEmu
83 }	// namespace UserlandFS
84 
85