Re: [RFC Aufs2 #2 21/28] aufs sysfs entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux