Lines Matching refs:clnt

54 inline int p9_is_proto_dotl(struct p9_client *clnt)  in p9_is_proto_dotl()  argument
56 return clnt->proto_version == p9_proto_2000L; in p9_is_proto_dotl()
60 inline int p9_is_proto_dotu(struct p9_client *clnt) in p9_is_proto_dotu() argument
62 return clnt->proto_version == p9_proto_2000u; in p9_is_proto_dotu()
66 int p9_show_client_options(struct seq_file *m, struct p9_client *clnt) in p9_show_client_options() argument
68 if (clnt->msize != 8192) in p9_show_client_options()
69 seq_printf(m, ",msize=%u", clnt->msize); in p9_show_client_options()
70 seq_printf(m, ",trans=%s", clnt->trans_mod->name); in p9_show_client_options()
72 switch (clnt->proto_version) { in p9_show_client_options()
84 if (clnt->trans_mod->show_options) in p9_show_client_options()
85 return clnt->trans_mod->show_options(m, clnt); in p9_show_client_options()
132 static int parse_opts(char *opts, struct p9_client *clnt) in parse_opts() argument
141 clnt->proto_version = p9_proto_2000L; in parse_opts()
142 clnt->msize = 8192; in parse_opts()
175 clnt->msize = option; in parse_opts()
186 v9fs_put_trans(clnt->trans_mod); in parse_opts()
187 clnt->trans_mod = v9fs_get_trans_by_name(s); in parse_opts()
188 if (clnt->trans_mod == NULL) { in parse_opts()
196 clnt->proto_version = p9_proto_legacy; in parse_opts()
210 clnt->proto_version = r; in parse_opts()
220 v9fs_put_trans(clnt->trans_mod); in parse_opts()
888 static struct p9_fid *p9_fid_create(struct p9_client *clnt) in p9_fid_create() argument
893 p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt); in p9_fid_create()
901 fid->clnt = clnt; in p9_fid_create()
906 spin_lock_irq(&clnt->lock); in p9_fid_create()
907 ret = idr_alloc_u32(&clnt->fids, fid, &fid->fid, P9_NOFID - 1, in p9_fid_create()
909 spin_unlock_irq(&clnt->lock); in p9_fid_create()
921 struct p9_client *clnt; in p9_fid_destroy() local
925 clnt = fid->clnt; in p9_fid_destroy()
926 spin_lock_irqsave(&clnt->lock, flags); in p9_fid_destroy()
927 idr_remove(&clnt->fids, fid->fid); in p9_fid_destroy()
928 spin_unlock_irqrestore(&clnt->lock, flags); in p9_fid_destroy()
1003 struct p9_client *clnt; in p9_client_create() local
1007 clnt = kmalloc(sizeof(struct p9_client), GFP_KERNEL); in p9_client_create()
1008 if (!clnt) in p9_client_create()
1011 clnt->trans_mod = NULL; in p9_client_create()
1012 clnt->trans = NULL; in p9_client_create()
1013 clnt->fcall_cache = NULL; in p9_client_create()
1016 memcpy(clnt->name, client_id, strlen(client_id) + 1); in p9_client_create()
1018 spin_lock_init(&clnt->lock); in p9_client_create()
1019 idr_init(&clnt->fids); in p9_client_create()
1020 idr_init(&clnt->reqs); in p9_client_create()
1022 err = parse_opts(options, clnt); in p9_client_create()
1026 if (!clnt->trans_mod) in p9_client_create()
1027 clnt->trans_mod = v9fs_get_default_trans(); in p9_client_create()
1029 if (clnt->trans_mod == NULL) { in p9_client_create()
1037 clnt, clnt->trans_mod, clnt->msize, clnt->proto_version); in p9_client_create()
1039 err = clnt->trans_mod->create(clnt, dev_name, options); in p9_client_create()
1043 if (clnt->msize > clnt->trans_mod->maxsize) in p9_client_create()
1044 clnt->msize = clnt->trans_mod->maxsize; in p9_client_create()
1046 if (clnt->msize < 4096) { in p9_client_create()
1053 err = p9_client_version(clnt); in p9_client_create()
1060 clnt->fcall_cache = in p9_client_create()
1061 kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize, in p9_client_create()
1063 clnt->msize - (P9_HDRSZ + 4), in p9_client_create()
1066 return clnt; in p9_client_create()
1069 clnt->trans_mod->close(clnt); in p9_client_create()
1071 v9fs_put_trans(clnt->trans_mod); in p9_client_create()
1073 kfree(clnt); in p9_client_create()
1078 void p9_client_destroy(struct p9_client *clnt) in p9_client_destroy() argument
1083 p9_debug(P9_DEBUG_MUX, "clnt %p\n", clnt); in p9_client_destroy()
1085 if (clnt->trans_mod) in p9_client_destroy()
1086 clnt->trans_mod->close(clnt); in p9_client_destroy()
1088 v9fs_put_trans(clnt->trans_mod); in p9_client_destroy()
1090 idr_for_each_entry(&clnt->fids, fid, id) { in p9_client_destroy()
1095 p9_tag_cleanup(clnt); in p9_client_destroy()
1097 kmem_cache_destroy(clnt->fcall_cache); in p9_client_destroy()
1098 kfree(clnt); in p9_client_destroy()
1102 void p9_client_disconnect(struct p9_client *clnt) in p9_client_disconnect() argument
1104 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt); in p9_client_disconnect()
1105 clnt->status = Disconnected; in p9_client_disconnect()
1109 void p9_client_begin_disconnect(struct p9_client *clnt) in p9_client_begin_disconnect() argument
1111 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt); in p9_client_begin_disconnect()
1112 clnt->status = BeginDisconnect; in p9_client_begin_disconnect()
1116 struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, in p9_client_attach() argument
1127 fid = p9_fid_create(clnt); in p9_client_attach()
1134 req = p9_client_rpc(clnt, P9_TATTACH, "ddss?u", fid->fid, in p9_client_attach()
1141 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", &qid); in p9_client_attach()
1143 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_attach()
1144 p9_tag_remove(clnt, req); in p9_client_attach()
1153 p9_tag_remove(clnt, req); in p9_client_attach()
1167 struct p9_client *clnt; in p9_client_walk() local
1175 clnt = oldfid->clnt; in p9_client_walk()
1177 fid = p9_fid_create(clnt); in p9_client_walk()
1191 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, in p9_client_walk()
1198 err = p9pdu_readf(&req->rc, clnt->proto_version, "R", &nwqids, &wqids); in p9_client_walk()
1200 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_walk()
1201 p9_tag_remove(clnt, req); in p9_client_walk()
1204 p9_tag_remove(clnt, req); in p9_client_walk()
1243 struct p9_client *clnt; in p9_client_open() local
1248 clnt = fid->clnt; in p9_client_open()
1250 p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); in p9_client_open()
1256 if (p9_is_proto_dotl(clnt)) in p9_client_open()
1257 req = p9_client_rpc(clnt, P9_TLOPEN, "dd", fid->fid, mode); in p9_client_open()
1259 req = p9_client_rpc(clnt, P9_TOPEN, "db", fid->fid, mode); in p9_client_open()
1265 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit); in p9_client_open()
1267 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_open()
1272 p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type, in p9_client_open()
1279 p9_tag_remove(clnt, req); in p9_client_open()
1289 struct p9_client *clnt; in p9_client_create_dotl() local
1297 clnt = ofid->clnt; in p9_client_create_dotl()
1302 req = p9_client_rpc(clnt, P9_TLCREATE, "dsddg", ofid->fid, name, flags, in p9_client_create_dotl()
1309 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", qid, &iounit); in p9_client_create_dotl()
1311 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_create_dotl()
1324 p9_tag_remove(clnt, req); in p9_client_create_dotl()
1334 struct p9_client *clnt; in p9_client_fcreate() local
1342 clnt = fid->clnt; in p9_client_fcreate()
1347 req = p9_client_rpc(clnt, P9_TCREATE, "dsdb?s", fid->fid, name, perm, in p9_client_fcreate()
1354 err = p9pdu_readf(&req->rc, clnt->proto_version, "Qd", &qid, &iounit); in p9_client_fcreate()
1356 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_fcreate()
1369 p9_tag_remove(clnt, req); in p9_client_fcreate()
1379 struct p9_client *clnt; in p9_client_symlink() local
1384 clnt = dfid->clnt; in p9_client_symlink()
1386 req = p9_client_rpc(clnt, P9_TSYMLINK, "dssg", dfid->fid, name, symtgt, in p9_client_symlink()
1393 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); in p9_client_symlink()
1395 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_symlink()
1403 p9_tag_remove(clnt, req); in p9_client_symlink()
1411 struct p9_client *clnt; in p9_client_link() local
1416 clnt = dfid->clnt; in p9_client_link()
1417 req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid, in p9_client_link()
1423 p9_tag_remove(clnt, req); in p9_client_link()
1431 struct p9_client *clnt; in p9_client_fsync() local
1437 clnt = fid->clnt; in p9_client_fsync()
1439 req = p9_client_rpc(clnt, P9_TFSYNC, "dd", fid->fid, datasync); in p9_client_fsync()
1447 p9_tag_remove(clnt, req); in p9_client_fsync()
1457 struct p9_client *clnt; in p9_client_clunk() local
1472 clnt = fid->clnt; in p9_client_clunk()
1474 req = p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid); in p9_client_clunk()
1482 p9_tag_remove(clnt, req); in p9_client_clunk()
1501 struct p9_client *clnt; in p9_client_remove() local
1506 clnt = fid->clnt; in p9_client_remove()
1508 req = p9_client_rpc(clnt, P9_TREMOVE, "d", fid->fid); in p9_client_remove()
1516 p9_tag_remove(clnt, req); in p9_client_remove()
1530 struct p9_client *clnt; in p9_client_unlinkat() local
1535 clnt = dfid->clnt; in p9_client_unlinkat()
1536 req = p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->fid, name, flags); in p9_client_unlinkat()
1543 p9_tag_remove(clnt, req); in p9_client_unlinkat()
1552 struct p9_client *clnt = fid->clnt; in p9_client_read() local
1566 if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) in p9_client_read()
1567 rsize = clnt->msize - P9_IOHDRSZ; in p9_client_read()
1573 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_read()
1578 req = p9_client_zc_rpc(clnt, P9_TREAD, to, NULL, rsize, in p9_client_read()
1583 req = p9_client_rpc(clnt, P9_TREAD, "dqd", fid->fid, offset, in p9_client_read()
1591 *err = p9pdu_readf(&req->rc, clnt->proto_version, in p9_client_read()
1594 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_read()
1595 p9_tag_remove(clnt, req); in p9_client_read()
1605 p9_tag_remove(clnt, req); in p9_client_read()
1615 p9_tag_remove(clnt, req); in p9_client_read()
1623 p9_tag_remove(clnt, req); in p9_client_read()
1632 struct p9_client *clnt = fid->clnt; in p9_client_write() local
1644 if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) in p9_client_write()
1645 rsize = clnt->msize - P9_IOHDRSZ; in p9_client_write()
1651 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_write()
1652 req = p9_client_zc_rpc(clnt, P9_TWRITE, NULL, from, 0, in p9_client_write()
1656 req = p9_client_rpc(clnt, P9_TWRITE, "dqV", fid->fid, in p9_client_write()
1664 *err = p9pdu_readf(&req->rc, clnt->proto_version, "d", &count); in p9_client_write()
1666 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_write()
1667 p9_tag_remove(clnt, req); in p9_client_write()
1677 p9_tag_remove(clnt, req); in p9_client_write()
1689 struct p9_client *clnt; in p9_client_stat() local
1700 clnt = fid->clnt; in p9_client_stat()
1702 req = p9_client_rpc(clnt, P9_TSTAT, "d", fid->fid); in p9_client_stat()
1708 err = p9pdu_readf(&req->rc, clnt->proto_version, "wS", &ignored, ret); in p9_client_stat()
1710 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_stat()
1711 p9_tag_remove(clnt, req); in p9_client_stat()
1728 p9_tag_remove(clnt, req); in p9_client_stat()
1741 struct p9_client *clnt; in p9_client_getattr_dotl() local
1753 clnt = fid->clnt; in p9_client_getattr_dotl()
1755 req = p9_client_rpc(clnt, P9_TGETATTR, "dq", fid->fid, request_mask); in p9_client_getattr_dotl()
1761 err = p9pdu_readf(&req->rc, clnt->proto_version, "A", ret); in p9_client_getattr_dotl()
1763 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_getattr_dotl()
1764 p9_tag_remove(clnt, req); in p9_client_getattr_dotl()
1789 p9_tag_remove(clnt, req); in p9_client_getattr_dotl()
1831 struct p9_client *clnt; in p9_client_wstat() local
1834 clnt = fid->clnt; in p9_client_wstat()
1835 wst->size = p9_client_statsize(wst, clnt->proto_version); in p9_client_wstat()
1850 req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size+2, wst); in p9_client_wstat()
1858 p9_tag_remove(clnt, req); in p9_client_wstat()
1868 struct p9_client *clnt; in p9_client_setattr() local
1871 clnt = fid->clnt; in p9_client_setattr()
1883 req = p9_client_rpc(clnt, P9_TSETATTR, "dI", fid->fid, p9attr); in p9_client_setattr()
1890 p9_tag_remove(clnt, req); in p9_client_setattr()
1900 struct p9_client *clnt; in p9_client_statfs() local
1903 clnt = fid->clnt; in p9_client_statfs()
1907 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid); in p9_client_statfs()
1913 err = p9pdu_readf(&req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type, in p9_client_statfs()
1917 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_statfs()
1918 p9_tag_remove(clnt, req); in p9_client_statfs()
1929 p9_tag_remove(clnt, req); in p9_client_statfs()
1940 struct p9_client *clnt; in p9_client_rename() local
1943 clnt = fid->clnt; in p9_client_rename()
1948 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid, in p9_client_rename()
1957 p9_tag_remove(clnt, req); in p9_client_rename()
1968 struct p9_client *clnt; in p9_client_renameat() local
1971 clnt = olddirfid->clnt; in p9_client_renameat()
1977 req = p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid, in p9_client_renameat()
1987 p9_tag_remove(clnt, req); in p9_client_renameat()
2001 struct p9_client *clnt; in p9_client_xattrwalk() local
2005 clnt = file_fid->clnt; in p9_client_xattrwalk()
2006 attr_fid = p9_fid_create(clnt); in p9_client_xattrwalk()
2015 req = p9_client_rpc(clnt, P9_TXATTRWALK, "dds", in p9_client_xattrwalk()
2021 err = p9pdu_readf(&req->rc, clnt->proto_version, "q", attr_size); in p9_client_xattrwalk()
2023 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_xattrwalk()
2024 p9_tag_remove(clnt, req); in p9_client_xattrwalk()
2027 p9_tag_remove(clnt, req); in p9_client_xattrwalk()
2047 struct p9_client *clnt; in p9_client_xattrcreate() local
2053 clnt = fid->clnt; in p9_client_xattrcreate()
2054 req = p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd", in p9_client_xattrcreate()
2061 p9_tag_remove(clnt, req); in p9_client_xattrcreate()
2070 struct p9_client *clnt; in p9_client_readdir() local
2082 clnt = fid->clnt; in p9_client_readdir()
2085 if (!rsize || rsize > clnt->msize-P9_READDIRHDRSZ) in p9_client_readdir()
2086 rsize = clnt->msize - P9_READDIRHDRSZ; in p9_client_readdir()
2092 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_readdir()
2097 req = p9_client_zc_rpc(clnt, P9_TREADDIR, &to, NULL, rsize, 0, in p9_client_readdir()
2101 req = p9_client_rpc(clnt, P9_TREADDIR, "dqd", fid->fid, in p9_client_readdir()
2109 err = p9pdu_readf(&req->rc, clnt->proto_version, "D", &count, &dataptr); in p9_client_readdir()
2111 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_readdir()
2124 p9_tag_remove(clnt, req); in p9_client_readdir()
2128 p9_tag_remove(clnt, req); in p9_client_readdir()
2138 struct p9_client *clnt; in p9_client_mknod_dotl() local
2142 clnt = fid->clnt; in p9_client_mknod_dotl()
2145 req = p9_client_rpc(clnt, P9_TMKNOD, "dsdddg", fid->fid, name, mode, in p9_client_mknod_dotl()
2150 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); in p9_client_mknod_dotl()
2152 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_mknod_dotl()
2159 p9_tag_remove(clnt, req); in p9_client_mknod_dotl()
2169 struct p9_client *clnt; in p9_client_mkdir_dotl() local
2173 clnt = fid->clnt; in p9_client_mkdir_dotl()
2176 req = p9_client_rpc(clnt, P9_TMKDIR, "dsdg", fid->fid, name, mode, in p9_client_mkdir_dotl()
2181 err = p9pdu_readf(&req->rc, clnt->proto_version, "Q", qid); in p9_client_mkdir_dotl()
2183 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_mkdir_dotl()
2190 p9_tag_remove(clnt, req); in p9_client_mkdir_dotl()
2199 struct p9_client *clnt; in p9_client_lock_dotl() local
2203 clnt = fid->clnt; in p9_client_lock_dotl()
2209 req = p9_client_rpc(clnt, P9_TLOCK, "dbdqqds", fid->fid, flock->type, in p9_client_lock_dotl()
2216 err = p9pdu_readf(&req->rc, clnt->proto_version, "b", status); in p9_client_lock_dotl()
2218 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_lock_dotl()
2223 p9_tag_remove(clnt, req); in p9_client_lock_dotl()
2232 struct p9_client *clnt; in p9_client_getlock_dotl() local
2236 clnt = fid->clnt; in p9_client_getlock_dotl()
2241 req = p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid, glock->type, in p9_client_getlock_dotl()
2247 err = p9pdu_readf(&req->rc, clnt->proto_version, "bqqds", &glock->type, in p9_client_getlock_dotl()
2251 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_getlock_dotl()
2258 p9_tag_remove(clnt, req); in p9_client_getlock_dotl()
2266 struct p9_client *clnt; in p9_client_readlink() local
2270 clnt = fid->clnt; in p9_client_readlink()
2273 req = p9_client_rpc(clnt, P9_TREADLINK, "d", fid->fid); in p9_client_readlink()
2277 err = p9pdu_readf(&req->rc, clnt->proto_version, "s", target); in p9_client_readlink()
2279 trace_9p_protocol_dump(clnt, &req->rc); in p9_client_readlink()
2284 p9_tag_remove(clnt, req); in p9_client_readlink()