xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h (revision c77f643a2b3f3990e6f355d6c333537b9cbfd88f)
1ca6faf49SIngo Weinhold // kernel_emu.h
2ca6faf49SIngo Weinhold 
3824e907aSIngo Weinhold #include <stdarg.h>
4824e907aSIngo Weinhold 
5ca6faf49SIngo Weinhold #include <OS.h>
6ca6faf49SIngo Weinhold 
74649fe05SIngo Weinhold #include "FSCapabilities.h"
84649fe05SIngo Weinhold 
94649fe05SIngo Weinhold 
10c10705cbSIngo Weinhold struct selectsync;
117c1ffcb9SIngo Weinhold struct file_io_vec;
12c10705cbSIngo Weinhold 
13ca6faf49SIngo Weinhold namespace UserlandFS {
14ca6faf49SIngo Weinhold namespace KernelEmu {
15ca6faf49SIngo Weinhold 
16ca6faf49SIngo Weinhold int new_path(const char *path, char **copy);
17ca6faf49SIngo Weinhold void free_path(char *p);
18ca6faf49SIngo Weinhold 
19245aecdaSAxel Dörfler status_t notify_listener(int32 operation, uint32 details, dev_t device,
20245aecdaSAxel Dörfler 	ino_t oldDirectory, ino_t directory, ino_t node,
2197dd0fe3SIngo Weinhold 	const char* oldName, const char* name);
22636bfc08SIngo Weinhold status_t notify_select_event(selectsync *sync, uint8 event,
2397dd0fe3SIngo Weinhold 	bool unspecifiedEvent);
2497dd0fe3SIngo Weinhold status_t notify_query(port_id port, int32 token, int32 operation,
25245aecdaSAxel Dörfler 	dev_t device, ino_t directory, const char* name, ino_t node);
26ca6faf49SIngo Weinhold 
27cdebdeb0SIngo Weinhold status_t get_vnode(dev_t nsid, ino_t vnid, void** node);
28245aecdaSAxel Dörfler status_t put_vnode(dev_t nsid, ino_t vnid);
293594d63bSIngo Weinhold status_t acquire_vnode(dev_t nsid, ino_t vnodeID);
304649fe05SIngo Weinhold status_t new_vnode(dev_t nsid, ino_t vnid, void* data,
314649fe05SIngo Weinhold 	const FSVNodeCapabilities& capabilities);
32cdebdeb0SIngo Weinhold status_t publish_vnode(dev_t nsid, ino_t vnid, void* data, int type,
334649fe05SIngo Weinhold 	uint32 flags, const FSVNodeCapabilities& capabilities);
344649fe05SIngo Weinhold status_t publish_vnode(dev_t nsid, ino_t vnid, void* data,
354649fe05SIngo Weinhold 	const FSVNodeCapabilities& capabilities);
36245aecdaSAxel Dörfler status_t remove_vnode(dev_t nsid, ino_t vnid);
37245aecdaSAxel Dörfler status_t unremove_vnode(dev_t nsid, ino_t vnid);
38245aecdaSAxel Dörfler status_t get_vnode_removed(dev_t nsid, ino_t vnid, bool* removed);
39ca6faf49SIngo Weinhold 
407c1ffcb9SIngo Weinhold status_t file_cache_create(dev_t mountID, ino_t vnodeID, off_t size);
417c1ffcb9SIngo Weinhold status_t file_cache_delete(dev_t mountID, ino_t vnodeID);
427c1ffcb9SIngo Weinhold status_t file_cache_set_enabled(dev_t mountID, ino_t vnodeID, bool enabled);
437c1ffcb9SIngo Weinhold status_t file_cache_set_size(dev_t mountID, ino_t vnodeID, off_t size);
447c1ffcb9SIngo Weinhold status_t file_cache_sync(dev_t mountID, ino_t vnodeID);
450dcccb49SIngo Weinhold 
467c1ffcb9SIngo Weinhold status_t file_cache_read(dev_t mountID, ino_t vnodeID, void *cookie,
470dcccb49SIngo Weinhold 	off_t offset, void *bufferBase, size_t *_size);
487c1ffcb9SIngo Weinhold status_t file_cache_write(dev_t mountID, ino_t vnodeID, void *cookie,
490dcccb49SIngo Weinhold 	off_t offset, const void *buffer, size_t *_size);
500dcccb49SIngo Weinhold 
51687e02f9SIngo Weinhold status_t do_iterative_fd_io(dev_t volumeID, int fd, int32 requestID,
52687e02f9SIngo Weinhold 	void* cookie, const file_io_vec* vecs, uint32 vecCount);
538af6418bSIngo Weinhold status_t read_from_io_request(dev_t volumeID, int32 requestID, void* buffer,
548af6418bSIngo Weinhold 	size_t size);
558af6418bSIngo Weinhold status_t write_to_io_request(dev_t volumeID, int32 requestID, const void* buffer,
568af6418bSIngo Weinhold 	size_t size);
5707745f2aSIngo Weinhold status_t notify_io_request(dev_t volumeID, int32 requestID, status_t status);
587c1ffcb9SIngo Weinhold 
59*c77f643aSIngo Weinhold status_t add_node_listener(dev_t device, ino_t node, uint32 flags,
60*c77f643aSIngo Weinhold 	void* listener);
61*c77f643aSIngo Weinhold status_t remove_node_listener(dev_t device, ino_t node, void* listener);
62*c77f643aSIngo Weinhold 
63ca6faf49SIngo Weinhold void kernel_debugger(const char *message);
64824e907aSIngo Weinhold void vpanic(const char *format, va_list args);
65824e907aSIngo Weinhold void panic(const char *format, ...) __attribute__ ((format (__printf__, 1, 2)));
66824e907aSIngo Weinhold 
67824e907aSIngo Weinhold void vdprintf(const char *format, va_list args);
68824e907aSIngo Weinhold void dprintf(const char *format, ...)
69824e907aSIngo Weinhold 	__attribute__ ((format (__printf__, 1, 2)));
70824e907aSIngo Weinhold 
71824e907aSIngo Weinhold void dump_block(const char *buffer, int size, const char *prefix);
72ca6faf49SIngo Weinhold 
73ca6faf49SIngo Weinhold int add_debugger_command(char *name, int (*func)(int argc, char **argv),
74ca6faf49SIngo Weinhold 	char *help);
75ca6faf49SIngo Weinhold int remove_debugger_command(char *name, int (*func)(int argc, char **argv));
76de71c581SIngo Weinhold uint32 parse_expression(const char *string);
77ca6faf49SIngo Weinhold 
78ca6faf49SIngo Weinhold thread_id spawn_kernel_thread(thread_entry function, const char *threadName,
79ca6faf49SIngo Weinhold 	long priority, void *arg);
80ca6faf49SIngo Weinhold 
81ca6faf49SIngo Weinhold 
82ca6faf49SIngo Weinhold }	// namespace KernelEmu
83ca6faf49SIngo Weinhold }	// namespace UserlandFS
84ca6faf49SIngo Weinhold 
85