[PATCH 08/11] xfsprogs: replace obsolete memalign with posix_memalign
Jan Tulak
jtulak at redhat.com
Tue Aug 18 02:04:24 CDT 2015
On Mon, Aug 17, 2015 at 9:36 PM, Christoph Hellwig <hch at infradead.org>
wrote:
> On Mon, Aug 17, 2015 at 06:23:23PM +0200, Jan Tulak wrote:
> > Memalign from <malloc.h> was marked obsolete in favor of a posix
> > variant from <stdlib.h>. So replace all calls and remove <malloc.h>
> > includes. This also enhances support on other posix platforms,
> > which doesn't have <malloc.h>.
> >
> > Because posix_memalign returns any error as a return code, not in
> > errno, change relevant checks in code (and add a missing one).
>
> I have to say I hate the posix_memalign calling convention. Any chance
> you could just provide a memalign impementation using posix_memalign for
> MacOS?
>
I thought about it. However, with memalign from malloc marked obsolete
(and with posix_memalign having guaranteed alignment restrictions [1]), I
saw it better
to use the posix variant everywhere.
I could make a wrapper simulating the old memalign behaviour, but I don't
think it would make sense.
I searched for this, but didn't find any reasonable answer:
How long can be things in standard libraries marked obsolete before
removing?
Cheers,
Jan
[1] man memalign:
On many systems there are alignment restrictions, for example, on
buf‐
fers used for direct block device I/O. POSIX specifies the
path‐
conf(path,_PC_REC_XFER_ALIGN) call that tells what alignment is
needed.
Now one can use posix_memalign() to satisfy this requirement.
posix_memalign() verifies that alignment matches the
requirements
detailed above. memalign() may not check that the alignment
argument
is correct.
--
Jan Tulak
jtulak at redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.sgi.com/pipermail/xfs/attachments/20150818/2fd8fa5c/attachment-0001.html>
More information about the xfs
mailing list