1#ifndef __UM_FS_HOSTFS
2#define __UM_FS_HOSTFS
3
4#include "os.h"
5
6
7
8
9
10
11#define HOSTFS_ATTR_MODE 1
12#define HOSTFS_ATTR_UID 2
13#define HOSTFS_ATTR_GID 4
14#define HOSTFS_ATTR_SIZE 8
15#define HOSTFS_ATTR_ATIME 16
16#define HOSTFS_ATTR_MTIME 32
17#define HOSTFS_ATTR_CTIME 64
18#define HOSTFS_ATTR_ATIME_SET 128
19#define HOSTFS_ATTR_MTIME_SET 256
20
21
22#define HOSTFS_ATTR_FORCE 512
23#define HOSTFS_ATTR_ATTR_FLAG 1024
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45struct hostfs_iattr {
46 unsigned int ia_valid;
47 mode_t ia_mode;
48 uid_t ia_uid;
49 gid_t ia_gid;
50 loff_t ia_size;
51 struct timespec ia_atime;
52 struct timespec ia_mtime;
53 struct timespec ia_ctime;
54};
55
56extern int stat_file(const char *path, unsigned long long *inode_out,
57 int *mode_out, int *nlink_out, int *uid_out, int *gid_out,
58 unsigned long long *size_out, struct timespec *atime_out,
59 struct timespec *mtime_out, struct timespec *ctime_out,
60 int *blksize_out, unsigned long long *blocks_out, int fd);
61extern int access_file(char *path, int r, int w, int x);
62extern int open_file(char *path, int r, int w, int append);
63extern int file_type(const char *path, int *maj, int *min);
64extern void *open_dir(char *path, int *err_out);
65extern char *read_dir(void *stream, unsigned long long *pos,
66 unsigned long long *ino_out, int *len_out);
67extern void close_file(void *stream);
68extern void close_dir(void *stream);
69extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
70extern int write_file(int fd, unsigned long long *offset, const char *buf,
71 int len);
72extern int lseek_file(int fd, long long offset, int whence);
73extern int fsync_file(int fd, int datasync);
74extern int file_create(char *name, int ur, int uw, int ux, int gr,
75 int gw, int gx, int or, int ow, int ox);
76extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd);
77extern int make_symlink(const char *from, const char *to);
78extern int unlink_file(const char *file);
79extern int do_mkdir(const char *file, int mode);
80extern int do_rmdir(const char *file);
81extern int do_mknod(const char *file, int mode, unsigned int major,
82 unsigned int minor);
83extern int link_file(const char *from, const char *to);
84extern int hostfs_do_readlink(char *file, char *buf, int size);
85extern int rename_file(char *from, char *to);
86extern int do_statfs(char *root, long *bsize_out, long long *blocks_out,
87 long long *bfree_out, long long *bavail_out,
88 long long *files_out, long long *ffree_out,
89 void *fsid_out, int fsid_size, long *namelen_out,
90 long *spare_out);
91
92#endif
93