Re: [PATCH RFC 1/8] staging: apfs: init lzfse compression library for APFS

Ethan Carter Edwards
2025-03-15T14:14:37Z

On 25/03/15 12:41PM, Dan Carpenter wrote:
> On Fri, Mar 14, 2025 at 05:57:47PM -0400, Ethan Carter Edwards wrote:
> > +static size_t lzfse_decode_buffer_with_scratch(uint8_t *__restrict dst_buffer,
> > + size_t dst_size, const uint8_t *__restrict src_buffer,
> > + size_t src_size, void *__restrict scratch_buffer) {
> > + int status;
> > + lzfse_decoder_state *s = (lzfse_decoder_state *)scratch_buffer;
> > + memset(s, 0x00, sizeof(*s));
> > +
> > + // Initialize state
> > + s->src = src_buffer;
> > + s->src_begin = src_buffer;
> > + s->src_end = s->src + src_size;
> > + s->dst = dst_buffer;
> > + s->dst_begin = dst_buffer;
> > + s->dst_end = dst_buffer + dst_size;
> > +
> > + // Decode
> > + status = lzfse_decode(s);
> > + if (status == LZFSE_STATUS_DST_FULL)
> > + return dst_size;
> > + if (status != LZFSE_STATUS_OK)
> > + return 0; // failed
> > + return (size_t)(s->dst - dst_buffer); // bytes written
> > +}
>
> You'd be better off doing a reformat of the white space before sending
> the driver. The really basic stuff.

Yes, I apologize. Admittedly, I did not scrutinize the library code as
much as I should have. I will refactor it in the next revision.

>
> regards,
> dan carpenter
>