fs/9p: Add OS dependent open flags in 9p protocol
Subsystems (3)
PATCH 1/1 fs/9p: Add OS dependent open flags in 9p protocol
From: Venkateswararao Jujjuri <[email protected]>
Some of the flags are OS/arch dependent we add a 9p protocol value which maps to asm-generic/fcntl.h values in Linux
Signed-off-by Venkateswararao Jujjuri <[email protected]>
Signed-off-by Aneesh Kumar K.V <[email protected]>
--- fs/9p/v9fs_vfs.h | 2 + fs/9p/vfs_file.c | 2 +- fs/9p/vfs_inode.c | 16 ++++++++++++++- fs/9p/vfs_inode_dotl.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++- include/net/9p/9p.h | 23 ++++++++++++++++++++++ 5 files changed, 89 insertions(+), 3 deletions(-)
fs/9p/v9fs_vfs.h +2 -0
@@ -82,4 +82,6 @@ static inline void v9fs_invalidate_inode_attr(struct inode *inode) v9inode->cache_validity |=V9FS_INO_INVALID_ATTR ; return; } + +int v9fs_open_to_dotl_flags (int flags);#endif
fs/9p/vfs_file.c +1 -1
@@ -65,7 +65,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) v9inode =V9FS_I (inode); v9ses =v9fs_inode2v9ses (inode);if (v9fs_proto_dotl (v9ses)) - omode = file->f_flags; + omode =v9fs_open_to_dotl_flags (file->f_flags);else omode =v9fs_uflags2omode (file->f_flags,v9fs_proto_dotu (v9ses));
fs/9p/vfs_inode.c +15 -1
@@ -553,6 +553,19 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, }/** +* v9fs_at_to_dotl_flags- convert Linux specific AT flags to +* plan 9 AT flag. +* @flags: flags to convert +*/ +static int v9fs_at_to_dotl_flags (int flags) +{ +int rflags =0 ; +if (flags &AT_REMOVEDIR ) + rflags |=P9_DOTL_AT_REMOVEDIR ; +return rflags; +} + +/** * v9fs_remove - helper function to remove files and directories * @dir: directory inode that is being deleted * @dentry: dentry that is being deleted
@@ -579,7 +592,8 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)return retval; }if (v9fs_proto_dotl (v9ses)) - retval =p9_client_unlinkat (dfid, dentry->d_name.name, flags); + retval =p9_client_unlinkat (dfid, dentry->d_name.name, +v9fs_at_to_dotl_flags (flags));if (retval == -EOPNOTSUPP ) {/* Try the one based on path */ v9fid =v9fs_fid_clone (dentry);
fs/9p/vfs_inode_dotl.c +48 -1
61 lines not on this page · raw message
include/net/9p/9p.h +23 -0
@@ -288,6 +288,29 @@ enum p9_perm_t { P9_DMSETVTX = 0x00010000, }; +/* 9p2000.L open flags */ +#define P9_DOTL_RDONLY 00000000 +#define P9_DOTL_WRONLY 00000001 +#define P9_DOTL_RDWR 00000002 +#define P9_DOTL_CREAT 00000100 +#define P9_DOTL_EXCL 00000200 +#define P9_DOTL_NOCTTY 00000400 +#define P9_DOTL_TRUNC 00001000 +#define P9_DOTL_APPEND 00002000 +#define P9_DOTL_NONBLOCK 00004000 +#define P9_DOTL_DSYNC 00010000 +#define P9_DOTL_FASYNC 00020000 +#define P9_DOTL_DIRECT 00040000 +#define P9_DOTL_LARGEFILE 00100000 +#define P9_DOTL_DIRECTORY 00200000 +#define P9_DOTL_NOFOLLOW 00400000 +#define P9_DOTL_NOATIME 01000000 +#define P9_DOTL_CLOEXEC 02000000 +#define P9_DOTL_SYNC 04000000 + +/* 9p2000.L at flags */ +#define P9_DOTL_AT_REMOVEDIR 0x200 +/** * enum p9_qid_t - QID types * @P9_QTDIR: directory
Signature · 1 line
1.7.4.1