All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Milan P. Stanić" <mps@arvanta.net>
To: Natanael Copa <ncopa@alpinelinux.org>
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>, linux-erofs@lists.ozlabs.org
Subject: Re: [PATCH v2] erofs-utils: fix build failure with musl libc
Date: Sat, 10 May 2025 11:02:20 +0200	[thread overview]
Message-ID: <20250510090220.GA15686@m1pro.arvanta.net> (raw)
In-Reply-To: <20250507183507.09027ea8@ncopa-desktop>

On Wed, 2025-05-07 at 18:35, Natanael Copa wrote:
> On Wed,  7 May 2025 21:25:48 +0800
> Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
> 
> > because musl use readdir, pread and lseek instead of readdir64,
> > pread64 and lseek64.
> > 
> > Reported-by: Milan P. Stani* <mps@arvanta.net>
> > Thanks-to: Natanael Copa <ncopa@alpinelinux.org>
> > Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> > ---
> > (Fix wrong email address typo..)
> > 
> > Hi,
> > 
> > Due to the original patch lacks of the commit message and
> > SOB, so I revised myself.
> 
> Ok with me.

Also ok with me.

> > I add "_FILE_OFFSET_BITS 64" in the top since "contrib/stress.c"
> > can be compiled individually.
> 
> This looks correct.
> 
> 
> Thank you!
> 
> > Feel free to repost a formal patch if inappropriate.
> > 
> > Thanks,
> > Gao Xiang
> > 
> >  contrib/stress.c | 23 ++++++++++++-----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> > 
> > diff --git a/contrib/stress.c b/contrib/stress.c
> > index d8def6a..0ef8c67 100644
> > --- a/contrib/stress.c
> > +++ b/contrib/stress.c
> > @@ -4,6 +4,7 @@
> >   *
> >   * Copyright (C) 2019-2025 Gao Xiang <xiang@kernel.org>
> >   */
> > +#define _FILE_OFFSET_BITS 64
> >  #define _GNU_SOURCE
> >  #include "erofs/defs.h"
> >  #include <errno.h>
> > @@ -271,7 +272,7 @@ static int __getdents_f(unsigned int sn, struct fent *fe)
> >  	}
> >  
> >  	dir = fdopendir(dfd);
> > -	while (readdir64(dir) != NULL)
> > +	while (readdir(dir) != NULL)
> >  		continue;
> >  	closedir(dir);
> >  	return 0;
> > @@ -428,7 +429,7 @@ static int __read_f(unsigned int sn, struct fent *fe, uint64_t filesize)
> >  
> >  	printf("%d[%u]/%u read_f: %llu bytes @ %llu of %s\n", getpid(), procid,
> >  	       sn, len | 0ULL, off | 0ULL, fe->subpath);
> > -	nread = pread64(fe->fd, buf, len, off);
> > +	nread = pread(fe->fd, buf, len, off);
> >  	if (nread != trimmed) {
> >  		fprintf(stderr, "%d[%u]/%u read_f: failed to read %llu bytes @ %llu of %s\n",
> >  			getpid(), procid, sn, len | 0ULL, off | 0ULL,
> > @@ -439,7 +440,7 @@ static int __read_f(unsigned int sn, struct fent *fe, uint64_t filesize)
> >  	if (fe->chkfd < 0)
> >  		return 0;
> >  
> > -	nread2 = pread64(fe->chkfd, chkbuf, len, off);
> > +	nread2 = pread(fe->chkfd, chkbuf, len, off);
> >  	if (nread2 <= 0) {
> >  		fprintf(stderr, "%d[%u]/%u read_f: failed to check %llu bytes @ %llu of %s\n",
> >  			getpid(), procid, sn, len | 0ULL, off | 0ULL,
> > @@ -477,14 +478,14 @@ static int read_f(int op, unsigned int sn)
> >  	if (ret)
> >  		return ret;
> >  
> > -	fsz = lseek64(fe->fd, 0, SEEK_END);
> > +	fsz = lseek(fe->fd, 0, SEEK_END);
> >  	if (fsz <= 0) {
> >  		if (!fsz) {
> >  			printf("%d[%u]/%u %s: zero size @ %s\n",
> >  			       getpid(), procid, sn, __func__, fe->subpath);
> >  			return 0;
> >  		}
> > -		fprintf(stderr, "%d[%u]/%u %s: lseek64 %s failed %d\n",
> > +		fprintf(stderr, "%d[%u]/%u %s: lseek %s failed %d\n",
> >  			getpid(), procid, sn, __func__, fe->subpath, errno);
> >  		return -errno;
> >  	}
> > @@ -504,7 +505,7 @@ static int __doscan_f(unsigned int sn, const char *op, struct fent *fe,
> >  	for (pos = 0; pos < filesize; pos += chunksize) {
> >  		ssize_t nread, nread2;
> >  
> > -		nread = pread64(fe->fd, buf, chunksize, pos);
> > +		nread = pread(fe->fd, buf, chunksize, pos);
> >  
> >  		if (nread <= 0)
> >  			return -errno;
> > @@ -515,7 +516,7 @@ static int __doscan_f(unsigned int sn, const char *op, struct fent *fe,
> >  		if (fe->chkfd < 0)
> >  			continue;
> >  
> > -		nread2 = pread64(fe->chkfd, chkbuf, chunksize, pos);
> > +		nread2 = pread(fe->chkfd, chkbuf, chunksize, pos);
> >  		if (nread2 <= 0)
> >  			return -errno;
> >  
> > @@ -547,14 +548,14 @@ static int doscan_f(int op, unsigned int sn)
> >  	if (ret)
> >  		return ret;
> >  
> > -	fsz = lseek64(fe->fd, 0, SEEK_END);
> > +	fsz = lseek(fe->fd, 0, SEEK_END);
> >  	if (fsz <= 0) {
> >  		if (!fsz) {
> >  			printf("%d[%u]/%u %s: zero size @ %s\n",
> >  			       getpid(), procid, sn, __func__, fe->subpath);
> >  			return 0;
> >  		}
> > -		fprintf(stderr, "%d[%u]/%u %s: lseek64 %s failed %d\n",
> > +		fprintf(stderr, "%d[%u]/%u %s: lseek %s failed %d\n",
> >  			getpid(), procid, sn, __func__, fe->subpath, errno);
> >  		return -errno;
> >  	}
> > @@ -576,7 +577,7 @@ static int doscan_aligned_f(int op, unsigned int sn)
> >  	ret = tryopen(sn, __func__, fe);
> >  	if (ret)
> >  		return ret;
> > -	fsz = lseek64(fe->fd, 0, SEEK_END);
> > +	fsz = lseek(fe->fd, 0, SEEK_END);
> >  	if (fsz <= psz) {
> >  		if (fsz >= 0) {
> >  			printf("%d[%u]/%u %s: size too small %lld @ %s\n",
> > @@ -584,7 +585,7 @@ static int doscan_aligned_f(int op, unsigned int sn)
> >  			       fe->subpath);
> >  			return 0;
> >  		}
> > -		fprintf(stderr, "%d[%u]/%u %s: lseek64 %s failed %d\n",
> > +		fprintf(stderr, "%d[%u]/%u %s: lseek %s failed %d\n",
> >  			getpid(), procid, sn, __func__, fe->subpath, errno);
> >  		return -errno;
> >  	}
> 


      reply	other threads:[~2025-05-10  9:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 12:11 build of erofs-utils 1.8.6 fails with musl libc Milan P. Stanić
2025-05-06 12:38 ` Gao Xiang
2025-05-07  8:50 ` [PATCH] erofs-utils: fix build failure " Gao Xiang
2025-05-07 13:25 ` [PATCH v2] " Gao Xiang
2025-05-07 16:35   ` Natanael Copa
2025-05-10  9:02     ` Milan P. Stanić [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250510090220.GA15686@m1pro.arvanta.net \
    --to=mps@arvanta.net \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=ncopa@alpinelinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.