| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __UM_FS_HOSTFS | 
 | 2 | #define __UM_FS_HOSTFS | 
 | 3 |  | 
 | 4 | #include "os.h" | 
 | 5 |  | 
| Jeff Dike | 84b3db0 | 2007-10-16 01:27:13 -0700 | [diff] [blame] | 6 | /* | 
 | 7 |  * These are exactly the same definitions as in fs.h, but the names are | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Jeff Dike | 84b3db0 | 2007-10-16 01:27:13 -0700 | [diff] [blame] | 25 | /* | 
 | 26 |  * If you are very careful, you'll notice that these two are missing: | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 in this patch: | 
 | 32 |  * | 
 | 33 |  * http://linux.bkbits.net:8080/linux-2.5/ | 
 | 34 |  * cset@3caf4a12k4XgDzK7wyK-TGpSZ9u2Ww?nav=index.html | 
 | 35 |  * |src/.|src/include|src/include/linux|related/include/linux/fs.h | 
 | 36 |  * | 
 | 37 |  * Actually, they are not needed by most ->setattr() methods - they are set by | 
 | 38 |  * callers of notify_change() to notify that the setuid/setgid bits must be | 
 | 39 |  * dropped. | 
 | 40 |  * notify_change() will delete those flags, make sure attr->ia_valid & ATTR_MODE | 
 | 41 |  * is on, and remove the appropriate bits from attr->ia_mode (attr is a | 
 | 42 |  * "struct iattr *"). -BlaisorBlade | 
 | 43 |  */ | 
 | 44 |  | 
 | 45 | struct 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; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | }; | 
 | 55 |  | 
 | 56 | extern 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, | 
| Alberto Bertogli | 5822b7f | 2007-05-08 00:23:16 -0700 | [diff] [blame] | 60 | 		     int *blksize_out, unsigned long long *blocks_out, int fd); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | extern int access_file(char *path, int r, int w, int x); | 
 | 62 | extern int open_file(char *path, int r, int w, int append); | 
 | 63 | extern int file_type(const char *path, int *maj, int *min); | 
 | 64 | extern void *open_dir(char *path, int *err_out); | 
 | 65 | extern char *read_dir(void *stream, unsigned long long *pos, | 
 | 66 | 		      unsigned long long *ino_out, int *len_out); | 
 | 67 | extern void close_file(void *stream); | 
 | 68 | extern void close_dir(void *stream); | 
 | 69 | extern int read_file(int fd, unsigned long long *offset, char *buf, int len); | 
 | 70 | extern int write_file(int fd, unsigned long long *offset, const char *buf, | 
 | 71 | 		      int len); | 
 | 72 | extern int lseek_file(int fd, long long offset, int whence); | 
| Paolo 'Blaisorblade' Giarrusso | a2d76bd | 2005-07-28 21:16:15 -0700 | [diff] [blame] | 73 | extern int fsync_file(int fd, int datasync); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | extern int file_create(char *name, int ur, int uw, int ux, int gr, | 
 | 75 | 		       int gw, int gx, int or, int ow, int ox); | 
| Alberto Bertogli | 5822b7f | 2007-05-08 00:23:16 -0700 | [diff] [blame] | 76 | extern int set_attr(const char *file, struct hostfs_iattr *attrs, int fd); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | extern int make_symlink(const char *from, const char *to); | 
 | 78 | extern int unlink_file(const char *file); | 
 | 79 | extern int do_mkdir(const char *file, int mode); | 
 | 80 | extern int do_rmdir(const char *file); | 
| Jeff Dike | 84b3db0 | 2007-10-16 01:27:13 -0700 | [diff] [blame] | 81 | extern int do_mknod(const char *file, int mode, unsigned int major, | 
 | 82 | 		    unsigned int minor); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | extern int link_file(const char *from, const char *to); | 
 | 84 | extern int do_readlink(char *file, char *buf, int size); | 
 | 85 | extern int rename_file(char *from, char *to); | 
 | 86 | extern 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 |