[Devel] Re: [PATCH 0/4] cgroups: show correct file mode

Li Zefan lizf at cn.fujitsu.com
Mon Mar 2 17:15:42 PST 2009


>> +/**
>> + * cgroup_file_mode - deduce file mode of a control file
>> + * @cft: the control file in question
>> + *
>> + * returns cftype->mode if ->mode is not 0
>> + * returns 0644 if it has both a read and a write handler
>> + * returns 0444 if it has only a read handler
>> + * returns 0200 if it has only a write hander
>> + */
>> +static int cgroup_file_mode(const struct cftype *cft)
>> +{
>> +	int mode = 0;
>> +
>> +	if (cft->mode)
>> +		return cft->mode;
>> +
>> +	if (cft->read || cft->read_u64 || cft->read_s64 ||
>> +	    cft->read_map || cft->read_seq_string)
>> +		mode += 0444;
>> +
>> +	if (cft->write || cft->write_u64 || cft->write_s64 ||
>> +	    cft->write_string || cft->trigger)
>> +		mode += 0200;
>> +
> 
> += is not |=...
> 

Ah, yes, though both happen to result in 0644.

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list