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