Lines Matching refs:clnt
68 inline int p9_is_proto_dotl(struct p9_client *clnt) in p9_is_proto_dotl() argument
70 return clnt->proto_version == p9_proto_2000L; in p9_is_proto_dotl()
74 inline int p9_is_proto_dotu(struct p9_client *clnt) in p9_is_proto_dotu() argument
76 return clnt->proto_version == p9_proto_2000u; in p9_is_proto_dotu()
122 static int parse_opts(char *opts, struct p9_client *clnt) in parse_opts() argument
131 clnt->proto_version = p9_proto_2000L; in parse_opts()
132 clnt->msize = 8192; in parse_opts()
165 clnt->msize = option; in parse_opts()
175 clnt->trans_mod = v9fs_get_trans_by_name(s); in parse_opts()
176 if (clnt->trans_mod == NULL) { in parse_opts()
186 clnt->proto_version = p9_proto_legacy; in parse_opts()
202 clnt->proto_version = ret; in parse_opts()
887 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()
898 ret = p9_idpool_get(clnt->fidpool); in p9_fid_create()
908 fid->clnt = clnt; in p9_fid_create()
910 spin_lock_irqsave(&clnt->lock, flags); in p9_fid_create()
911 list_add(&fid->flist, &clnt->fidlist); in p9_fid_create()
912 spin_unlock_irqrestore(&clnt->lock, flags); in p9_fid_create()
923 struct p9_client *clnt; in p9_fid_destroy() local
927 clnt = fid->clnt; in p9_fid_destroy()
928 p9_idpool_put(fid->fid, clnt->fidpool); in p9_fid_destroy()
929 spin_lock_irqsave(&clnt->lock, flags); in p9_fid_destroy()
931 spin_unlock_irqrestore(&clnt->lock, flags); in p9_fid_destroy()
1006 struct p9_client *clnt; in p9_client_create() local
1010 clnt = kmalloc(sizeof(struct p9_client), GFP_KERNEL); in p9_client_create()
1011 if (!clnt) in p9_client_create()
1014 clnt->trans_mod = NULL; in p9_client_create()
1015 clnt->trans = NULL; in p9_client_create()
1018 memcpy(clnt->name, client_id, strlen(client_id) + 1); in p9_client_create()
1020 spin_lock_init(&clnt->lock); in p9_client_create()
1021 INIT_LIST_HEAD(&clnt->fidlist); in p9_client_create()
1023 err = p9_tag_init(clnt); in p9_client_create()
1027 err = parse_opts(options, clnt); in p9_client_create()
1031 if (!clnt->trans_mod) in p9_client_create()
1032 clnt->trans_mod = v9fs_get_default_trans(); in p9_client_create()
1034 if (clnt->trans_mod == NULL) { in p9_client_create()
1041 clnt->fidpool = p9_idpool_create(); in p9_client_create()
1042 if (IS_ERR(clnt->fidpool)) { in p9_client_create()
1043 err = PTR_ERR(clnt->fidpool); in p9_client_create()
1048 clnt, clnt->trans_mod, clnt->msize, clnt->proto_version); in p9_client_create()
1050 err = clnt->trans_mod->create(clnt, dev_name, options); in p9_client_create()
1054 if (clnt->msize > clnt->trans_mod->maxsize) in p9_client_create()
1055 clnt->msize = clnt->trans_mod->maxsize; in p9_client_create()
1057 if (clnt->msize < 4096) { in p9_client_create()
1064 err = p9_client_version(clnt); in p9_client_create()
1068 return clnt; in p9_client_create()
1071 clnt->trans_mod->close(clnt); in p9_client_create()
1073 p9_idpool_destroy(clnt->fidpool); in p9_client_create()
1075 v9fs_put_trans(clnt->trans_mod); in p9_client_create()
1077 p9_idpool_destroy(clnt->tagpool); in p9_client_create()
1079 kfree(clnt); in p9_client_create()
1084 void p9_client_destroy(struct p9_client *clnt) in p9_client_destroy() argument
1088 p9_debug(P9_DEBUG_MUX, "clnt %p\n", clnt); in p9_client_destroy()
1090 if (clnt->trans_mod) in p9_client_destroy()
1091 clnt->trans_mod->close(clnt); in p9_client_destroy()
1093 v9fs_put_trans(clnt->trans_mod); in p9_client_destroy()
1095 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) { in p9_client_destroy()
1100 if (clnt->fidpool) in p9_client_destroy()
1101 p9_idpool_destroy(clnt->fidpool); in p9_client_destroy()
1103 p9_tag_cleanup(clnt); in p9_client_destroy()
1105 kfree(clnt); in p9_client_destroy()
1109 void p9_client_disconnect(struct p9_client *clnt) in p9_client_disconnect() argument
1111 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt); in p9_client_disconnect()
1112 clnt->status = Disconnected; in p9_client_disconnect()
1116 void p9_client_begin_disconnect(struct p9_client *clnt) in p9_client_begin_disconnect() argument
1118 p9_debug(P9_DEBUG_9P, "clnt %p\n", clnt); in p9_client_begin_disconnect()
1119 clnt->status = BeginDisconnect; in p9_client_begin_disconnect()
1123 struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, in p9_client_attach() argument
1134 fid = p9_fid_create(clnt); in p9_client_attach()
1142 req = p9_client_rpc(clnt, P9_TATTACH, "ddss?u", fid->fid, in p9_client_attach()
1149 err = p9pdu_readf(req->rc, clnt->proto_version, "Q", &qid); in p9_client_attach()
1151 trace_9p_protocol_dump(clnt, req->rc); in p9_client_attach()
1152 p9_free_req(clnt, req); in p9_client_attach()
1161 p9_free_req(clnt, req); in p9_client_attach()
1175 struct p9_client *clnt; in p9_client_walk() local
1183 clnt = oldfid->clnt; in p9_client_walk()
1185 fid = p9_fid_create(clnt); in p9_client_walk()
1200 req = p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, in p9_client_walk()
1207 err = p9pdu_readf(req->rc, clnt->proto_version, "R", &nwqids, &wqids); in p9_client_walk()
1209 trace_9p_protocol_dump(clnt, req->rc); in p9_client_walk()
1210 p9_free_req(clnt, req); in p9_client_walk()
1213 p9_free_req(clnt, req); in p9_client_walk()
1252 struct p9_client *clnt; in p9_client_open() local
1257 clnt = fid->clnt; in p9_client_open()
1259 p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); in p9_client_open()
1265 if (p9_is_proto_dotl(clnt)) in p9_client_open()
1266 req = p9_client_rpc(clnt, P9_TLOPEN, "dd", fid->fid, mode); in p9_client_open()
1268 req = p9_client_rpc(clnt, P9_TOPEN, "db", fid->fid, mode); in p9_client_open()
1274 err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); in p9_client_open()
1276 trace_9p_protocol_dump(clnt, req->rc); in p9_client_open()
1281 p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type, in p9_client_open()
1288 p9_free_req(clnt, req); in p9_client_open()
1298 struct p9_client *clnt; in p9_client_create_dotl() local
1306 clnt = ofid->clnt; in p9_client_create_dotl()
1311 req = p9_client_rpc(clnt, P9_TLCREATE, "dsddg", ofid->fid, name, flags, in p9_client_create_dotl()
1318 err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", qid, &iounit); in p9_client_create_dotl()
1320 trace_9p_protocol_dump(clnt, req->rc); in p9_client_create_dotl()
1333 p9_free_req(clnt, req); in p9_client_create_dotl()
1343 struct p9_client *clnt; in p9_client_fcreate() local
1351 clnt = fid->clnt; in p9_client_fcreate()
1356 req = p9_client_rpc(clnt, P9_TCREATE, "dsdb?s", fid->fid, name, perm, in p9_client_fcreate()
1363 err = p9pdu_readf(req->rc, clnt->proto_version, "Qd", &qid, &iounit); in p9_client_fcreate()
1365 trace_9p_protocol_dump(clnt, req->rc); in p9_client_fcreate()
1378 p9_free_req(clnt, req); in p9_client_fcreate()
1388 struct p9_client *clnt; in p9_client_symlink() local
1393 clnt = dfid->clnt; in p9_client_symlink()
1395 req = p9_client_rpc(clnt, P9_TSYMLINK, "dssg", dfid->fid, name, symtgt, in p9_client_symlink()
1402 err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); in p9_client_symlink()
1404 trace_9p_protocol_dump(clnt, req->rc); in p9_client_symlink()
1412 p9_free_req(clnt, req); in p9_client_symlink()
1420 struct p9_client *clnt; in p9_client_link() local
1425 clnt = dfid->clnt; in p9_client_link()
1426 req = p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid, in p9_client_link()
1432 p9_free_req(clnt, req); in p9_client_link()
1440 struct p9_client *clnt; in p9_client_fsync() local
1446 clnt = fid->clnt; in p9_client_fsync()
1448 req = p9_client_rpc(clnt, P9_TFSYNC, "dd", fid->fid, datasync); in p9_client_fsync()
1456 p9_free_req(clnt, req); in p9_client_fsync()
1466 struct p9_client *clnt; in p9_client_clunk() local
1481 clnt = fid->clnt; in p9_client_clunk()
1483 req = p9_client_rpc(clnt, P9_TCLUNK, "d", fid->fid); in p9_client_clunk()
1491 p9_free_req(clnt, req); in p9_client_clunk()
1510 struct p9_client *clnt; in p9_client_remove() local
1515 clnt = fid->clnt; in p9_client_remove()
1517 req = p9_client_rpc(clnt, P9_TREMOVE, "d", fid->fid); in p9_client_remove()
1525 p9_free_req(clnt, req); in p9_client_remove()
1539 struct p9_client *clnt; in p9_client_unlinkat() local
1544 clnt = dfid->clnt; in p9_client_unlinkat()
1545 req = p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->fid, name, flags); in p9_client_unlinkat()
1552 p9_free_req(clnt, req); in p9_client_unlinkat()
1561 struct p9_client *clnt = fid->clnt; in p9_client_read() local
1575 if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) in p9_client_read()
1576 rsize = clnt->msize - P9_IOHDRSZ; in p9_client_read()
1582 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_read()
1587 req = p9_client_zc_rpc(clnt, P9_TREAD, to, NULL, rsize, in p9_client_read()
1592 req = p9_client_rpc(clnt, P9_TREAD, "dqd", fid->fid, offset, in p9_client_read()
1600 *err = p9pdu_readf(req->rc, clnt->proto_version, in p9_client_read()
1603 trace_9p_protocol_dump(clnt, req->rc); in p9_client_read()
1604 p9_free_req(clnt, req); in p9_client_read()
1614 p9_free_req(clnt, req); in p9_client_read()
1624 p9_free_req(clnt, req); in p9_client_read()
1632 p9_free_req(clnt, req); in p9_client_read()
1641 struct p9_client *clnt = fid->clnt; in p9_client_write() local
1653 if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) in p9_client_write()
1654 rsize = clnt->msize - P9_IOHDRSZ; in p9_client_write()
1660 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_write()
1661 req = p9_client_zc_rpc(clnt, P9_TWRITE, NULL, from, 0, in p9_client_write()
1665 req = p9_client_rpc(clnt, P9_TWRITE, "dqV", fid->fid, in p9_client_write()
1673 *err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); in p9_client_write()
1675 trace_9p_protocol_dump(clnt, req->rc); in p9_client_write()
1676 p9_free_req(clnt, req); in p9_client_write()
1686 p9_free_req(clnt, req); in p9_client_write()
1698 struct p9_client *clnt; in p9_client_stat() local
1709 clnt = fid->clnt; in p9_client_stat()
1711 req = p9_client_rpc(clnt, P9_TSTAT, "d", fid->fid); in p9_client_stat()
1717 err = p9pdu_readf(req->rc, clnt->proto_version, "wS", &ignored, ret); in p9_client_stat()
1719 trace_9p_protocol_dump(clnt, req->rc); in p9_client_stat()
1720 p9_free_req(clnt, req); in p9_client_stat()
1737 p9_free_req(clnt, req); in p9_client_stat()
1750 struct p9_client *clnt; in p9_client_getattr_dotl() local
1762 clnt = fid->clnt; in p9_client_getattr_dotl()
1764 req = p9_client_rpc(clnt, P9_TGETATTR, "dq", fid->fid, request_mask); in p9_client_getattr_dotl()
1770 err = p9pdu_readf(req->rc, clnt->proto_version, "A", ret); in p9_client_getattr_dotl()
1772 trace_9p_protocol_dump(clnt, req->rc); in p9_client_getattr_dotl()
1773 p9_free_req(clnt, req); in p9_client_getattr_dotl()
1798 p9_free_req(clnt, req); in p9_client_getattr_dotl()
1840 struct p9_client *clnt; in p9_client_wstat() local
1843 clnt = fid->clnt; in p9_client_wstat()
1844 wst->size = p9_client_statsize(wst, clnt->proto_version); in p9_client_wstat()
1859 req = p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size+2, wst); in p9_client_wstat()
1867 p9_free_req(clnt, req); in p9_client_wstat()
1877 struct p9_client *clnt; in p9_client_setattr() local
1880 clnt = fid->clnt; in p9_client_setattr()
1892 req = p9_client_rpc(clnt, P9_TSETATTR, "dI", fid->fid, p9attr); in p9_client_setattr()
1899 p9_free_req(clnt, req); in p9_client_setattr()
1909 struct p9_client *clnt; in p9_client_statfs() local
1912 clnt = fid->clnt; in p9_client_statfs()
1916 req = p9_client_rpc(clnt, P9_TSTATFS, "d", fid->fid); in p9_client_statfs()
1922 err = p9pdu_readf(req->rc, clnt->proto_version, "ddqqqqqqd", &sb->type, in p9_client_statfs()
1926 trace_9p_protocol_dump(clnt, req->rc); in p9_client_statfs()
1927 p9_free_req(clnt, req); in p9_client_statfs()
1938 p9_free_req(clnt, req); in p9_client_statfs()
1949 struct p9_client *clnt; in p9_client_rename() local
1952 clnt = fid->clnt; in p9_client_rename()
1957 req = p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid, in p9_client_rename()
1966 p9_free_req(clnt, req); in p9_client_rename()
1977 struct p9_client *clnt; in p9_client_renameat() local
1980 clnt = olddirfid->clnt; in p9_client_renameat()
1986 req = p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid, in p9_client_renameat()
1996 p9_free_req(clnt, req); in p9_client_renameat()
2010 struct p9_client *clnt; in p9_client_xattrwalk() local
2014 clnt = file_fid->clnt; in p9_client_xattrwalk()
2015 attr_fid = p9_fid_create(clnt); in p9_client_xattrwalk()
2025 req = p9_client_rpc(clnt, P9_TXATTRWALK, "dds", in p9_client_xattrwalk()
2031 err = p9pdu_readf(req->rc, clnt->proto_version, "q", attr_size); in p9_client_xattrwalk()
2033 trace_9p_protocol_dump(clnt, req->rc); in p9_client_xattrwalk()
2034 p9_free_req(clnt, req); in p9_client_xattrwalk()
2037 p9_free_req(clnt, req); in p9_client_xattrwalk()
2057 struct p9_client *clnt; in p9_client_xattrcreate() local
2063 clnt = fid->clnt; in p9_client_xattrcreate()
2064 req = p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd", in p9_client_xattrcreate()
2071 p9_free_req(clnt, req); in p9_client_xattrcreate()
2080 struct p9_client *clnt; in p9_client_readdir() local
2092 clnt = fid->clnt; in p9_client_readdir()
2095 if (!rsize || rsize > clnt->msize-P9_READDIRHDRSZ) in p9_client_readdir()
2096 rsize = clnt->msize - P9_READDIRHDRSZ; in p9_client_readdir()
2102 if (clnt->trans_mod->zc_request && rsize > 1024) { in p9_client_readdir()
2107 req = p9_client_zc_rpc(clnt, P9_TREADDIR, &to, NULL, rsize, 0, in p9_client_readdir()
2111 req = p9_client_rpc(clnt, P9_TREADDIR, "dqd", fid->fid, in p9_client_readdir()
2119 err = p9pdu_readf(req->rc, clnt->proto_version, "D", &count, &dataptr); in p9_client_readdir()
2121 trace_9p_protocol_dump(clnt, req->rc); in p9_client_readdir()
2134 p9_free_req(clnt, req); in p9_client_readdir()
2138 p9_free_req(clnt, req); in p9_client_readdir()
2148 struct p9_client *clnt; in p9_client_mknod_dotl() local
2152 clnt = fid->clnt; in p9_client_mknod_dotl()
2155 req = p9_client_rpc(clnt, P9_TMKNOD, "dsdddg", fid->fid, name, mode, in p9_client_mknod_dotl()
2160 err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); in p9_client_mknod_dotl()
2162 trace_9p_protocol_dump(clnt, req->rc); in p9_client_mknod_dotl()
2169 p9_free_req(clnt, req); in p9_client_mknod_dotl()
2179 struct p9_client *clnt; in p9_client_mkdir_dotl() local
2183 clnt = fid->clnt; in p9_client_mkdir_dotl()
2186 req = p9_client_rpc(clnt, P9_TMKDIR, "dsdg", fid->fid, name, mode, in p9_client_mkdir_dotl()
2191 err = p9pdu_readf(req->rc, clnt->proto_version, "Q", qid); in p9_client_mkdir_dotl()
2193 trace_9p_protocol_dump(clnt, req->rc); in p9_client_mkdir_dotl()
2200 p9_free_req(clnt, req); in p9_client_mkdir_dotl()
2209 struct p9_client *clnt; in p9_client_lock_dotl() local
2213 clnt = fid->clnt; in p9_client_lock_dotl()
2219 req = p9_client_rpc(clnt, P9_TLOCK, "dbdqqds", fid->fid, flock->type, in p9_client_lock_dotl()
2226 err = p9pdu_readf(req->rc, clnt->proto_version, "b", status); in p9_client_lock_dotl()
2228 trace_9p_protocol_dump(clnt, req->rc); in p9_client_lock_dotl()
2233 p9_free_req(clnt, req); in p9_client_lock_dotl()
2242 struct p9_client *clnt; in p9_client_getlock_dotl() local
2246 clnt = fid->clnt; in p9_client_getlock_dotl()
2251 req = p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid, glock->type, in p9_client_getlock_dotl()
2257 err = p9pdu_readf(req->rc, clnt->proto_version, "bqqds", &glock->type, in p9_client_getlock_dotl()
2261 trace_9p_protocol_dump(clnt, req->rc); in p9_client_getlock_dotl()
2268 p9_free_req(clnt, req); in p9_client_getlock_dotl()
2276 struct p9_client *clnt; in p9_client_readlink() local
2280 clnt = fid->clnt; in p9_client_readlink()
2283 req = p9_client_rpc(clnt, P9_TREADLINK, "d", fid->fid); in p9_client_readlink()
2287 err = p9pdu_readf(req->rc, clnt->proto_version, "s", target); in p9_client_readlink()
2289 trace_9p_protocol_dump(clnt, req->rc); in p9_client_readlink()
2294 p9_free_req(clnt, req); in p9_client_readlink()