diff options
| -rw-r--r-- | fs/9p/v9fs.c | 61 | ||||
| -rw-r--r-- | fs/9p/v9fs.h | 3 | ||||
| -rw-r--r-- | fs/9p/vfs_super.c | 6 | ||||
| -rw-r--r-- | include/net/9p/client.h | 13 | ||||
| -rw-r--r-- | include/net/9p/transport.h | 1 | ||||
| -rw-r--r-- | net/9p/client.c | 25 | ||||
| -rw-r--r-- | net/9p/trans_fd.c | 31 | ||||
| -rw-r--r-- | net/9p/trans_rdma.c | 31 |
8 files changed, 161 insertions, 10 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index c202930086ed..8fb89ddc6cc7 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/parser.h> | 33 | #include <linux/parser.h> |
| 34 | #include <linux/idr.h> | 34 | #include <linux/idr.h> |
| 35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
| 36 | #include <linux/seq_file.h> | ||
| 36 | #include <net/9p/9p.h> | 37 | #include <net/9p/9p.h> |
| 37 | #include <net/9p/client.h> | 38 | #include <net/9p/client.h> |
| 38 | #include <net/9p/transport.h> | 39 | #include <net/9p/transport.h> |
| @@ -82,6 +83,13 @@ static const match_table_t tokens = { | |||
| 82 | {Opt_err, NULL} | 83 | {Opt_err, NULL} |
| 83 | }; | 84 | }; |
| 84 | 85 | ||
| 86 | static const char *const v9fs_cache_modes[nr__p9_cache_modes] = { | ||
| 87 | [CACHE_NONE] = "none", | ||
| 88 | [CACHE_MMAP] = "mmap", | ||
| 89 | [CACHE_LOOSE] = "loose", | ||
| 90 | [CACHE_FSCACHE] = "fscache", | ||
| 91 | }; | ||
| 92 | |||
| 85 | /* Interpret mount options for cache mode */ | 93 | /* Interpret mount options for cache mode */ |
| 86 | static int get_cache_mode(char *s) | 94 | static int get_cache_mode(char *s) |
| 87 | { | 95 | { |
| @@ -104,6 +112,58 @@ static int get_cache_mode(char *s) | |||
| 104 | return version; | 112 | return version; |
| 105 | } | 113 | } |
| 106 | 114 | ||
| 115 | /* | ||
| 116 | * Display the mount options in /proc/mounts. | ||
| 117 | */ | ||
| 118 | int v9fs_show_options(struct seq_file *m, struct dentry *root) | ||
| 119 | { | ||
| 120 | struct v9fs_session_info *v9ses = root->d_sb->s_fs_info; | ||
| 121 | |||
| 122 | if (v9ses->debug) | ||
| 123 | seq_printf(m, ",debug=%x", v9ses->debug); | ||
| 124 | if (!uid_eq(v9ses->dfltuid, V9FS_DEFUID)) | ||
| 125 | seq_printf(m, ",dfltuid=%u", | ||
| 126 | from_kuid_munged(&init_user_ns, v9ses->dfltuid)); | ||
| 127 | if (!gid_eq(v9ses->dfltgid, V9FS_DEFGID)) | ||
| 128 | seq_printf(m, ",dfltgid=%u", | ||
| 129 | from_kgid_munged(&init_user_ns, v9ses->dfltgid)); | ||
| 130 | if (v9ses->afid != ~0) | ||
| 131 | seq_printf(m, ",afid=%u", v9ses->afid); | ||
| 132 | if (strcmp(v9ses->uname, V9FS_DEFUSER) != 0) | ||
| 133 | seq_printf(m, ",uname=%s", v9ses->uname); | ||
| 134 | if (strcmp(v9ses->aname, V9FS_DEFANAME) != 0) | ||
| 135 | seq_printf(m, ",aname=%s", v9ses->aname); | ||
| 136 | if (v9ses->nodev) | ||
| 137 | seq_puts(m, ",nodevmap"); | ||
| 138 | if (v9ses->cache) | ||
| 139 | seq_printf(m, ",%s", v9fs_cache_modes[v9ses->cache]); | ||
| 140 | #ifdef CONFIG_9P_FSCACHE | ||
| 141 | if (v9ses->cachetag && v9ses->cache == CACHE_FSCACHE) | ||
| 142 | seq_printf(m, ",cachetag=%s", v9ses->cachetag); | ||
| 143 | #endif | ||
| 144 | |||
| 145 | switch (v9ses->flags & V9FS_ACCESS_MASK) { | ||
| 146 | case V9FS_ACCESS_USER: | ||
| 147 | seq_puts(m, ",access=user"); | ||
| 148 | break; | ||
| 149 | case V9FS_ACCESS_ANY: | ||
| 150 | seq_puts(m, ",access=any"); | ||
| 151 | break; | ||
| 152 | case V9FS_ACCESS_CLIENT: | ||
| 153 | seq_puts(m, ",access=client"); | ||
| 154 | break; | ||
| 155 | case V9FS_ACCESS_SINGLE: | ||
| 156 | seq_printf(m, ",access=%u", | ||
| 157 | from_kuid_munged(&init_user_ns, v9ses->uid)); | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | |||
| 161 | if (v9ses->flags & V9FS_POSIX_ACL) | ||
| 162 | seq_puts(m, ",posixacl"); | ||
| 163 | |||
| 164 | return p9_show_client_options(m, v9ses->clnt); | ||
| 165 | } | ||
| 166 | |||
| 107 | /** | 167 | /** |
| 108 | * v9fs_parse_options - parse mount options into session structure | 168 | * v9fs_parse_options - parse mount options into session structure |
| 109 | * @v9ses: existing v9fs session information | 169 | * @v9ses: existing v9fs session information |
| @@ -230,6 +290,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
| 230 | break; | 290 | break; |
| 231 | case Opt_cachetag: | 291 | case Opt_cachetag: |
| 232 | #ifdef CONFIG_9P_FSCACHE | 292 | #ifdef CONFIG_9P_FSCACHE |
| 293 | kfree(v9ses->cachetag); | ||
| 233 | v9ses->cachetag = match_strdup(&args[0]); | 294 | v9ses->cachetag = match_strdup(&args[0]); |
| 234 | #endif | 295 | #endif |
| 235 | break; | 296 | break; |
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 76eaf49abd3a..982e017acadb 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
| @@ -67,6 +67,7 @@ enum p9_cache_modes { | |||
| 67 | CACHE_MMAP, | 67 | CACHE_MMAP, |
| 68 | CACHE_LOOSE, | 68 | CACHE_LOOSE, |
| 69 | CACHE_FSCACHE, | 69 | CACHE_FSCACHE, |
| 70 | nr__p9_cache_modes | ||
| 70 | }; | 71 | }; |
| 71 | 72 | ||
| 72 | /** | 73 | /** |
| @@ -137,6 +138,8 @@ static inline struct v9fs_inode *V9FS_I(const struct inode *inode) | |||
| 137 | return container_of(inode, struct v9fs_inode, vfs_inode); | 138 | return container_of(inode, struct v9fs_inode, vfs_inode); |
| 138 | } | 139 | } |
| 139 | 140 | ||
| 141 | extern int v9fs_show_options(struct seq_file *m, struct dentry *root); | ||
| 142 | |||
| 140 | struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, | 143 | struct p9_fid *v9fs_session_init(struct v9fs_session_info *, const char *, |
| 141 | char *); | 144 | char *); |
| 142 | extern void v9fs_session_close(struct v9fs_session_info *v9ses); | 145 | extern void v9fs_session_close(struct v9fs_session_info *v9ses); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index a0965fb587a5..8b75463cb211 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <linux/string.h> | 33 | #include <linux/string.h> |
| 34 | #include <linux/inet.h> | 34 | #include <linux/inet.h> |
| 35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
| 36 | #include <linux/seq_file.h> | ||
| 37 | #include <linux/mount.h> | 36 | #include <linux/mount.h> |
| 38 | #include <linux/idr.h> | 37 | #include <linux/idr.h> |
| 39 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
| @@ -104,7 +103,6 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
| 104 | sb->s_flags |= MS_POSIXACL; | 103 | sb->s_flags |= MS_POSIXACL; |
| 105 | #endif | 104 | #endif |
| 106 | 105 | ||
| 107 | save_mount_options(sb, data); | ||
| 108 | return 0; | 106 | return 0; |
| 109 | } | 107 | } |
| 110 | 108 | ||
| @@ -349,7 +347,7 @@ static const struct super_operations v9fs_super_ops = { | |||
| 349 | .destroy_inode = v9fs_destroy_inode, | 347 | .destroy_inode = v9fs_destroy_inode, |
| 350 | .statfs = simple_statfs, | 348 | .statfs = simple_statfs, |
| 351 | .evict_inode = v9fs_evict_inode, | 349 | .evict_inode = v9fs_evict_inode, |
| 352 | .show_options = generic_show_options, | 350 | .show_options = v9fs_show_options, |
| 353 | .umount_begin = v9fs_umount_begin, | 351 | .umount_begin = v9fs_umount_begin, |
| 354 | .write_inode = v9fs_write_inode, | 352 | .write_inode = v9fs_write_inode, |
| 355 | }; | 353 | }; |
| @@ -360,7 +358,7 @@ static const struct super_operations v9fs_super_ops_dotl = { | |||
| 360 | .statfs = v9fs_statfs, | 358 | .statfs = v9fs_statfs, |
| 361 | .drop_inode = v9fs_drop_inode, | 359 | .drop_inode = v9fs_drop_inode, |
| 362 | .evict_inode = v9fs_evict_inode, | 360 | .evict_inode = v9fs_evict_inode, |
| 363 | .show_options = generic_show_options, | 361 | .show_options = v9fs_show_options, |
| 364 | .umount_begin = v9fs_umount_begin, | 362 | .umount_begin = v9fs_umount_begin, |
| 365 | .write_inode = v9fs_write_inode_dotl, | 363 | .write_inode = v9fs_write_inode_dotl, |
| 366 | }; | 364 | }; |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index b582339ccef5..7af9d769b97d 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -157,6 +157,18 @@ struct p9_client { | |||
| 157 | enum p9_trans_status status; | 157 | enum p9_trans_status status; |
| 158 | void *trans; | 158 | void *trans; |
| 159 | 159 | ||
| 160 | union { | ||
| 161 | struct { | ||
| 162 | int rfd; | ||
| 163 | int wfd; | ||
| 164 | } fd; | ||
| 165 | struct { | ||
| 166 | u16 port; | ||
| 167 | bool privport; | ||
| 168 | |||
| 169 | } tcp; | ||
| 170 | } trans_opts; | ||
| 171 | |||
| 160 | struct p9_idpool *fidpool; | 172 | struct p9_idpool *fidpool; |
| 161 | struct list_head fidlist; | 173 | struct list_head fidlist; |
| 162 | 174 | ||
| @@ -213,6 +225,7 @@ struct p9_dirent { | |||
| 213 | 225 | ||
| 214 | struct iov_iter; | 226 | struct iov_iter; |
| 215 | 227 | ||
| 228 | int p9_show_client_options(struct seq_file *m, struct p9_client *clnt); | ||
| 216 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | 229 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); |
| 217 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, | 230 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, |
| 218 | const char *name); | 231 | const char *name); |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 5122b5e40f78..1625fb842ac4 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
| @@ -62,6 +62,7 @@ struct p9_trans_module { | |||
| 62 | int (*cancelled)(struct p9_client *, struct p9_req_t *req); | 62 | int (*cancelled)(struct p9_client *, struct p9_req_t *req); |
| 63 | int (*zc_request)(struct p9_client *, struct p9_req_t *, | 63 | int (*zc_request)(struct p9_client *, struct p9_req_t *, |
| 64 | struct iov_iter *, struct iov_iter *, int , int, int); | 64 | struct iov_iter *, struct iov_iter *, int , int, int); |
| 65 | int (*show_options)(struct seq_file *, struct p9_client *); | ||
| 65 | }; | 66 | }; |
| 66 | 67 | ||
| 67 | void v9fs_register_trans(struct p9_trans_module *m); | 68 | void v9fs_register_trans(struct p9_trans_module *m); |
diff --git a/net/9p/client.c b/net/9p/client.c index 1218fb3b52da..4674235b0d9b 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include <linux/uio.h> | 37 | #include <linux/uio.h> |
| 38 | #include <net/9p/9p.h> | 38 | #include <net/9p/9p.h> |
| 39 | #include <linux/parser.h> | 39 | #include <linux/parser.h> |
| 40 | #include <linux/seq_file.h> | ||
| 40 | #include <net/9p/client.h> | 41 | #include <net/9p/client.h> |
| 41 | #include <net/9p/transport.h> | 42 | #include <net/9p/transport.h> |
| 42 | #include "protocol.h" | 43 | #include "protocol.h" |
| @@ -77,6 +78,30 @@ inline int p9_is_proto_dotu(struct p9_client *clnt) | |||
| 77 | } | 78 | } |
| 78 | EXPORT_SYMBOL(p9_is_proto_dotu); | 79 | EXPORT_SYMBOL(p9_is_proto_dotu); |
| 79 | 80 | ||
| 81 | int p9_show_client_options(struct seq_file *m, struct p9_client *clnt) | ||
| 82 | { | ||
| 83 | if (clnt->msize != 8192) | ||
| 84 | seq_printf(m, ",msize=%u", clnt->msize); | ||
| 85 | seq_printf(m, "trans=%s", clnt->trans_mod->name); | ||
| 86 | |||
| 87 | switch (clnt->proto_version) { | ||
| 88 | case p9_proto_legacy: | ||
| 89 | seq_puts(m, ",noextend"); | ||
| 90 | break; | ||
| 91 | case p9_proto_2000u: | ||
| 92 | seq_puts(m, ",version=9p2000.u"); | ||
| 93 | break; | ||
| 94 | case p9_proto_2000L: | ||
| 95 | /* Default */ | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | |||
| 99 | if (clnt->trans_mod->show_options) | ||
| 100 | return clnt->trans_mod->show_options(m, clnt); | ||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | EXPORT_SYMBOL(p9_show_client_options); | ||
| 104 | |||
| 80 | /* | 105 | /* |
| 81 | * Some error codes are taken directly from the server replies, | 106 | * Some error codes are taken directly from the server replies, |
| 82 | * make sure they are valid. | 107 | * make sure they are valid. |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 7bc2208b6cc4..f2e0eaf58018 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
| @@ -41,6 +41,7 @@ | |||
| 41 | #include <linux/file.h> | 41 | #include <linux/file.h> |
| 42 | #include <linux/parser.h> | 42 | #include <linux/parser.h> |
| 43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
| 44 | #include <linux/seq_file.h> | ||
| 44 | #include <net/9p/9p.h> | 45 | #include <net/9p/9p.h> |
| 45 | #include <net/9p/client.h> | 46 | #include <net/9p/client.h> |
| 46 | #include <net/9p/transport.h> | 47 | #include <net/9p/transport.h> |
| @@ -51,6 +52,9 @@ | |||
| 51 | #define MAX_SOCK_BUF (64*1024) | 52 | #define MAX_SOCK_BUF (64*1024) |
| 52 | #define MAXPOLLWADDR 2 | 53 | #define MAXPOLLWADDR 2 |
| 53 | 54 | ||
| 55 | static struct p9_trans_module p9_tcp_trans; | ||
| 56 | static struct p9_trans_module p9_fd_trans; | ||
| 57 | |||
| 54 | /** | 58 | /** |
| 55 | * struct p9_fd_opts - per-transport options | 59 | * struct p9_fd_opts - per-transport options |
| 56 | * @rfd: file descriptor for reading (trans=fd) | 60 | * @rfd: file descriptor for reading (trans=fd) |
| @@ -63,7 +67,7 @@ struct p9_fd_opts { | |||
| 63 | int rfd; | 67 | int rfd; |
| 64 | int wfd; | 68 | int wfd; |
| 65 | u16 port; | 69 | u16 port; |
| 66 | int privport; | 70 | bool privport; |
| 67 | }; | 71 | }; |
| 68 | 72 | ||
| 69 | /* | 73 | /* |
| @@ -720,6 +724,20 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req) | |||
| 720 | return 0; | 724 | return 0; |
| 721 | } | 725 | } |
| 722 | 726 | ||
| 727 | static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt) | ||
| 728 | { | ||
| 729 | if (clnt->trans_mod == &p9_tcp_trans) { | ||
| 730 | if (clnt->trans_opts.tcp.port != P9_PORT) | ||
| 731 | seq_printf(m, "port=%u", clnt->trans_opts.tcp.port); | ||
| 732 | } else if (clnt->trans_mod == &p9_fd_trans) { | ||
| 733 | if (clnt->trans_opts.fd.rfd != ~0) | ||
| 734 | seq_printf(m, "rfd=%u", clnt->trans_opts.fd.rfd); | ||
| 735 | if (clnt->trans_opts.fd.wfd != ~0) | ||
| 736 | seq_printf(m, "wfd=%u", clnt->trans_opts.fd.wfd); | ||
| 737 | } | ||
| 738 | return 0; | ||
| 739 | } | ||
| 740 | |||
| 723 | /** | 741 | /** |
| 724 | * parse_opts - parse mount options into p9_fd_opts structure | 742 | * parse_opts - parse mount options into p9_fd_opts structure |
| 725 | * @params: options string passed from mount | 743 | * @params: options string passed from mount |
| @@ -738,7 +756,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts) | |||
| 738 | opts->port = P9_PORT; | 756 | opts->port = P9_PORT; |
| 739 | opts->rfd = ~0; | 757 | opts->rfd = ~0; |
| 740 | opts->wfd = ~0; | 758 | opts->wfd = ~0; |
| 741 | opts->privport = 0; | 759 | opts->privport = false; |
| 742 | 760 | ||
| 743 | if (!params) | 761 | if (!params) |
| 744 | return 0; | 762 | return 0; |
| @@ -776,7 +794,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts) | |||
| 776 | opts->wfd = option; | 794 | opts->wfd = option; |
| 777 | break; | 795 | break; |
| 778 | case Opt_privport: | 796 | case Opt_privport: |
| 779 | opts->privport = 1; | 797 | opts->privport = true; |
| 780 | break; | 798 | break; |
| 781 | default: | 799 | default: |
| 782 | continue; | 800 | continue; |
| @@ -942,6 +960,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) | |||
| 942 | 960 | ||
| 943 | csocket = NULL; | 961 | csocket = NULL; |
| 944 | 962 | ||
| 963 | client->trans_opts.tcp.port = opts.port; | ||
| 964 | client->trans_opts.tcp.privport = opts.privport; | ||
| 945 | sin_server.sin_family = AF_INET; | 965 | sin_server.sin_family = AF_INET; |
| 946 | sin_server.sin_addr.s_addr = in_aton(addr); | 966 | sin_server.sin_addr.s_addr = in_aton(addr); |
| 947 | sin_server.sin_port = htons(opts.port); | 967 | sin_server.sin_port = htons(opts.port); |
| @@ -1020,6 +1040,8 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args) | |||
| 1020 | struct p9_fd_opts opts; | 1040 | struct p9_fd_opts opts; |
| 1021 | 1041 | ||
| 1022 | parse_opts(args, &opts); | 1042 | parse_opts(args, &opts); |
| 1043 | client->trans_opts.fd.rfd = opts.rfd; | ||
| 1044 | client->trans_opts.fd.wfd = opts.wfd; | ||
| 1023 | 1045 | ||
| 1024 | if (opts.rfd == ~0 || opts.wfd == ~0) { | 1046 | if (opts.rfd == ~0 || opts.wfd == ~0) { |
| 1025 | pr_err("Insufficient options for proto=fd\n"); | 1047 | pr_err("Insufficient options for proto=fd\n"); |
| @@ -1044,6 +1066,7 @@ static struct p9_trans_module p9_tcp_trans = { | |||
| 1044 | .request = p9_fd_request, | 1066 | .request = p9_fd_request, |
| 1045 | .cancel = p9_fd_cancel, | 1067 | .cancel = p9_fd_cancel, |
| 1046 | .cancelled = p9_fd_cancelled, | 1068 | .cancelled = p9_fd_cancelled, |
| 1069 | .show_options = p9_fd_show_options, | ||
| 1047 | .owner = THIS_MODULE, | 1070 | .owner = THIS_MODULE, |
| 1048 | }; | 1071 | }; |
| 1049 | 1072 | ||
| @@ -1056,6 +1079,7 @@ static struct p9_trans_module p9_unix_trans = { | |||
| 1056 | .request = p9_fd_request, | 1079 | .request = p9_fd_request, |
| 1057 | .cancel = p9_fd_cancel, | 1080 | .cancel = p9_fd_cancel, |
| 1058 | .cancelled = p9_fd_cancelled, | 1081 | .cancelled = p9_fd_cancelled, |
| 1082 | .show_options = p9_fd_show_options, | ||
| 1059 | .owner = THIS_MODULE, | 1083 | .owner = THIS_MODULE, |
| 1060 | }; | 1084 | }; |
| 1061 | 1085 | ||
| @@ -1068,6 +1092,7 @@ static struct p9_trans_module p9_fd_trans = { | |||
| 1068 | .request = p9_fd_request, | 1092 | .request = p9_fd_request, |
| 1069 | .cancel = p9_fd_cancel, | 1093 | .cancel = p9_fd_cancel, |
| 1070 | .cancelled = p9_fd_cancelled, | 1094 | .cancelled = p9_fd_cancelled, |
| 1095 | .show_options = p9_fd_show_options, | ||
| 1071 | .owner = THIS_MODULE, | 1096 | .owner = THIS_MODULE, |
| 1072 | }; | 1097 | }; |
| 1073 | 1098 | ||
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 553ed4ecb6a0..6d8e3031978f 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/parser.h> | 43 | #include <linux/parser.h> |
| 44 | #include <linux/semaphore.h> | 44 | #include <linux/semaphore.h> |
| 45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
| 46 | #include <linux/seq_file.h> | ||
| 46 | #include <net/9p/9p.h> | 47 | #include <net/9p/9p.h> |
| 47 | #include <net/9p/client.h> | 48 | #include <net/9p/client.h> |
| 48 | #include <net/9p/transport.h> | 49 | #include <net/9p/transport.h> |
| @@ -70,6 +71,8 @@ | |||
| 70 | * @dm_mr: DMA Memory Region pointer | 71 | * @dm_mr: DMA Memory Region pointer |
| 71 | * @lkey: The local access only memory region key | 72 | * @lkey: The local access only memory region key |
| 72 | * @timeout: Number of uSecs to wait for connection management events | 73 | * @timeout: Number of uSecs to wait for connection management events |
| 74 | * @privport: Whether a privileged port may be used | ||
| 75 | * @port: The port to use | ||
| 73 | * @sq_depth: The depth of the Send Queue | 76 | * @sq_depth: The depth of the Send Queue |
| 74 | * @sq_sem: Semaphore for the SQ | 77 | * @sq_sem: Semaphore for the SQ |
| 75 | * @rq_depth: The depth of the Receive Queue. | 78 | * @rq_depth: The depth of the Receive Queue. |
| @@ -95,6 +98,8 @@ struct p9_trans_rdma { | |||
| 95 | struct ib_qp *qp; | 98 | struct ib_qp *qp; |
| 96 | struct ib_cq *cq; | 99 | struct ib_cq *cq; |
| 97 | long timeout; | 100 | long timeout; |
| 101 | bool privport; | ||
| 102 | u16 port; | ||
| 98 | int sq_depth; | 103 | int sq_depth; |
| 99 | struct semaphore sq_sem; | 104 | struct semaphore sq_sem; |
| 100 | int rq_depth; | 105 | int rq_depth; |
| @@ -133,10 +138,10 @@ struct p9_rdma_context { | |||
| 133 | */ | 138 | */ |
| 134 | struct p9_rdma_opts { | 139 | struct p9_rdma_opts { |
| 135 | short port; | 140 | short port; |
| 141 | bool privport; | ||
| 136 | int sq_depth; | 142 | int sq_depth; |
| 137 | int rq_depth; | 143 | int rq_depth; |
| 138 | long timeout; | 144 | long timeout; |
| 139 | int privport; | ||
| 140 | }; | 145 | }; |
| 141 | 146 | ||
| 142 | /* | 147 | /* |
| @@ -159,6 +164,23 @@ static match_table_t tokens = { | |||
| 159 | {Opt_err, NULL}, | 164 | {Opt_err, NULL}, |
| 160 | }; | 165 | }; |
| 161 | 166 | ||
| 167 | static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt) | ||
| 168 | { | ||
| 169 | struct p9_trans_rdma *rdma = clnt->trans; | ||
| 170 | |||
| 171 | if (rdma->port != P9_PORT) | ||
| 172 | seq_printf(m, ",port=%u", rdma->port); | ||
| 173 | if (rdma->sq_depth != P9_RDMA_SQ_DEPTH) | ||
| 174 | seq_printf(m, ",sq=%u", rdma->sq_depth); | ||
| 175 | if (rdma->rq_depth != P9_RDMA_RQ_DEPTH) | ||
| 176 | seq_printf(m, ",rq=%u", rdma->rq_depth); | ||
| 177 | if (rdma->timeout != P9_RDMA_TIMEOUT) | ||
| 178 | seq_printf(m, ",timeout=%lu", rdma->timeout); | ||
| 179 | if (rdma->privport) | ||
| 180 | seq_puts(m, ",privport"); | ||
| 181 | return 0; | ||
| 182 | } | ||
| 183 | |||
| 162 | /** | 184 | /** |
| 163 | * parse_opts - parse mount options into rdma options structure | 185 | * parse_opts - parse mount options into rdma options structure |
| 164 | * @params: options string passed from mount | 186 | * @params: options string passed from mount |
| @@ -177,7 +199,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) | |||
| 177 | opts->sq_depth = P9_RDMA_SQ_DEPTH; | 199 | opts->sq_depth = P9_RDMA_SQ_DEPTH; |
| 178 | opts->rq_depth = P9_RDMA_RQ_DEPTH; | 200 | opts->rq_depth = P9_RDMA_RQ_DEPTH; |
| 179 | opts->timeout = P9_RDMA_TIMEOUT; | 201 | opts->timeout = P9_RDMA_TIMEOUT; |
| 180 | opts->privport = 0; | 202 | opts->privport = false; |
| 181 | 203 | ||
| 182 | if (!params) | 204 | if (!params) |
| 183 | return 0; | 205 | return 0; |
| @@ -218,7 +240,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) | |||
| 218 | opts->timeout = option; | 240 | opts->timeout = option; |
| 219 | break; | 241 | break; |
| 220 | case Opt_privport: | 242 | case Opt_privport: |
| 221 | opts->privport = 1; | 243 | opts->privport = true; |
| 222 | break; | 244 | break; |
| 223 | default: | 245 | default: |
| 224 | continue; | 246 | continue; |
| @@ -560,6 +582,8 @@ static struct p9_trans_rdma *alloc_rdma(struct p9_rdma_opts *opts) | |||
| 560 | if (!rdma) | 582 | if (!rdma) |
| 561 | return NULL; | 583 | return NULL; |
| 562 | 584 | ||
| 585 | rdma->port = opts->port; | ||
| 586 | rdma->privport = opts->privport; | ||
| 563 | rdma->sq_depth = opts->sq_depth; | 587 | rdma->sq_depth = opts->sq_depth; |
| 564 | rdma->rq_depth = opts->rq_depth; | 588 | rdma->rq_depth = opts->rq_depth; |
| 565 | rdma->timeout = opts->timeout; | 589 | rdma->timeout = opts->timeout; |
| @@ -733,6 +757,7 @@ static struct p9_trans_module p9_rdma_trans = { | |||
| 733 | .request = rdma_request, | 757 | .request = rdma_request, |
| 734 | .cancel = rdma_cancel, | 758 | .cancel = rdma_cancel, |
| 735 | .cancelled = rdma_cancelled, | 759 | .cancelled = rdma_cancelled, |
| 760 | .show_options = p9_rdma_show_options, | ||
| 736 | }; | 761 | }; |
| 737 | 762 | ||
| 738 | /** | 763 | /** |
