xref: /haiku/src/tools/fs_shell/syscalls.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FSSH_SYSCALLS_H
6 #define _FSSH_SYSCALLS_H
7 
8 #include "fssh_defs.h"
9 #include "fssh_os.h"
10 
11 
12 struct fssh_iovec;
13 
14 
15 namespace FSShell {
16 
17 
18 // defined in vfs.cpp
19 fssh_dev_t 		_kern_mount(const char *path, const char *device,
20 					const char *fsName, uint32_t flags, const char *args,
21 					fssh_size_t argsLength);
22 fssh_status_t	_kern_unmount(const char *path, uint32_t flags);
23 fssh_status_t 	_kern_read_fs_info(fssh_dev_t device,
24 					struct fssh_fs_info *info);
25 fssh_status_t	_kern_write_fs_info(fssh_dev_t device,
26 					const struct fssh_fs_info *info, int mask);
27 fssh_status_t	_kern_sync(void);
28 fssh_status_t	_kern_entry_ref_to_path(fssh_dev_t device, fssh_ino_t inode,
29 					const char *leaf, char *userPath, fssh_size_t pathLength);
30 fssh_dev_t		_kern_next_device(int32_t *_cookie);
31 int				_kern_open_entry_ref(fssh_dev_t device, fssh_ino_t inode,
32 					const char *name, int openMode, int perms);
33 int				_kern_open(int fd, const char *path, int openMode, int perms);
34 int				_kern_open_dir_entry_ref(fssh_dev_t device, fssh_ino_t inode,
35 					const char *name);
36 int				_kern_open_dir(int fd, const char *path);
37 fssh_status_t 	_kern_fcntl(int fd, int op, uint32_t argument);
38 fssh_status_t	_kern_fsync(int fd);
39 fssh_status_t	_kern_lock_node(int fd);
40 fssh_status_t	_kern_unlock_node(int fd);
41 fssh_status_t	_kern_create_dir_entry_ref(fssh_dev_t device, fssh_ino_t inode,
42 					const char *name, int perms);
43 fssh_status_t	_kern_create_dir(int fd, const char *path, int perms);
44 fssh_status_t	_kern_remove_dir(int fd, const char *path);
45 fssh_status_t	_kern_read_link(int fd, const char *path, char *buffer,
46 					fssh_size_t *_bufferSize);
47 fssh_status_t	_kern_create_symlink(int fd, const char *path,
48 					const char *toPath, int mode);
49 fssh_status_t	_kern_create_link(const char *path, const char *toPath);
50 fssh_status_t	_kern_unlink(int fd, const char *path);
51 fssh_status_t	_kern_rename(int oldFD, const char *oldPath, int newFD,
52 					const char *newPath);
53 fssh_status_t	_kern_access(const char *path, int mode);
54 fssh_status_t	_kern_read_stat(int fd, const char *path, bool traverseLeafLink,
55 					struct fssh_stat *stat, fssh_size_t statSize);
56 fssh_status_t	_kern_write_stat(int fd, const char *path,
57 					bool traverseLeafLink, const struct fssh_stat *stat,
58 					fssh_size_t statSize, int statMask);
59 int				_kern_open_attr_dir(int fd, const char *path);
60 int				_kern_create_attr(int fd, const char *name, uint32_t type,
61 					int openMode);
62 int				_kern_open_attr(int fd, const char *name, int openMode);
63 fssh_status_t	_kern_remove_attr(int fd, const char *name);
64 fssh_status_t	_kern_rename_attr(int fromFile, const char *fromName,
65 					int toFile, const char *toName);
66 int				_kern_open_index_dir(fssh_dev_t device);
67 fssh_status_t	_kern_create_index(fssh_dev_t device, const char *name,
68 					uint32_t type, uint32_t flags);
69 fssh_status_t	_kern_read_index_stat(fssh_dev_t device, const char *name,
70 					struct fssh_stat *stat);
71 fssh_status_t	_kern_remove_index(fssh_dev_t device, const char *name);
72 fssh_status_t	_kern_getcwd(char *buffer, fssh_size_t size);
73 fssh_status_t	_kern_setcwd(int fd, const char *path);
74 
75 fssh_status_t	_kern_initialize_volume(const char* fileSystem,
76 					const char *partition, const char *name,
77 					const char *parameters);
78 
79 extern int		_kern_open_query(fssh_dev_t device, const char* query,
80 					fssh_size_t queryLength, uint32_t flags, fssh_port_id port,
81 					int32_t token);
82 
83 // defined in fd.cpp
84 fssh_ssize_t	_kern_read(int fd, fssh_off_t pos, void *buffer,
85 					fssh_size_t length);
86 fssh_ssize_t	_kern_readv(int fd, fssh_off_t pos, const fssh_iovec *vecs,
87 					fssh_size_t count);
88 fssh_ssize_t	_kern_write(int fd, fssh_off_t pos, const void *buffer,
89 					fssh_size_t length);
90 fssh_ssize_t	_kern_writev(int fd, fssh_off_t pos, const fssh_iovec *vecs,
91 					fssh_size_t count);
92 fssh_off_t		_kern_seek(int fd, fssh_off_t pos, int seekType);
93 fssh_status_t	_kern_ioctl(int fd, uint32_t op, void *buffer,
94 					fssh_size_t length);
95 fssh_ssize_t	_kern_read_dir(int fd, struct fssh_dirent *buffer,
96 					fssh_size_t bufferSize, uint32_t maxCount);
97 fssh_status_t	_kern_rewind_dir(int fd);
98 fssh_status_t	_kern_close(int fd);
99 int				_kern_dup(int fd);
100 int				_kern_dup2(int ofd, int nfd);
101 
102 
103 }	// namespace FSShell
104 
105 
106 #endif	// _FSSH_SYSCALLS_H
107