diff options
Diffstat (limited to 'net/9p/protocol.c')
-rw-r--r-- | net/9p/protocol.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 149f82160130..b645c8263538 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c | |||
@@ -580,3 +580,30 @@ void p9pdu_reset(struct p9_fcall *pdu) | |||
580 | pdu->offset = 0; | 580 | pdu->offset = 0; |
581 | pdu->size = 0; | 581 | pdu->size = 0; |
582 | } | 582 | } |
583 | |||
584 | int p9dirent_read(char *buf, int len, struct p9_dirent *dirent, | ||
585 | int proto_version) | ||
586 | { | ||
587 | struct p9_fcall fake_pdu; | ||
588 | int ret; | ||
589 | char *nameptr; | ||
590 | |||
591 | fake_pdu.size = len; | ||
592 | fake_pdu.capacity = len; | ||
593 | fake_pdu.sdata = buf; | ||
594 | fake_pdu.offset = 0; | ||
595 | |||
596 | ret = p9pdu_readf(&fake_pdu, proto_version, "Qqbs", &dirent->qid, | ||
597 | &dirent->d_off, &dirent->d_type, &nameptr); | ||
598 | if (ret) { | ||
599 | P9_DPRINTK(P9_DEBUG_9P, "<<< p9dirent_read failed: %d\n", ret); | ||
600 | p9pdu_dump(1, &fake_pdu); | ||
601 | goto out; | ||
602 | } | ||
603 | |||
604 | strcpy(dirent->d_name, nameptr); | ||
605 | |||
606 | out: | ||
607 | return fake_pdu.offset; | ||
608 | } | ||
609 | EXPORT_SYMBOL(p9dirent_read); | ||