lkml.org 
[lkml]   [2013]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/9] syslog_ns: add syslog_namespace and put/get_syslog_ns
On 2013/7/29 17:40, Gu Zheng wrote:
> Hi Rui,
> Refer to inline:).
>
Hi Gu,

Thanks for your attention.

> On 07/29/2013 10:31 AM, Rui Xiang wrote:
>
>> Add a struct syslog_namespace which contains the necessary
>> members for hanlding syslog and realize get_syslog_ns and
>> put_syslog_ns API.
>>
>> Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
>> ---
>> include/linux/syslog.h | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
>> kernel/printk.c | 7 ------
>> 2 files changed, 68 insertions(+), 7 deletions(-)
>>

...

>> +
>> +static inline void free_syslog_ns(struct kref *kref)
>> +{
>> + struct syslog_namespace *ns;
>> + ns = container_of(kref, struct syslog_namespace, kref);
>> +
>> + kfree(ns->log_buf);
>> + kfree(ns);
>> +}
>
> This interface seems a bit ugly, why not use the format like put_syslog_ns()?
>
> static inline void free_syslog_ns(struct syslog_namespace *ns)
>

Free_syslog_ns is used in put_syslog_ns. And the kref_put function uses kref as
a parameter for its relase funtion. You can see that from
static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)).

Thanks.

>> +
>> +static inline void put_syslog_ns(struct syslog_namespace *ns)
>> +{
>> + if (ns)
>> + kref_put(&ns->kref, free_syslog_ns);
>> +}
>> +
>>



\
 
 \ /
  Last update: 2013-07-29 14:01    [W:0.075 / U:2.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site