lkml.org 
[lkml]   [2009]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC Aufs2 #2 21/28] aufs sysfs entries
On Mon, Mar 16, 2009 at 04:20:33PM +0900, J. R. Okajima wrote:
> initial commit
> sysfs entries, compiled only when CONFIG_SYSFS is enabled

debug stuff should be in debugfs, not sysfs.

Also, any sysfs files that are created, need to be documented in
Documentation/ABI/.

> +#ifdef CONFIG_AUFS_DEBUG
> +static ssize_t debug_show(struct kobject *kobj __maybe_unused,
> + struct kobj_attribute *attr __maybe_unused,
> + char *buf)
> +{
> + return sprintf(buf, "%d\n", au_debug_test());
> +}
> +
> +static ssize_t debug_store(struct kobject *kobj __maybe_unused,
> + struct kobj_attribute *attr __maybe_unused,
> + const char *buf, size_t sz)
> +{
> + if (unlikely(!sz || (*buf != '0' && *buf != '1')))
> + return -EOPNOTSUPP;
> +
> + if (*buf == '0')
> + au_debug(0);
> + else if (*buf == '1')
> + au_debug(1);
> + return sz;
> +}

This should be a simple module parameter, like almost all drivers have
it. That way it shows up in /sys/modules/aufs/ properly, as a boolean
value. No need to reinvent the wheel here.

> +/* todo: file size may exceed PAGE_SIZE */
> +ssize_t sysaufs_si_show(struct kobject *kobj, struct attribute *attr,
> + char *buf)

NO IT CAN NOT!!!!

You are using sysfs wrong if you even think you are getting close to
PAGE_SIZE.

Please, use debugfs for this. sysfs is a "one value per file" type
filesystem. You should never be using the seqfile interface for a sysfs
file, that's a sure sign something is wrong in your design.

I think I'll stop reading now :(

thanks,

greg k-h


\
 
 \ /
  Last update: 2009-03-16 19:13    [W:0.107 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site