[ltt-dev] [PATCH 11/13] implement ltt-ascii

Lai Jiangshan laijs at cn.fujitsu.com
Fri Jan 16 21:57:39 EST 2009


Mathieu Desnoyers wrote:
>>>> +struct dentry *ltt_txt_create(struct ltt_trace_struct *trace,
>>>> +		struct ltt_channel_struct *ltt_channel)
>>>> +{
>>>> +	struct dentry *entry = debugfs_create_file(ltt_channel->channel_name,
>>>> +			S_IRUSR | S_IRGRP, trace->dentry.txt_root, ltt_channel,
>>>> +			&ltt_txt_fops);
>>>> +
>>> We should handle the error case here. And make sure the ltt_txt_remove
>>> won't forget to put the channel on error.
>>>
>> when the error case here, we return NULL, and nothing done.
>> What we need to handle?
>>
> 
> debugfs_create_file() can return -ENODEV if not enabled in the kernel.
> Clearly this should never happen because our build depends on it. But
> still, I'd be more comfortable dealing with the IS_ERR() case (if new
> return values are added to debugfs in the future especially).
> 

I remember that LTT selects DEBUG_FS, so it's OK.

Most code use one of the styles:
0       -- fail    other --    success
-Eerrno -- fail    other --    success

but debugfs_create_file() is mussed up.

Lai.





More information about the lttng-dev mailing list