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

Re: [lvm-devel] [PATCH 02/19] Refactor pvstatus_disp to take pv argument and call common pv_attr function.



Dne 15.9.2010 17:35, Dave Wysochanski napsal(a):
> 
> Signed-off-by: Dave Wysochanski <dwysocha redhat com>
> ---
>  lib/metadata/metadata.c |   21 +++++++++++++++++++++
>  lib/metadata/metadata.h |    1 +
>  lib/report/columns.h    |    2 +-
>  lib/report/report.c     |   17 +++--------------
>  4 files changed, 26 insertions(+), 15 deletions(-)
> 
> diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
> index 094ffc1..86f07e7 100644
> --- a/lib/metadata/metadata.c
> +++ b/lib/metadata/metadata.c
> @@ -4598,6 +4598,27 @@ char *vg_attr(struct dm_pool *mem, const struct volume_group *vg)
>  	return repstr;
>  }
>  
> +char *pv_attr(struct dm_pool *mem, const struct physical_volume *pv)
> +{
> +	char *repstr;
> +
> +	if (!(repstr = dm_pool_zalloc(mem, 3))) {
> +		log_error("dm_pool_alloc failed");
> +		return NULL;
> +	}
> +
> +	if (pv->status & ALLOCATABLE_PV)
> +		repstr[0] = 'a';
> +	else
> +		repstr[0] = '-';
> +
> +	if (pv->status & EXPORTED_VG)
> +		repstr[1] = 'x';
> +	else
> +		repstr[1] = '-';
> +	return repstr;

when you are moving this code maybe again little shortening could be made:
c = (x) ? a : b;

Zdenek


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