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