[Ocfs2-tools-devel] [PATCH 1/1] Add a new method for exclusive option check in tunefs.ocfs2.

tao.ma tao.ma at oracle.com
Tue Nov 6 21:41:26 PST 2007


Joel Becker wrote:
> On Tue, Nov 06, 2007 at 05:00:42PM +0800, Tao Ma wrote:
>   
>> In tunefs.ocfs2, we often have some exclusive options that can't
>> be done with others, and it is tedious when a new exclusive option
>> is going to be added since all other option checks have to be
>> modified accordingly.
>>     
> ...
>   
>> +errcode_t exclusive_option_check(char *para, int size)
>> +{
>> +	int start;
>> +	int len = sizeof(opts);
>> +	char *content = NULL;
>> +
>> +	if (resize)
>> +		return 1;
>> +
>> +	/* We check from this field of opts. */
>> +	start = (char *)&opts.num_slots - (char *)&opts;
>> +	content = (char *)&opts.num_slots;
>>     
>
> 	Wow is this ugly.  Can't we do something like a bitfield
> instead?  Or even just have a char* on the options list that takes the
> name of the first exclusive option set.  So that you can do
>
> if (opts.exclusive) 
> 	error("Cannot combine operations %s and %s", opts.exclusive,
> 	      this_opt_name);
> else
> 	opts.exclusive = this_opt_name;
>   
This is good, but there are some situations that can't be solved.
Considering  we use "list-sparse" combined with "-L label". It can't be 
judged since "-L" isn't exclusive.



More information about the Ocfs2-tools-devel mailing list