Re: RFC-patch - make sysfs_create_group skip members with attr.mode == 0

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

 



On Thu, Aug 17, 2006 at 04:50:25PM -0600, Jim Cromie wrote:
> Currently, code in hwmon/*.c uses sysfs_create_group less than it could.

Please, provide sample patch which will use this feature. And I personally
don't understand the reasoning: can i2c code use sysfs_create_group()
with elements of struct attribute_group::attrs array ifdeffed?

> A contributing reason is that many individual attr-files are created
> conditionally,
> depending upon both underlying hardware, driver configuration, etc.

> --- try1/fs/sysfs/group.c	2006-06-17 19:49:35.000000000 -0600
> +++ try2/fs/sysfs/group.c	2006-08-17 10:06:26.000000000 -0600
> @@ -32,7 +33,8 @@ static int create_files(struct dentry *
> 	int error = 0;
>
> 	for (attr = grp->attrs; *attr && !error; attr++) {
> -		error = sysfs_add_file(dir, *attr, SYSFS_KOBJ_ATTR);
> +		if ((*attr)->mode)
> +			error = sysfs_add_file(dir, *attr, SYSFS_KOBJ_ATTR);
> 	}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux