Linux Audio

Check our new training course

Loading...
v6.9.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef __UM_FS_HOSTFS
  3#define __UM_FS_HOSTFS
  4
  5#include <os.h>
  6
  7/*
  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.
 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/* This one is unused by hostfs. */
 23#define HOSTFS_ATTR_FORCE	512	/* Not a change, but a change it */
 24#define HOSTFS_ATTR_ATTR_FLAG	1024
 25
 26/*
 27 * If you are very careful, you'll notice that these two are missing:
 28 *
 29 * #define ATTR_KILL_SUID	2048
 30 * #define ATTR_KILL_SGID	4096
 31 *
 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
 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 */
 40struct hostfs_timespec {
 41	long long tv_sec;
 42	long long tv_nsec;
 43};
 44
 45struct hostfs_iattr {
 46	unsigned int		ia_valid;
 47	unsigned short		ia_mode;
 48	uid_t			ia_uid;
 49	gid_t			ia_gid;
 50	loff_t			ia_size;
 51	struct hostfs_timespec	ia_atime;
 52	struct hostfs_timespec	ia_mtime;
 53	struct hostfs_timespec	ia_ctime;
 54};
 55
 56struct hostfs_stat {
 57	unsigned long long ino;
 58	unsigned int mode;
 59	unsigned int nlink;
 60	unsigned int uid;
 61	unsigned int gid;
 62	unsigned long long size;
 63	struct hostfs_timespec atime, mtime, ctime;
 64	unsigned int blksize;
 65	unsigned long long blocks;
 66	unsigned int maj;
 67	unsigned int min;
 68	dev_t dev;
 69};
 70
 71extern int stat_file(const char *path, struct hostfs_stat *p, int fd);
 72extern int access_file(char *path, int r, int w, int x);
 73extern int open_file(char *path, int r, int w, int append);
 74extern void *open_dir(char *path, int *err_out);
 75extern void seek_dir(void *stream, unsigned long long pos);
 76extern char *read_dir(void *stream, unsigned long long *pos_out,
 77		      unsigned long long *ino_out, int *len_out,
 78		      unsigned int *type_out);
 79extern void close_file(void *stream);
 80extern int replace_file(int oldfd, int fd);
 81extern void close_dir(void *stream);
 82extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
 83extern int write_file(int fd, unsigned long long *offset, const char *buf,
 84		      int len);
 85extern int lseek_file(int fd, long long offset, int whence);
 86extern int fsync_file(int fd, int datasync);
 87extern int file_create(char *name, int mode);
 
 88extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd);
 89extern int make_symlink(const char *from, const char *to);
 90extern int unlink_file(const char *file);
 91extern int do_mkdir(const char *file, int mode);
 92extern int hostfs_do_rmdir(const char *file);
 93extern int do_mknod(const char *file, int mode, unsigned int major,
 94		    unsigned int minor);
 95extern int link_file(const char *to, const char *from);
 96extern int hostfs_do_readlink(char *file, char *buf, int size);
 97extern int rename_file(char *from, char *to);
 98extern int rename2_file(char *from, char *to, unsigned int flags);
 99extern int do_statfs(char *root, long *bsize_out, long long *blocks_out,
100		     long long *bfree_out, long long *bavail_out,
101		     long long *files_out, long long *ffree_out,
102		     void *fsid_out, int fsid_size, long *namelen_out);
103
104#endif
v3.1
 
 1#ifndef __UM_FS_HOSTFS
 2#define __UM_FS_HOSTFS
 3
 4#include "os.h"
 5
 6/*
 7 * These are exactly the same definitions as in fs.h, but the names are
 8 * changed so that this file can be included in both kernel and user files.
 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/* These two are unused by hostfs. */
22#define HOSTFS_ATTR_FORCE	512	/* Not a change, but a change it */
23#define HOSTFS_ATTR_ATTR_FLAG	1024
24
25/*
26 * If you are very careful, you'll notice that these two are missing:
27 *
28 * #define ATTR_KILL_SUID	2048
29 * #define ATTR_KILL_SGID	4096
30 *
31 * and this is because they were added in 2.5 development.
32 * Actually, they are not needed by most ->setattr() methods - they are set by
33 * callers of notify_change() to notify that the setuid/setgid bits must be
34 * dropped.
35 * notify_change() will delete those flags, make sure attr->ia_valid & ATTR_MODE
36 * is on, and remove the appropriate bits from attr->ia_mode (attr is a
37 * "struct iattr *"). -BlaisorBlade
38 */
 
 
 
 
39
40struct hostfs_iattr {
41	unsigned int	ia_valid;
42	mode_t		ia_mode;
43	uid_t		ia_uid;
44	gid_t		ia_gid;
45	loff_t		ia_size;
46	struct timespec	ia_atime;
47	struct timespec	ia_mtime;
48	struct timespec	ia_ctime;
49};
50
51struct hostfs_stat {
52	unsigned long long ino;
53	unsigned int mode;
54	unsigned int nlink;
55	unsigned int uid;
56	unsigned int gid;
57	unsigned long long size;
58	struct timespec atime, mtime, ctime;
59	unsigned int blksize;
60	unsigned long long blocks;
61	unsigned int maj;
62	unsigned int min;
 
63};
64
65extern int stat_file(const char *path, struct hostfs_stat *p, int fd);
66extern int access_file(char *path, int r, int w, int x);
67extern int open_file(char *path, int r, int w, int append);
68extern void *open_dir(char *path, int *err_out);
69extern char *read_dir(void *stream, unsigned long long *pos,
70		      unsigned long long *ino_out, int *len_out);
 
 
71extern void close_file(void *stream);
72extern int replace_file(int oldfd, int fd);
73extern void close_dir(void *stream);
74extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
75extern int write_file(int fd, unsigned long long *offset, const char *buf,
76		      int len);
77extern int lseek_file(int fd, long long offset, int whence);
78extern int fsync_file(int fd, int datasync);
79extern int file_create(char *name, int ur, int uw, int ux, int gr,
80		       int gw, int gx, int or, int ow, int ox);
81extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd);
82extern int make_symlink(const char *from, const char *to);
83extern int unlink_file(const char *file);
84extern int do_mkdir(const char *file, int mode);
85extern int do_rmdir(const char *file);
86extern int do_mknod(const char *file, int mode, unsigned int major,
87		    unsigned int minor);
88extern int link_file(const char *from, const char *to);
89extern int hostfs_do_readlink(char *file, char *buf, int size);
90extern int rename_file(char *from, char *to);
 
91extern int do_statfs(char *root, long *bsize_out, long long *blocks_out,
92		     long long *bfree_out, long long *bavail_out,
93		     long long *files_out, long long *ffree_out,
94		     void *fsid_out, int fsid_size, long *namelen_out);
95
96#endif