at master 2.5 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __UM_FS_HOSTFS 3#define __UM_FS_HOSTFS 4 5#include <os.h> 6#include <generated/asm-offsets.h> 7 8struct hostfs_timespec { 9 long long tv_sec; 10 long long tv_nsec; 11}; 12 13struct hostfs_iattr { 14 unsigned int ia_valid; 15 unsigned short ia_mode; 16 uid_t ia_uid; 17 gid_t ia_gid; 18 loff_t ia_size; 19 struct hostfs_timespec ia_atime; 20 struct hostfs_timespec ia_mtime; 21 struct hostfs_timespec ia_ctime; 22}; 23 24struct hostfs_stat { 25 unsigned long long ino; 26 unsigned int mode; 27 unsigned int nlink; 28 unsigned int uid; 29 unsigned int gid; 30 unsigned long long size; 31 struct hostfs_timespec atime, mtime, ctime, btime; 32 unsigned int blksize; 33 unsigned long long blocks; 34 struct { 35 unsigned int maj; 36 unsigned int min; 37 } rdev, dev; 38}; 39 40extern int stat_file(const char *path, struct hostfs_stat *p, int fd); 41extern int access_file(char *path, int r, int w, int x); 42extern int open_file(char *path, int r, int w, int append); 43extern void *open_dir(char *path, int *err_out); 44extern void seek_dir(void *stream, unsigned long long pos); 45extern char *read_dir(void *stream, unsigned long long *pos_out, 46 unsigned long long *ino_out, int *len_out, 47 unsigned int *type_out); 48extern void close_file(void *stream); 49extern int replace_file(int oldfd, int fd); 50extern void close_dir(void *stream); 51extern int read_file(int fd, unsigned long long *offset, char *buf, int len); 52extern int write_file(int fd, unsigned long long *offset, const char *buf, 53 int len); 54extern int lseek_file(int fd, long long offset, int whence); 55extern int fsync_file(int fd, int datasync); 56extern int file_create(char *name, int mode); 57extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd); 58extern int make_symlink(const char *from, const char *to); 59extern int unlink_file(const char *file); 60extern int do_mkdir(const char *file, int mode); 61extern int hostfs_do_rmdir(const char *file); 62extern int do_mknod(const char *file, int mode, unsigned int major, 63 unsigned int minor); 64extern int link_file(const char *to, const char *from); 65extern int hostfs_do_readlink(char *file, char *buf, int size); 66extern int rename_file(char *from, char *to); 67extern int rename2_file(char *from, char *to, unsigned int flags); 68extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, 69 long long *bfree_out, long long *bavail_out, 70 long long *files_out, long long *ffree_out, 71 void *fsid_out, int fsid_size, long *namelen_out); 72 73#endif