Re: [PATCH v3 10/11] xfsprogs: replace obsolete memalign with posix_memalign

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 03, 2015 at 04:39:48PM +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).
....
> @@ -74,12 +74,18 @@ libxfs_device_zero(struct xfs_buftarg *btp, xfs_daddr_t start, uint len)
>  	ssize_t		zsize, bytes;
>  	char		*z;
>  	int		fd;
> +	int ret;
>  
>  	zsize = min(BDSTRAT_SIZE, BBTOB(len));
> -	if ((z = memalign(libxfs_device_alignment(), zsize)) == NULL) {
> +	ret = posix_memalign(
> +						(void **)&z,
> +						libxfs_device_alignment(),
> +						zsize
> +					);

Unusual function call formatting. Please use the form the rest of
the code uses. i.e:

	ret = posix_memalign((void **)&z, libxfs_device_alignment(), zsize);

(same for the rest of the patch).

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux