[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00d901d71f90$cdfd24f0$69f76ed0$@samsung.com>
Date: Tue, 23 Mar 2021 12:01:22 +0900
From: "Namjae Jeon" <namjae.jeon@...sung.com>
To: "'Matthew Wilcox'" <willy@...radead.org>
Cc: <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-cifs@...r.kernel.org>,
<linux-cifsd-devel@...ts.sourceforge.net>, <smfrench@...il.com>,
<senozhatsky@...omium.org>, <hyc.lee@...il.com>,
<viro@...iv.linux.org.uk>, <hch@....de>, <hch@...radead.org>,
<ronniesahlberg@...il.com>, <aurelien.aptel@...il.com>,
<aaptel@...e.com>, <sandeen@...deen.net>,
<dan.carpenter@...cle.com>, <colin.king@...onical.com>,
<rdunlap@...radead.org>,
"'Sergey Senozhatsky'" <sergey.senozhatsky@...il.com>,
"'Steve French'" <stfrench@...rosoft.com>
Subject: RE: [PATCH 1/5] cifsd: add server handler and tranport layers
> On Mon, Mar 22, 2021 at 02:13:40PM +0900, Namjae Jeon wrote:
> > +#define RESPONSE_BUF(w) ((void *)(w)->response_buf)
> > +#define REQUEST_BUF(w) ((void *)(w)->request_buf)
>
> Why do you do this obfuscation?
I don't remember exactly, but back then, It looked easier...
>
> > +#define RESPONSE_BUF_NEXT(w) \
> > + ((void *)((w)->response_buf + (w)->next_smb2_rsp_hdr_off))
> > +#define REQUEST_BUF_NEXT(w) \
> > + ((void *)((w)->request_buf + (w)->next_smb2_rcv_hdr_off))
>
> These obfuscations aren't even used; delete them
They are used in many place.
./smb2pdu.c: *rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: err_rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: rsp_hdr = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: struct smb2_hdr *hdr = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: struct smb2_hdr *rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: rsp_hdr = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: hdr = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: hdr = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: rsp = RESPONSE_BUF_NEXT(work);
./smb2pdu.c: *req = REQUEST_BUF_NEXT(work);
./smb2pdu.c: rcv_hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: struct smb2_hdr *req_hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: struct smb2_hdr *req = REQUEST_BUF_NEXT(work);
./smb2pdu.c: rcv_hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: req = REQUEST_BUF_NEXT(work);
./smb2pdu.c: req = REQUEST_BUF_NEXT(work);
./smb2pdu.c: hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: req_hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: hdr = REQUEST_BUF_NEXT(work);
./smb2pdu.c: req_hdr = REQUEST_BUF_NEXT(work);
>
> > +#define RESPONSE_SZ(w) ((w)->response_sz)
> > +
> > +#define INIT_AUX_PAYLOAD(w) ((w)->aux_payload_buf = NULL)
> > +#define HAS_AUX_PAYLOAD(w) ((w)->aux_payload_sz != 0)
>
> I mean, do you really find it clearer to write:
>
> if (HAS_AUX_PAYLOAD(work))
> than
> if (work->aux_payload_sz)
>
> The unobfuscated version is actually shorter!
Yep, looks better, Will fix it.
Thanks for your review!
Powered by blists - more mailing lists