Messages in this thread | | | Date | Mon, 16 Mar 2009 11:05:38 -0700 | From | Greg KH <> | Subject | Re: [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
| |