28 #include <linux/module.h>
29 #include <linux/errno.h>
30 #include <linux/kernel.h>
32 #include <linux/slab.h>
33 #include <linux/sched.h>
34 #include <linux/stddef.h>
35 #include <linux/types.h>
43 p9pdu_writef(
struct p9_fcall *
pdu,
int proto_version,
const char *
fmt, ...);
72 pdu_write_u(
struct p9_fcall *
pdu,
const char __user *udata,
size_t size)
98 p9pdu_vreadf(
struct p9_fcall *pdu,
int proto_version,
const char *
fmt,
104 for (ptr = fmt; *
ptr; ptr++) {
108 if (
pdu_read(pdu, val,
sizeof(*val))) {
117 if (
pdu_read(pdu, &le_val,
sizeof(le_val))) {
127 if (
pdu_read(pdu, &le_val,
sizeof(le_val))) {
135 int64_t *val =
va_arg(ap, int64_t *);
137 if (
pdu_read(pdu, &le_val,
sizeof(le_val))) {
145 char **sptr =
va_arg(ap,
char **);
214 char ***wnames =
va_arg(ap,
char ***);
220 kmalloc(
sizeof(
char *) * *nwname,
229 for (i = 0; i < *nwname; i++) {
244 for (i = 0; i < *nwname; i++)
273 for (i = 0; i < *nwqid; i++) {
297 "qQdddqqqqqqqqqqqqqqq",
341 for (ptr = fmt; *
ptr; ptr++) {
345 if (pdu_write(pdu, &val,
sizeof(val)))
351 if (pdu_write(pdu, &val,
sizeof(val)))
357 if (pdu_write(pdu, &val,
sizeof(val)))
363 if (pdu_write(pdu, &val,
sizeof(val)))
368 const char *sptr =
va_arg(ap,
const char *);
374 errcode = p9pdu_writef(pdu, proto_version,
376 if (!errcode && pdu_write(pdu, sptr, len))
384 p9pdu_writef(pdu, proto_version,
"bdq",
392 p9pdu_writef(pdu, proto_version,
405 const void *data =
va_arg(ap,
const void *);
407 errcode = p9pdu_writef(pdu, proto_version,
"d",
409 if (!errcode && pdu_write(pdu, data, count))
415 const char __user *udata =
417 errcode = p9pdu_writef(pdu, proto_version,
"d",
419 if (!errcode && pdu_write_u(pdu, udata, count))
425 const char **wnames =
va_arg(ap,
const char **);
427 errcode = p9pdu_writef(pdu, proto_version,
"w",
432 for (i = 0; i < nwname; i++) {
449 errcode = p9pdu_writef(pdu, proto_version,
"w",
454 for (i = 0; i < nwqid; i++) {
470 errcode = p9pdu_writef(pdu, proto_version,
506 ret = p9pdu_vreadf(pdu, proto_version, fmt, ap);
513 p9pdu_writef(
struct p9_fcall *pdu,
int proto_version,
const char *fmt, ...)
538 trace_9p_protocol_dump(clnt, &fake_pdu);
548 return p9pdu_writef(pdu, 0,
"dbw", 0, type, tag);
553 int size = pdu->
size;
557 err = p9pdu_writef(pdu, 0,
"d", size);
560 trace_9p_protocol_dump(clnt, pdu);
589 trace_9p_protocol_dump(clnt, &fake_pdu);