lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161205205435.GD31243@mwanda>
Date:   Mon, 5 Dec 2016 23:54:36 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     James Simmons <jsimmons@...radead.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org,
        Andreas Dilger <andreas.dilger@...el.com>,
        Oleg Drokin <oleg.drokin@...el.com>,
        Ben Evans <bevans@...y.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Lustre Development List <lustre-devel@...ts.lustre.org>
Subject: Re: [PATCH 5/6] staging: lustre: headers: Move functions out of
 lustre_idl.h

On Fri, Dec 02, 2016 at 02:40:49PM -0500, James Simmons wrote:
> -/* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available.
> - * Otherwise, 2 are available.
> - */
> -#define ldlm_request_bufsize(count, type)				\
> -({								      \
> -	int _avail = LDLM_LOCKREQ_HANDLES;			      \
> -	_avail -= (type == LDLM_ENQUEUE ? LDLM_ENQUEUE_CANCEL_OFF : 0); \
> -	sizeof(struct ldlm_request) +				   \
> -	(count > _avail ? count - _avail : 0) *			 \
> -	sizeof(struct lustre_handle);				   \
> -})
> -

> +/**
> + * ldlm_request_bufsize
> + *
> + * @count:	number of ldlm handles
> + * @type:	ldlm opcode
> + *
> + * If opcode=LDLM_ENQUEUE, 1 slot is already occupied,
> + * LDLM_LOCKREQ_HANDLE -1 slots are available.
> + * Otherwise, LDLM_LOCKREQ_HANDLE slots are available.
> + *
> + * Return:	size of the request buffer
> + */
> +int ldlm_request_bufsize(int count, int type)
> +{
> +	int avail = LDLM_LOCKREQ_HANDLES;
> +
> +	if (type == LDLM_ENQUEUE)
> +		avail -= LDLM_ENQUEUE_CANCEL_OFF;
> +
> +	if (count > avail)
> +		avail = (count - avail) * sizeof(struct lustre_handle);
> +	else
> +		avail = 0;
> +
> +	return sizeof(struct ldlm_request) + avail;
> +}
> +

This is a nice cleanup.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ