Re: [PATCH] exporting capability code/name pairs (try #5)

Li Zefan
2008-02-15T02:00:17Z

Kohei KaiGai wrote:

<...snip...>

> +static int __init capability_export_names(void)
> +{
> + /* make /sys/kernel/capability */
> + capability_kobj = kobject_create_and_add("capability", kernel_kobj);
> + if (!capability_kobj)
> + goto error0;
> +
> + /* make /sys/kernel/capability/names */
> + if (sysfs_create_group(capability_kobj,
> + &capability_name_attr_group))
> + goto error1;
> +
> + /* make /sys/kernel/capability/codes */
> + if (sysfs_create_group(capability_kobj,
> + &capability_code_attr_group))
> + goto error2;
> +
> + if (sysfs_create_file(capability_kobj,
> + &cap_version_attr.attr))
> + goto error3;
> +
> + return 0;
> +
> +error3:
> + sysfs_remove_group(capability_kobj, &capability_code_attr_group);
> +error2:
> + sysfs_remove_group(capability_kobj, &capability_name_attr_group);
> +error1:
> + kobject_put(capability_kobj);
> +error0:
> + printk(KERN_ERR "Unable to export capabilities\n");
> +
> + return 0;

Should return -EFXXX ..

> +}
> +__initcall(capability_export_names);
>