Re: [patch] kernel sysfs events layer

Andrew Morton
2004-08-31T22:14:13Z

Robert Love <rml@ximian.com> wrote:
>
> On Tue, 2004-08-31 at 15:00 -0700, Andrew Morton wrote:
>
> > Why not share the implementation here?
>
> Because we will probably want to export do_send_kevent(), with a
> different name, if this thing starts getting used, because there are
> places where the kobj path is already computed and although inexpensive
> it does cost a few cycles to go kobject -> path as a string.
>

That's unrelated. I meant:

static int __send_kevent(enum kevent type, struct kset *kset,
struct kobject *kobj, const char *signal, int gfp_flags)
{
const char *path;
int ret;

path = kobject_get_path(kset, kobj, gfp_flags);
if (!path)
return -ENOMEM;

ret = do_send_kevent(type, gfp_flags, path, signal);
kfree(path);

return ret;
}

int send_kevent(enum kevent type, struct kset *kset,
struct kobject *kobj, const char *signal)
{
return __send_kevent(type, kset, kobj, signal, GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(send_kevent);

int send_kevent_atomic(enum kevent type, struct kset *kset,
struct kobject *kobj, const char *signal)
{
return __send_kevent(type, kset, kobj, signal, GFP_ATOMIC);
}
EXPORT_SYMBOL_GPL(send_kevent_atomic);