9p/fd: Use P9_HDRSZ for header size

[ Upstream commit 6854fadbee ]

Cleanup hardcoded header sizes to use P9_HDRSZ instead of '7'

Link: https://lkml.kernel.org/r/20221117091159.31533-4-guozihua@huawei.com
Signed-off-by: GUO Zihua <guozihua@huawei.com>
Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>
[Dominique: commit message adjusted to make sense after offset size
adjustment got removed]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
GUO Zihua 2022-11-17 17:11:59 +08:00 committed by Greg Kroah-Hartman
parent ac26b18713
commit ab9adc9668

View file

@ -120,7 +120,7 @@ struct p9_conn {
struct list_head unsent_req_list; struct list_head unsent_req_list;
struct p9_req_t *rreq; struct p9_req_t *rreq;
struct p9_req_t *wreq; struct p9_req_t *wreq;
char tmp_buf[7]; char tmp_buf[P9_HDRSZ];
struct p9_fcall rc; struct p9_fcall rc;
int wpos; int wpos;
int wsize; int wsize;
@ -293,7 +293,7 @@ static void p9_read_work(struct work_struct *work)
if (!m->rc.sdata) { if (!m->rc.sdata) {
m->rc.sdata = m->tmp_buf; m->rc.sdata = m->tmp_buf;
m->rc.offset = 0; m->rc.offset = 0;
m->rc.capacity = 7; /* start by reading header */ m->rc.capacity = P9_HDRSZ; /* start by reading header */
} }
clear_bit(Rpending, &m->wsched); clear_bit(Rpending, &m->wsched);
@ -316,7 +316,7 @@ static void p9_read_work(struct work_struct *work)
p9_debug(P9_DEBUG_TRANS, "got new header\n"); p9_debug(P9_DEBUG_TRANS, "got new header\n");
/* Header size */ /* Header size */
m->rc.size = 7; m->rc.size = P9_HDRSZ;
err = p9_parse_header(&m->rc, &m->rc.size, NULL, NULL, 0); err = p9_parse_header(&m->rc, &m->rc.size, NULL, NULL, 0);
if (err) { if (err) {
p9_debug(P9_DEBUG_ERROR, p9_debug(P9_DEBUG_ERROR,