1 /* SPDX-License-Identifier: GPL-2.0 */
8 * These are exactly the same definitions as in fs.h, but the names are
9 * changed so that this file can be included in both kernel and user files.
12 #define HOSTFS_ATTR_MODE 1
13 #define HOSTFS_ATTR_UID 2
14 #define HOSTFS_ATTR_GID 4
15 #define HOSTFS_ATTR_SIZE 8
16 #define HOSTFS_ATTR_ATIME 16
17 #define HOSTFS_ATTR_MTIME 32
18 #define HOSTFS_ATTR_CTIME 64
19 #define HOSTFS_ATTR_ATIME_SET 128
20 #define HOSTFS_ATTR_MTIME_SET 256
22 /* These two are unused by hostfs. */
23 #define HOSTFS_ATTR_FORCE 512 /* Not a change, but a change it */
24 #define HOSTFS_ATTR_ATTR_FLAG 1024
27 * If you are very careful, you'll notice that these two are missing:
29 * #define ATTR_KILL_SUID 2048
30 * #define ATTR_KILL_SGID 4096
32 * and this is because they were added in 2.5 development.
33 * Actually, they are not needed by most ->setattr() methods - they are set by
34 * callers of notify_change() to notify that the setuid/setgid bits must be
36 * notify_change() will delete those flags, make sure attr->ia_valid & ATTR_MODE
37 * is on, and remove the appropriate bits from attr->ia_mode (attr is a
38 * "struct iattr *"). -BlaisorBlade
42 unsigned int ia_valid
;
43 unsigned short ia_mode
;
47 struct timespec ia_atime
;
48 struct timespec ia_mtime
;
49 struct timespec ia_ctime
;
53 unsigned long long ino
;
58 unsigned long long size
;
59 struct timespec atime
, mtime
, ctime
;
61 unsigned long long blocks
;
66 extern int stat_file(const char *path
, struct hostfs_stat
*p
, int fd
);
67 extern int access_file(char *path
, int r
, int w
, int x
);
68 extern int open_file(char *path
, int r
, int w
, int append
);
69 extern void *open_dir(char *path
, int *err_out
);
70 extern void seek_dir(void *stream
, unsigned long long pos
);
71 extern char *read_dir(void *stream
, unsigned long long *pos_out
,
72 unsigned long long *ino_out
, int *len_out
,
73 unsigned int *type_out
);
74 extern void close_file(void *stream
);
75 extern int replace_file(int oldfd
, int fd
);
76 extern void close_dir(void *stream
);
77 extern int read_file(int fd
, unsigned long long *offset
, char *buf
, int len
);
78 extern int write_file(int fd
, unsigned long long *offset
, const char *buf
,
80 extern int lseek_file(int fd
, long long offset
, int whence
);
81 extern int fsync_file(int fd
, int datasync
);
82 extern int file_create(char *name
, int mode
);
83 extern int set_attr(const char *file
, struct hostfs_iattr
*attrs
, int fd
);
84 extern int make_symlink(const char *from
, const char *to
);
85 extern int unlink_file(const char *file
);
86 extern int do_mkdir(const char *file
, int mode
);
87 extern int do_rmdir(const char *file
);
88 extern int do_mknod(const char *file
, int mode
, unsigned int major
,
90 extern int link_file(const char *from
, const char *to
);
91 extern int hostfs_do_readlink(char *file
, char *buf
, int size
);
92 extern int rename_file(char *from
, char *to
);
93 extern int rename2_file(char *from
, char *to
, unsigned int flags
);
94 extern int do_statfs(char *root
, long *bsize_out
, long long *blocks_out
,
95 long long *bfree_out
, long long *bavail_out
,
96 long long *files_out
, long long *ffree_out
,
97 void *fsid_out
, int fsid_size
, long *namelen_out
);