9p: fix a bunch of checkpatch warnings
Sohaib Mohamed started a serie of tiny and incomplete checkpatch fixes but seemingly stopped halfway -- take over and do most of it. This is still missing net/9p/trans* and net/9p/protocol.c for a later time... Link: http://lkml.kernel.org/r/20211102134608.1588018-3-dominique.martinet@atmark-techno.com Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
This commit is contained in:
parent
b1843d2385
commit
6e195b0f7c
|
@ -115,6 +115,7 @@ static int v9fs_set_acl(struct p9_fid *fid, int type, struct posix_acl *acl)
|
||||||
char *name;
|
char *name;
|
||||||
size_t size;
|
size_t size;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
|
|
||||||
if (!acl)
|
if (!acl)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
17
fs/9p/acl.h
17
fs/9p/acl.h
|
@ -7,14 +7,15 @@
|
||||||
#define FS_9P_ACL_H
|
#define FS_9P_ACL_H
|
||||||
|
|
||||||
#ifdef CONFIG_9P_FS_POSIX_ACL
|
#ifdef CONFIG_9P_FS_POSIX_ACL
|
||||||
extern int v9fs_get_acl(struct inode *, struct p9_fid *);
|
int v9fs_get_acl(struct inode *inode, struct p9_fid *fid);
|
||||||
extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, bool rcu);
|
struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type,
|
||||||
extern int v9fs_acl_chmod(struct inode *, struct p9_fid *);
|
bool rcu);
|
||||||
extern int v9fs_set_create_acl(struct inode *, struct p9_fid *,
|
int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid);
|
||||||
struct posix_acl *, struct posix_acl *);
|
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
|
||||||
extern int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
struct posix_acl *dacl, struct posix_acl *acl);
|
||||||
struct posix_acl **dpacl, struct posix_acl **pacl);
|
int v9fs_acl_mode(struct inode *dir, umode_t *modep,
|
||||||
extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
|
struct posix_acl **dpacl, struct posix_acl **pacl);
|
||||||
|
void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl);
|
||||||
#else
|
#else
|
||||||
#define v9fs_iop_get_acl NULL
|
#define v9fs_iop_get_acl NULL
|
||||||
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
|
static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid)
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#define CACHETAG_LEN 11
|
#define CACHETAG_LEN 11
|
||||||
|
|
||||||
struct fscache_netfs v9fs_cache_netfs = {
|
struct fscache_netfs v9fs_cache_netfs = {
|
||||||
.name = "9p",
|
.name = "9p",
|
||||||
.version = 0,
|
.version = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -188,8 +188,10 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
||||||
|
|
||||||
while ((p = strsep(&options, ",")) != NULL) {
|
while ((p = strsep(&options, ",")) != NULL) {
|
||||||
int token, r;
|
int token, r;
|
||||||
|
|
||||||
if (!*p)
|
if (!*p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
token = match_token(p, tokens, args);
|
token = match_token(p, tokens, args);
|
||||||
switch (token) {
|
switch (token) {
|
||||||
case Opt_debug:
|
case Opt_debug:
|
||||||
|
@ -659,6 +661,7 @@ static void v9fs_destroy_inode_cache(void)
|
||||||
static int v9fs_cache_register(void)
|
static int v9fs_cache_register(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = v9fs_init_inode_cache();
|
ret = v9fs_init_inode_cache();
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -686,6 +689,7 @@ static void v9fs_cache_unregister(void)
|
||||||
static int __init init_v9fs(void)
|
static int __init init_v9fs(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
pr_info("Installing v9fs 9p2000 file system support\n");
|
pr_info("Installing v9fs 9p2000 file system support\n");
|
||||||
/* TODO: Setup list of registered trasnport modules */
|
/* TODO: Setup list of registered trasnport modules */
|
||||||
|
|
||||||
|
|
|
@ -44,9 +44,10 @@ extern struct kmem_cache *v9fs_inode_cache;
|
||||||
|
|
||||||
struct inode *v9fs_alloc_inode(struct super_block *sb);
|
struct inode *v9fs_alloc_inode(struct super_block *sb);
|
||||||
void v9fs_free_inode(struct inode *inode);
|
void v9fs_free_inode(struct inode *inode);
|
||||||
struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t);
|
struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode,
|
||||||
|
dev_t rdev);
|
||||||
int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
||||||
struct inode *inode, umode_t mode, dev_t);
|
struct inode *inode, umode_t mode, dev_t rdev);
|
||||||
void v9fs_evict_inode(struct inode *inode);
|
void v9fs_evict_inode(struct inode *inode);
|
||||||
ino_t v9fs_qid2ino(struct p9_qid *qid);
|
ino_t v9fs_qid2ino(struct p9_qid *qid);
|
||||||
void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
|
void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
|
||||||
|
@ -59,8 +60,8 @@ void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
|
||||||
int v9fs_uflags2omode(int uflags, int extended);
|
int v9fs_uflags2omode(int uflags, int extended);
|
||||||
|
|
||||||
void v9fs_blank_wstat(struct p9_wstat *wstat);
|
void v9fs_blank_wstat(struct p9_wstat *wstat);
|
||||||
int v9fs_vfs_setattr_dotl(struct user_namespace *, struct dentry *,
|
int v9fs_vfs_setattr_dotl(struct user_namespace *mnt_userns,
|
||||||
struct iattr *);
|
struct dentry *dentry, struct iattr *iattr);
|
||||||
int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
|
int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
|
||||||
int datasync);
|
int datasync);
|
||||||
int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode);
|
int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode);
|
||||||
|
@ -68,9 +69,9 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode);
|
||||||
static inline void v9fs_invalidate_inode_attr(struct inode *inode)
|
static inline void v9fs_invalidate_inode_attr(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct v9fs_inode *v9inode;
|
struct v9fs_inode *v9inode;
|
||||||
|
|
||||||
v9inode = V9FS_I(inode);
|
v9inode = V9FS_I(inode);
|
||||||
v9inode->cache_validity |= V9FS_INO_INVALID_ATTR;
|
v9inode->cache_validity |= V9FS_INO_INVALID_ATTR;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int v9fs_open_to_dotl_flags(int flags);
|
int v9fs_open_to_dotl_flags(int flags);
|
||||||
|
|
|
@ -247,11 +247,13 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
|
||||||
loff_t pos = iocb->ki_pos;
|
loff_t pos = iocb->ki_pos;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (iov_iter_rw(iter) == WRITE) {
|
if (iov_iter_rw(iter) == WRITE) {
|
||||||
n = p9_client_write(file->private_data, pos, iter, &err);
|
n = p9_client_write(file->private_data, pos, iter, &err);
|
||||||
if (n) {
|
if (n) {
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
loff_t i_size = i_size_read(inode);
|
loff_t i_size = i_size_read(inode);
|
||||||
|
|
||||||
if (pos + n > i_size)
|
if (pos + n > i_size)
|
||||||
inode_add_bytes(inode, pos + n - i_size);
|
inode_add_bytes(inode, pos + n - i_size);
|
||||||
}
|
}
|
||||||
|
@ -262,7 +264,7 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_write_begin(struct file *filp, struct address_space *mapping,
|
static int v9fs_write_begin(struct file *filp, struct address_space *mapping,
|
||||||
loff_t pos, unsigned len, unsigned flags,
|
loff_t pos, unsigned int len, unsigned int flags,
|
||||||
struct page **pagep, void **fsdata)
|
struct page **pagep, void **fsdata)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -287,7 +289,7 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int v9fs_write_end(struct file *filp, struct address_space *mapping,
|
static int v9fs_write_end(struct file *filp, struct address_space *mapping,
|
||||||
loff_t pos, unsigned len, unsigned copied,
|
loff_t pos, unsigned int len, unsigned int copied,
|
||||||
struct page *page, void *fsdata)
|
struct page *page, void *fsdata)
|
||||||
{
|
{
|
||||||
loff_t last_pos = pos + copied;
|
loff_t last_pos = pos + copied;
|
||||||
|
|
|
@ -50,6 +50,7 @@ static int v9fs_cached_dentry_delete(const struct dentry *dentry)
|
||||||
static void v9fs_dentry_release(struct dentry *dentry)
|
static void v9fs_dentry_release(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct hlist_node *p, *n;
|
struct hlist_node *p, *n;
|
||||||
|
|
||||||
p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n",
|
p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n",
|
||||||
dentry, dentry);
|
dentry, dentry);
|
||||||
hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata)
|
hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata)
|
||||||
|
@ -74,6 +75,7 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, unsigned int flags)
|
||||||
if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
|
if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) {
|
||||||
int retval;
|
int retval;
|
||||||
struct v9fs_session_info *v9ses;
|
struct v9fs_session_info *v9ses;
|
||||||
|
|
||||||
fid = v9fs_fid_lookup(dentry);
|
fid = v9fs_fid_lookup(dentry);
|
||||||
if (IS_ERR(fid))
|
if (IS_ERR(fid))
|
||||||
return PTR_ERR(fid);
|
return PTR_ERR(fid);
|
||||||
|
|
|
@ -406,6 +406,7 @@ v9fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||||
struct inode *inode = file_inode(file);
|
struct inode *inode = file_inode(file);
|
||||||
loff_t i_size;
|
loff_t i_size;
|
||||||
unsigned long pg_start, pg_end;
|
unsigned long pg_start, pg_end;
|
||||||
|
|
||||||
pg_start = origin >> PAGE_SHIFT;
|
pg_start = origin >> PAGE_SHIFT;
|
||||||
pg_end = (origin + retval - 1) >> PAGE_SHIFT;
|
pg_end = (origin + retval - 1) >> PAGE_SHIFT;
|
||||||
if (inode->i_mapping && inode->i_mapping->nrpages)
|
if (inode->i_mapping && inode->i_mapping->nrpages)
|
||||||
|
|
|
@ -47,6 +47,7 @@ static const struct inode_operations v9fs_symlink_inode_operations;
|
||||||
static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode)
|
static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = mode & 0777;
|
res = mode & 0777;
|
||||||
if (S_ISDIR(mode))
|
if (S_ISDIR(mode))
|
||||||
res |= P9_DMDIR;
|
res |= P9_DMDIR;
|
||||||
|
@ -226,6 +227,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
|
||||||
struct inode *v9fs_alloc_inode(struct super_block *sb)
|
struct inode *v9fs_alloc_inode(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct v9fs_inode *v9inode;
|
struct v9fs_inode *v9inode;
|
||||||
|
|
||||||
v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL);
|
v9inode = kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL);
|
||||||
if (!v9inode)
|
if (!v9inode)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -254,7 +256,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
inode_init_owner(&init_user_ns,inode, NULL, mode);
|
inode_init_owner(&init_user_ns, inode, NULL, mode);
|
||||||
inode->i_blocks = 0;
|
inode->i_blocks = 0;
|
||||||
inode->i_rdev = rdev;
|
inode->i_rdev = rdev;
|
||||||
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
|
||||||
|
@ -443,7 +445,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
|
||||||
unsigned long i_ino;
|
unsigned long i_ino;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct v9fs_session_info *v9ses = sb->s_fs_info;
|
struct v9fs_session_info *v9ses = sb->s_fs_info;
|
||||||
int (*test)(struct inode *, void *);
|
int (*test)(struct inode *inode, void *data);
|
||||||
|
|
||||||
if (new)
|
if (new)
|
||||||
test = v9fs_test_new_inode;
|
test = v9fs_test_new_inode;
|
||||||
|
@ -502,8 +504,10 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
|
||||||
static int v9fs_at_to_dotl_flags(int flags)
|
static int v9fs_at_to_dotl_flags(int flags)
|
||||||
{
|
{
|
||||||
int rflags = 0;
|
int rflags = 0;
|
||||||
|
|
||||||
if (flags & AT_REMOVEDIR)
|
if (flags & AT_REMOVEDIR)
|
||||||
rflags |= P9_DOTL_AT_REMOVEDIR;
|
rflags |= P9_DOTL_AT_REMOVEDIR;
|
||||||
|
|
||||||
return rflags;
|
return rflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,7 +804,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
|
v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry,
|
||||||
struct file *file, unsigned flags, umode_t mode)
|
struct file *file, unsigned int flags, umode_t mode)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
u32 perm;
|
u32 perm;
|
||||||
|
@ -1087,7 +1091,7 @@ static int v9fs_vfs_setattr(struct user_namespace *mnt_userns,
|
||||||
fid = v9fs_fid_lookup(dentry);
|
fid = v9fs_fid_lookup(dentry);
|
||||||
use_dentry = 1;
|
use_dentry = 1;
|
||||||
}
|
}
|
||||||
if(IS_ERR(fid))
|
if (IS_ERR(fid))
|
||||||
return PTR_ERR(fid);
|
return PTR_ERR(fid);
|
||||||
|
|
||||||
v9fs_blank_wstat(&wstat);
|
v9fs_blank_wstat(&wstat);
|
||||||
|
@ -1367,7 +1371,7 @@ v9fs_vfs_mknod(struct user_namespace *mnt_userns, struct inode *dir,
|
||||||
char name[2 + U32_MAX_DIGITS + 1 + U32_MAX_DIGITS + 1];
|
char name[2 + U32_MAX_DIGITS + 1 + U32_MAX_DIGITS + 1];
|
||||||
u32 perm;
|
u32 perm;
|
||||||
|
|
||||||
p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %hx MAJOR: %u MINOR: %u\n",
|
p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %x MAJOR: %u MINOR: %u\n",
|
||||||
dir->i_ino, dentry, mode,
|
dir->i_ino, dentry, mode,
|
||||||
MAJOR(rdev), MINOR(rdev));
|
MAJOR(rdev), MINOR(rdev));
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
|
||||||
unsigned long i_ino;
|
unsigned long i_ino;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct v9fs_session_info *v9ses = sb->s_fs_info;
|
struct v9fs_session_info *v9ses = sb->s_fs_info;
|
||||||
int (*test)(struct inode *, void *);
|
int (*test)(struct inode *inode, void *data);
|
||||||
|
|
||||||
if (new)
|
if (new)
|
||||||
test = v9fs_test_new_inode_dotl;
|
test = v9fs_test_new_inode_dotl;
|
||||||
|
@ -228,7 +228,7 @@ v9fs_vfs_create_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
|
v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
|
||||||
struct file *file, unsigned flags, umode_t omode)
|
struct file *file, unsigned int flags, umode_t omode)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
kgid_t gid;
|
kgid_t gid;
|
||||||
|
@ -259,7 +259,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry,
|
||||||
v9ses = v9fs_inode2v9ses(dir);
|
v9ses = v9fs_inode2v9ses(dir);
|
||||||
|
|
||||||
name = dentry->d_name.name;
|
name = dentry->d_name.name;
|
||||||
p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%hx\n",
|
p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
|
||||||
name, flags, omode);
|
name, flags, omode);
|
||||||
|
|
||||||
dfid = v9fs_parent_fid(dentry);
|
dfid = v9fs_parent_fid(dentry);
|
||||||
|
@ -805,6 +805,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
|
||||||
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
|
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
|
||||||
/* Get the latest stat info from server. */
|
/* Get the latest stat info from server. */
|
||||||
struct p9_fid *fid;
|
struct p9_fid *fid;
|
||||||
|
|
||||||
fid = v9fs_fid_lookup(old_dentry);
|
fid = v9fs_fid_lookup(old_dentry);
|
||||||
if (IS_ERR(fid))
|
if (IS_ERR(fid))
|
||||||
return PTR_ERR(fid);
|
return PTR_ERR(fid);
|
||||||
|
@ -841,7 +842,7 @@ v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, struct inode *dir,
|
||||||
struct p9_qid qid;
|
struct p9_qid qid;
|
||||||
struct posix_acl *dacl = NULL, *pacl = NULL;
|
struct posix_acl *dacl = NULL, *pacl = NULL;
|
||||||
|
|
||||||
p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %hx MAJOR: %u MINOR: %u\n",
|
p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %x MAJOR: %u MINOR: %u\n",
|
||||||
dir->i_ino, dentry, omode,
|
dir->i_ino, dentry, omode,
|
||||||
MAJOR(rdev), MINOR(rdev));
|
MAJOR(rdev), MINOR(rdev));
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
|
||||||
struct inode *inode = NULL;
|
struct inode *inode = NULL;
|
||||||
struct dentry *root = NULL;
|
struct dentry *root = NULL;
|
||||||
struct v9fs_session_info *v9ses = NULL;
|
struct v9fs_session_info *v9ses = NULL;
|
||||||
umode_t mode = S_IRWXUGO | S_ISVTX;
|
umode_t mode = 0777 | S_ISVTX;
|
||||||
struct p9_fid *fid;
|
struct p9_fid *fid;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
|
@ -156,6 +156,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
|
||||||
sb->s_root = root;
|
sb->s_root = root;
|
||||||
if (v9fs_proto_dotl(v9ses)) {
|
if (v9fs_proto_dotl(v9ses)) {
|
||||||
struct p9_stat_dotl *st = NULL;
|
struct p9_stat_dotl *st = NULL;
|
||||||
|
|
||||||
st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
|
st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
|
||||||
if (IS_ERR(st)) {
|
if (IS_ERR(st)) {
|
||||||
retval = PTR_ERR(st);
|
retval = PTR_ERR(st);
|
||||||
|
@ -166,6 +167,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
|
||||||
kfree(st);
|
kfree(st);
|
||||||
} else {
|
} else {
|
||||||
struct p9_wstat *st = NULL;
|
struct p9_wstat *st = NULL;
|
||||||
|
|
||||||
st = p9_client_stat(fid);
|
st = p9_client_stat(fid);
|
||||||
if (IS_ERR(st)) {
|
if (IS_ERR(st)) {
|
||||||
retval = PTR_ERR(st);
|
retval = PTR_ERR(st);
|
||||||
|
@ -274,12 +276,13 @@ done:
|
||||||
static int v9fs_drop_inode(struct inode *inode)
|
static int v9fs_drop_inode(struct inode *inode)
|
||||||
{
|
{
|
||||||
struct v9fs_session_info *v9ses;
|
struct v9fs_session_info *v9ses;
|
||||||
|
|
||||||
v9ses = v9fs_inode2v9ses(inode);
|
v9ses = v9fs_inode2v9ses(inode);
|
||||||
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
|
||||||
return generic_drop_inode(inode);
|
return generic_drop_inode(inode);
|
||||||
/*
|
/*
|
||||||
* in case of non cached mode always drop the
|
* in case of non cached mode always drop the
|
||||||
* the inode because we want the inode attribute
|
* inode because we want the inode attribute
|
||||||
* to always match that on the server.
|
* to always match that on the server.
|
||||||
*/
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -14,13 +14,14 @@ extern const struct xattr_handler *v9fs_xattr_handlers[];
|
||||||
extern const struct xattr_handler v9fs_xattr_acl_access_handler;
|
extern const struct xattr_handler v9fs_xattr_acl_access_handler;
|
||||||
extern const struct xattr_handler v9fs_xattr_acl_default_handler;
|
extern const struct xattr_handler v9fs_xattr_acl_default_handler;
|
||||||
|
|
||||||
extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *,
|
ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
|
||||||
void *, size_t);
|
void *buffer, size_t buffer_size);
|
||||||
extern ssize_t v9fs_xattr_get(struct dentry *, const char *,
|
ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
|
||||||
void *, size_t);
|
void *buffer, size_t buffer_size);
|
||||||
extern int v9fs_fid_xattr_set(struct p9_fid *, const char *,
|
int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
|
||||||
const void *, size_t, int);
|
const void *value, size_t value_len, int flags);
|
||||||
extern int v9fs_xattr_set(struct dentry *, const char *,
|
int v9fs_xattr_set(struct dentry *dentry, const char *name,
|
||||||
const void *, size_t, int);
|
const void *value, size_t value_len, int flags);
|
||||||
extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t);
|
ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer,
|
||||||
|
size_t buffer_size);
|
||||||
#endif /* FS_9P_XATTR_H */
|
#endif /* FS_9P_XATTR_H */
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum p9_debug_flags {
|
enum p9_debug_flags {
|
||||||
P9_DEBUG_ERROR = (1<<0),
|
P9_DEBUG_ERROR = (1<<0),
|
||||||
P9_DEBUG_9P = (1<<2),
|
P9_DEBUG_9P = (1<<2),
|
||||||
P9_DEBUG_VFS = (1<<3),
|
P9_DEBUG_VFS = (1<<3),
|
||||||
P9_DEBUG_CONV = (1<<4),
|
P9_DEBUG_CONV = (1<<4),
|
||||||
P9_DEBUG_MUX = (1<<5),
|
P9_DEBUG_MUX = (1<<5),
|
||||||
P9_DEBUG_TRANS = (1<<6),
|
P9_DEBUG_TRANS = (1<<6),
|
||||||
P9_DEBUG_SLABS = (1<<7),
|
P9_DEBUG_SLABS = (1<<7),
|
||||||
P9_DEBUG_FCALL = (1<<8),
|
P9_DEBUG_FCALL = (1<<8),
|
||||||
P9_DEBUG_FID = (1<<9),
|
P9_DEBUG_FID = (1<<9),
|
||||||
P9_DEBUG_PKT = (1<<10),
|
P9_DEBUG_PKT = (1<<10),
|
||||||
|
@ -315,8 +315,8 @@ enum p9_qid_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 9P Magic Numbers */
|
/* 9P Magic Numbers */
|
||||||
#define P9_NOTAG (u16)(~0)
|
#define P9_NOTAG ((u16)(~0))
|
||||||
#define P9_NOFID (u32)(~0)
|
#define P9_NOFID ((u32)(~0))
|
||||||
#define P9_MAXWELEM 16
|
#define P9_MAXWELEM 16
|
||||||
|
|
||||||
/* Minimal header size: size[4] type[1] tag[2] */
|
/* Minimal header size: size[4] type[1] tag[2] */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* @p9_proto_2000L: 9P2000.L extension
|
* @p9_proto_2000L: 9P2000.L extension
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum p9_proto_versions{
|
enum p9_proto_versions {
|
||||||
p9_proto_legacy,
|
p9_proto_legacy,
|
||||||
p9_proto_2000u,
|
p9_proto_2000u,
|
||||||
p9_proto_2000L,
|
p9_proto_2000L,
|
||||||
|
@ -217,13 +217,13 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid,
|
||||||
u64 request_mask);
|
u64 request_mask);
|
||||||
|
|
||||||
int p9_client_mknod_dotl(struct p9_fid *oldfid, const char *name, int mode,
|
int p9_client_mknod_dotl(struct p9_fid *oldfid, const char *name, int mode,
|
||||||
dev_t rdev, kgid_t gid, struct p9_qid *);
|
dev_t rdev, kgid_t gid, struct p9_qid *qid);
|
||||||
int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode,
|
int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode,
|
||||||
kgid_t gid, struct p9_qid *);
|
kgid_t gid, struct p9_qid *qid);
|
||||||
int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
|
int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
|
||||||
int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
|
int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
|
||||||
void p9_fcall_fini(struct p9_fcall *fc);
|
void p9_fcall_fini(struct p9_fcall *fc);
|
||||||
struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
|
struct p9_req_t *p9_tag_lookup(struct p9_client *c, u16 tag);
|
||||||
|
|
||||||
static inline void p9_req_get(struct p9_req_t *r)
|
static inline void p9_req_get(struct p9_req_t *r)
|
||||||
{
|
{
|
||||||
|
@ -239,14 +239,18 @@ int p9_req_put(struct p9_req_t *r);
|
||||||
|
|
||||||
void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
|
void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
|
||||||
|
|
||||||
int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
|
int p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type,
|
||||||
int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *);
|
int16_t *tag, int rewind);
|
||||||
void p9stat_free(struct p9_wstat *);
|
int p9stat_read(struct p9_client *clnt, char *buf, int len,
|
||||||
|
struct p9_wstat *st);
|
||||||
|
void p9stat_free(struct p9_wstat *stbuf);
|
||||||
|
|
||||||
int p9_is_proto_dotu(struct p9_client *clnt);
|
int p9_is_proto_dotu(struct p9_client *clnt);
|
||||||
int p9_is_proto_dotl(struct p9_client *clnt);
|
int p9_is_proto_dotl(struct p9_client *clnt);
|
||||||
struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *);
|
struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid,
|
||||||
int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int);
|
const char *attr_name, u64 *attr_size);
|
||||||
|
int p9_client_xattrcreate(struct p9_fid *fid, const char *name,
|
||||||
|
u64 attr_size, int flags);
|
||||||
int p9_client_readlink(struct p9_fid *fid, char **target);
|
int p9_client_readlink(struct p9_fid *fid, char **target);
|
||||||
|
|
||||||
int p9_client_init(void);
|
int p9_client_init(void);
|
||||||
|
|
|
@ -40,14 +40,16 @@ struct p9_trans_module {
|
||||||
int maxsize; /* max message size of transport */
|
int maxsize; /* max message size of transport */
|
||||||
int def; /* this transport should be default */
|
int def; /* this transport should be default */
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
int (*create)(struct p9_client *, const char *, char *);
|
int (*create)(struct p9_client *client,
|
||||||
void (*close) (struct p9_client *);
|
const char *devname, char *args);
|
||||||
int (*request) (struct p9_client *, struct p9_req_t *req);
|
void (*close)(struct p9_client *client);
|
||||||
int (*cancel) (struct p9_client *, struct p9_req_t *req);
|
int (*request)(struct p9_client *client, struct p9_req_t *req);
|
||||||
int (*cancelled)(struct p9_client *, struct p9_req_t *req);
|
int (*cancel)(struct p9_client *client, struct p9_req_t *req);
|
||||||
int (*zc_request)(struct p9_client *, struct p9_req_t *,
|
int (*cancelled)(struct p9_client *client, struct p9_req_t *req);
|
||||||
struct iov_iter *, struct iov_iter *, int , int, int);
|
int (*zc_request)(struct p9_client *client, struct p9_req_t *req,
|
||||||
int (*show_options)(struct seq_file *, struct p9_client *);
|
struct iov_iter *uidata, struct iov_iter *uodata,
|
||||||
|
int inlen, int outlen, int in_hdr_len);
|
||||||
|
int (*show_options)(struct seq_file *m, struct p9_client *client);
|
||||||
};
|
};
|
||||||
|
|
||||||
void v9fs_register_trans(struct p9_trans_module *m);
|
void v9fs_register_trans(struct p9_trans_module *m);
|
||||||
|
|
430
net/9p/client.c
430
net/9p/client.c
File diff suppressed because it is too large
Load Diff
|
@ -183,7 +183,7 @@ int p9_error_init(void)
|
||||||
INIT_HLIST_HEAD(&hash_errmap[bucket]);
|
INIT_HLIST_HEAD(&hash_errmap[bucket]);
|
||||||
|
|
||||||
/* load initial error map into hash table */
|
/* load initial error map into hash table */
|
||||||
for (c = errmap; c->name != NULL; c++) {
|
for (c = errmap; c->name; c++) {
|
||||||
c->namelen = strlen(c->name);
|
c->namelen = strlen(c->name);
|
||||||
bucket = jhash(c->name, c->namelen, 0) % ERRHASHSZ;
|
bucket = jhash(c->name, c->namelen, 0) % ERRHASHSZ;
|
||||||
INIT_HLIST_NODE(&c->list);
|
INIT_HLIST_NODE(&c->list);
|
||||||
|
|
|
@ -23,13 +23,13 @@
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
#ifdef CONFIG_NET_9P_DEBUG
|
#ifdef CONFIG_NET_9P_DEBUG
|
||||||
unsigned int p9_debug_level = 0; /* feature-rific global debug level */
|
unsigned int p9_debug_level; /* feature-rific global debug level */
|
||||||
EXPORT_SYMBOL(p9_debug_level);
|
EXPORT_SYMBOL(p9_debug_level);
|
||||||
module_param_named(debug, p9_debug_level, uint, 0);
|
module_param_named(debug, p9_debug_level, uint, 0);
|
||||||
MODULE_PARM_DESC(debug, "9P debugging level");
|
MODULE_PARM_DESC(debug, "9P debugging level");
|
||||||
|
|
||||||
void _p9_debug(enum p9_debug_flags level, const char *func,
|
void _p9_debug(enum p9_debug_flags level, const char *func,
|
||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct va_format vaf;
|
struct va_format vaf;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
@ -52,10 +52,7 @@ void _p9_debug(enum p9_debug_flags level, const char *func,
|
||||||
EXPORT_SYMBOL(_p9_debug);
|
EXPORT_SYMBOL(_p9_debug);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* Dynamic Transport Registration Routines */
|
||||||
* Dynamic Transport Registration Routines
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(v9fs_trans_lock);
|
static DEFINE_SPINLOCK(v9fs_trans_lock);
|
||||||
static LIST_HEAD(v9fs_trans_list);
|
static LIST_HEAD(v9fs_trans_list);
|
||||||
|
|
|
@ -44,6 +44,7 @@ EXPORT_SYMBOL(p9stat_free);
|
||||||
size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size)
|
size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size)
|
||||||
{
|
{
|
||||||
size_t len = min(pdu->size - pdu->offset, size);
|
size_t len = min(pdu->size - pdu->offset, size);
|
||||||
|
|
||||||
memcpy(data, &pdu->sdata[pdu->offset], len);
|
memcpy(data, &pdu->sdata[pdu->offset], len);
|
||||||
pdu->offset += len;
|
pdu->offset += len;
|
||||||
return size - len;
|
return size - len;
|
||||||
|
@ -52,6 +53,7 @@ size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size)
|
||||||
static size_t pdu_write(struct p9_fcall *pdu, const void *data, size_t size)
|
static size_t pdu_write(struct p9_fcall *pdu, const void *data, size_t size)
|
||||||
{
|
{
|
||||||
size_t len = min(pdu->capacity - pdu->size, size);
|
size_t len = min(pdu->capacity - pdu->size, size);
|
||||||
|
|
||||||
memcpy(&pdu->sdata[pdu->size], data, len);
|
memcpy(&pdu->sdata[pdu->size], data, len);
|
||||||
pdu->size += len;
|
pdu->size += len;
|
||||||
return size - len;
|
return size - len;
|
||||||
|
@ -62,6 +64,7 @@ pdu_write_u(struct p9_fcall *pdu, struct iov_iter *from, size_t size)
|
||||||
{
|
{
|
||||||
size_t len = min(pdu->capacity - pdu->size, size);
|
size_t len = min(pdu->capacity - pdu->size, size);
|
||||||
struct iov_iter i = *from;
|
struct iov_iter i = *from;
|
||||||
|
|
||||||
if (!copy_from_iter_full(&pdu->sdata[pdu->size], len, &i))
|
if (!copy_from_iter_full(&pdu->sdata[pdu->size], len, &i))
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
|
@ -69,26 +72,25 @@ pdu_write_u(struct p9_fcall *pdu, struct iov_iter *from, size_t size)
|
||||||
return size - len;
|
return size - len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* b - int8_t
|
||||||
b - int8_t
|
* w - int16_t
|
||||||
w - int16_t
|
* d - int32_t
|
||||||
d - int32_t
|
* q - int64_t
|
||||||
q - int64_t
|
* s - string
|
||||||
s - string
|
* u - numeric uid
|
||||||
u - numeric uid
|
* g - numeric gid
|
||||||
g - numeric gid
|
* S - stat
|
||||||
S - stat
|
* Q - qid
|
||||||
Q - qid
|
* D - data blob (int32_t size followed by void *, results are not freed)
|
||||||
D - data blob (int32_t size followed by void *, results are not freed)
|
* T - array of strings (int16_t count, followed by strings)
|
||||||
T - array of strings (int16_t count, followed by strings)
|
* R - array of qids (int16_t count, followed by qids)
|
||||||
R - array of qids (int16_t count, followed by qids)
|
* A - stat for 9p2000.L (p9_stat_dotl)
|
||||||
A - stat for 9p2000.L (p9_stat_dotl)
|
* ? - if optional = 1, continue parsing
|
||||||
? - if optional = 1, continue parsing
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
const char *ptr;
|
const char *ptr;
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
int p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
|
||||||
va_list ap);
|
va_list ap);
|
||||||
int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);
|
int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, ...);
|
||||||
int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type);
|
int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type);
|
||||||
int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu);
|
int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu);
|
||||||
|
|
|
@ -4,4 +4,4 @@
|
||||||
* Author Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
|
* Author Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void p9_release_pages(struct page **, int);
|
void p9_release_pages(struct page **pages, int nr_pages);
|
||||||
|
|
Loading…
Reference in New Issue