]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/hostfs/hostfs.h
media: dvb_ca_en50221: prevent using slot_info for Spectre attacs
[mirror_ubuntu-bionic-kernel.git] / fs / hostfs / hostfs.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef __UM_FS_HOSTFS
3#define __UM_FS_HOSTFS
4
37185b33 5#include <os.h>
1da177e4 6
84b3db04
JD
7/*
8 * These are exactly the same definitions as in fs.h, but the names are
1da177e4
LT
9 * changed so that this file can be included in both kernel and user files.
10 */
11
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
21
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
25
84b3db04
JD
26/*
27 * If you are very careful, you'll notice that these two are missing:
1da177e4
LT
28 *
29 * #define ATTR_KILL_SUID 2048
30 * #define ATTR_KILL_SGID 4096
31 *
631dd1a8 32 * and this is because they were added in 2.5 development.
1da177e4
LT
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
35 * dropped.
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
39 */
40
41struct hostfs_iattr {
42 unsigned int ia_valid;
138d570d 43 unsigned short ia_mode;
1da177e4
LT
44 uid_t ia_uid;
45 gid_t ia_gid;
46 loff_t ia_size;
47 struct timespec ia_atime;
48 struct timespec ia_mtime;
49 struct timespec ia_ctime;
1da177e4
LT
50};
51
39b743c6
AV
52struct hostfs_stat {
53 unsigned long long ino;
54 unsigned int mode;
55 unsigned int nlink;
56 unsigned int uid;
57 unsigned int gid;
58 unsigned long long size;
59 struct timespec atime, mtime, ctime;
60 unsigned int blksize;
61 unsigned long long blocks;
62 unsigned int maj;
63 unsigned int min;
64};
65
66extern int stat_file(const char *path, struct hostfs_stat *p, int fd);
1da177e4
LT
67extern int access_file(char *path, int r, int w, int x);
68extern int open_file(char *path, int r, int w, int append);
1da177e4 69extern void *open_dir(char *path, int *err_out);
0c9bd636
RW
70extern void seek_dir(void *stream, unsigned long long pos);
71extern char *read_dir(void *stream, unsigned long long *pos_out,
3ee6bd8e
GU
72 unsigned long long *ino_out, int *len_out,
73 unsigned int *type_out);
1da177e4 74extern void close_file(void *stream);
f8ad850f 75extern int replace_file(int oldfd, int fd);
1da177e4
LT
76extern void close_dir(void *stream);
77extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
78extern int write_file(int fd, unsigned long long *offset, const char *buf,
79 int len);
80extern int lseek_file(int fd, long long offset, int whence);
a2d76bd8 81extern int fsync_file(int fd, int datasync);
b98b9102 82extern int file_create(char *name, int mode);
5822b7fa 83extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd);
1da177e4
LT
84extern int make_symlink(const char *from, const char *to);
85extern int unlink_file(const char *file);
86extern int do_mkdir(const char *file, int mode);
87extern int do_rmdir(const char *file);
84b3db04
JD
88extern int do_mknod(const char *file, int mode, unsigned int major,
89 unsigned int minor);
1da177e4 90extern int link_file(const char *from, const char *to);
ea7e743e 91extern int hostfs_do_readlink(char *file, char *buf, int size);
1da177e4 92extern int rename_file(char *from, char *to);
9a423bb6 93extern int rename2_file(char *from, char *to, unsigned int flags);
1da177e4
LT
94extern 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,
1b627d57 97 void *fsid_out, int fsid_size, long *namelen_out);
1da177e4
LT
98
99#endif