| 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 |  | 
|  | 6 | /* These are exactly the same definitions as in fs.h, but the names are | 
|  | 7 | * changed so that this file can be included in both kernel and user files. | 
|  | 8 | */ | 
|  | 9 |  | 
|  | 10 | #define HOSTFS_ATTR_MODE	1 | 
|  | 11 | #define HOSTFS_ATTR_UID 	2 | 
|  | 12 | #define HOSTFS_ATTR_GID 	4 | 
|  | 13 | #define HOSTFS_ATTR_SIZE	8 | 
|  | 14 | #define HOSTFS_ATTR_ATIME	16 | 
|  | 15 | #define HOSTFS_ATTR_MTIME	32 | 
|  | 16 | #define HOSTFS_ATTR_CTIME	64 | 
|  | 17 | #define HOSTFS_ATTR_ATIME_SET	128 | 
|  | 18 | #define HOSTFS_ATTR_MTIME_SET	256 | 
|  | 19 |  | 
|  | 20 | /* These two are unused by hostfs. */ | 
|  | 21 | #define HOSTFS_ATTR_FORCE	512	/* Not a change, but a change it */ | 
|  | 22 | #define HOSTFS_ATTR_ATTR_FLAG	1024 | 
|  | 23 |  | 
|  | 24 | /* If you are very careful, you'll notice that these two are missing: | 
|  | 25 | * | 
|  | 26 | * #define ATTR_KILL_SUID	2048 | 
|  | 27 | * #define ATTR_KILL_SGID	4096 | 
|  | 28 | * | 
|  | 29 | * and this is because they were added in 2.5 development in this patch: | 
|  | 30 | * | 
|  | 31 | * http://linux.bkbits.net:8080/linux-2.5/ | 
|  | 32 | * cset@3caf4a12k4XgDzK7wyK-TGpSZ9u2Ww?nav=index.html | 
|  | 33 | * |src/.|src/include|src/include/linux|related/include/linux/fs.h | 
|  | 34 | * | 
|  | 35 | * Actually, they are not needed by most ->setattr() methods - they are set by | 
|  | 36 | * callers of notify_change() to notify that the setuid/setgid bits must be | 
|  | 37 | * dropped. | 
|  | 38 | * notify_change() will delete those flags, make sure attr->ia_valid & ATTR_MODE | 
|  | 39 | * is on, and remove the appropriate bits from attr->ia_mode (attr is a | 
|  | 40 | * "struct iattr *"). -BlaisorBlade | 
|  | 41 | */ | 
|  | 42 |  | 
|  | 43 | struct hostfs_iattr { | 
|  | 44 | unsigned int	ia_valid; | 
|  | 45 | mode_t		ia_mode; | 
|  | 46 | uid_t		ia_uid; | 
|  | 47 | gid_t		ia_gid; | 
|  | 48 | loff_t		ia_size; | 
|  | 49 | struct timespec	ia_atime; | 
|  | 50 | struct timespec	ia_mtime; | 
|  | 51 | struct timespec	ia_ctime; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }; | 
|  | 53 |  | 
|  | 54 | extern int stat_file(const char *path, unsigned long long *inode_out, | 
|  | 55 | int *mode_out, int *nlink_out, int *uid_out, int *gid_out, | 
|  | 56 | unsigned long long *size_out, struct timespec *atime_out, | 
|  | 57 | struct timespec *mtime_out, struct timespec *ctime_out, | 
|  | 58 | int *blksize_out, unsigned long long *blocks_out); | 
|  | 59 | extern int access_file(char *path, int r, int w, int x); | 
|  | 60 | extern int open_file(char *path, int r, int w, int append); | 
|  | 61 | extern int file_type(const char *path, int *maj, int *min); | 
|  | 62 | extern void *open_dir(char *path, int *err_out); | 
|  | 63 | extern char *read_dir(void *stream, unsigned long long *pos, | 
|  | 64 | unsigned long long *ino_out, int *len_out); | 
|  | 65 | extern void close_file(void *stream); | 
|  | 66 | extern void close_dir(void *stream); | 
|  | 67 | extern int read_file(int fd, unsigned long long *offset, char *buf, int len); | 
|  | 68 | extern int write_file(int fd, unsigned long long *offset, const char *buf, | 
|  | 69 | int len); | 
|  | 70 | extern int lseek_file(int fd, long long offset, int whence); | 
| Paolo 'Blaisorblade' Giarrusso | a2d76bd | 2005-07-28 21:16:15 -0700 | [diff] [blame] | 71 | extern int fsync_file(int fd, int datasync); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | extern int file_create(char *name, int ur, int uw, int ux, int gr, | 
|  | 73 | int gw, int gx, int or, int ow, int ox); | 
|  | 74 | extern int set_attr(const char *file, struct hostfs_iattr *attrs); | 
|  | 75 | extern int make_symlink(const char *from, const char *to); | 
|  | 76 | extern int unlink_file(const char *file); | 
|  | 77 | extern int do_mkdir(const char *file, int mode); | 
|  | 78 | extern int do_rmdir(const char *file); | 
|  | 79 | extern int do_mknod(const char *file, int mode, int dev); | 
|  | 80 | extern int link_file(const char *from, const char *to); | 
|  | 81 | extern int do_readlink(char *file, char *buf, int size); | 
|  | 82 | extern int rename_file(char *from, char *to); | 
|  | 83 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, | 
|  | 84 | long long *bfree_out, long long *bavail_out, | 
|  | 85 | long long *files_out, long long *ffree_out, | 
|  | 86 | void *fsid_out, int fsid_size, long *namelen_out, | 
|  | 87 | long *spare_out); | 
|  | 88 |  | 
|  | 89 | #endif | 
|  | 90 |  | 
|  | 91 | /* | 
|  | 92 | * Overrides for Emacs so that we follow Linus's tabbing style. | 
|  | 93 | * Emacs will notice this stuff at the end of the file and automatically | 
|  | 94 | * adjust the settings for this buffer only.  This must remain at the end | 
|  | 95 | * of the file. | 
|  | 96 | * --------------------------------------------------------------------------- | 
|  | 97 | * Local variables: | 
|  | 98 | * c-file-style: "linux" | 
|  | 99 | * End: | 
|  | 100 | */ |