[PATCH] erofs-utils: add missing errors and normalize errors to lower-case
Gao Xiang
hsiangkao at linux.alibaba.com
Sat Jan 29 19:04:45 AEDT 2022
On Sat, Jan 29, 2022 at 08:48:01AM +0200, Igor Eisberg wrote:
> On Sat, 29 Jan 2022, 08:13 Gao Xiang, <hsiangkao at linux.alibaba.com> wrote:
..
>
> >
> > > and I don't want to initialize such structures at the beginning of any
> > > block.
> >
>
> What exactly is "such structures"? I pointed you to an example where you
> did just that with struct z_erofs_decompress_req rq variable, I'm just
> following your code style, and this one stood out as unusual for your code
> style. Please count how many anonymous struct initializations you have
> across the whole erofs-utils project. I count only this one, and another in
> lib/data.c. Everything else is initialized as named variables.
Sorry, I didn't express clear. I mean here:
if (compressed) {
struct z_erofs_decompress_req rq = {
.in = raw,
.out = buffer,
.decodedskip = 0,
.inputsize = map.m_plen,
.decodedlength = map.m_llen,
.alg = map.m_algorithmformat,
.partial_decoding = 0
};
ret = z_erofs_decompress(&rq);
if (ret < 0) {
erofs_err("failed to decompress data of m_pa %" PRIu64 ", m_plen %" PRIu64 " @ nid %llu: %s",
mdev.m_pa, map.m_plen,
inode->nid | 0ULL, strerror(-ret));
goto out;
}
}
rq is at the beginning of the block, and we use the initialized
structure immediately, so I wrote as this.
>
>
> > Add some word.
>
>
> I didn't understand that...
>
> Actually, I'd like to add:
> > if (!fsckcfg.extract_path)
> > return;
> >
> > at the beginning of erofsfsck_set_attributes() instead of
> > using "if (!ret && fsckcfg.extract_path)" in the caller.
> >
>
> OK, but then we will have mixed declarations and code, because then we
> won't be at the beginning of the block...
Ok, sorry about confusion, I've made a commit instead..
Take a look at:
https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/commit/?h=experimental&id=69476e3ffa4985e767d33cb24d020f3669bc2c77
Since I'd like to avoid too many "if (!ret && fsckcfg.extract_path)"
in the callers if erofsfsck_set_attributes() uses in other place
in the future.
Thanks,
Gao Xiang
More information about the Linux-erofs
mailing list