IMHO this is cleaner and easily extensible.
I think it solve all the problems noted but the type checking one.
struct proc_entry {
char *name;
int level;
uid_t owner;
gid_t group;
mode_t permission;
int type;
void (*func)(int action, void *data);
void *data;
};
static struct proc_entry entries[] __initdata = {
{ "test", 0, 0, 0, 0755, PROC_DIR, 0, 0 },
{ "bar", 1, 0, 0, 0755, PROC_DIR, 0, 0 },
{ "x", 2, 0, 0, 0644, PROC_INT, 0, &x },
{ "y", 2, 0, 0, 0644, PROC_INT, 0, &y },
{ "z", 2, 0, 0, 0644, PROC_INT, 0, &z },
{ "foo", 1, 0, 0, 0644, PROC_CUSTOM, foo_fun, &data}
};
create_proc_entries(basedir, entries, sizeof(entries) /
sizeof(*entries));
-- Abramo Bagnara mailto:abramo@alsa-project.orgOpera Unica Via Emilia Interna, 140 Phone: +39.0546.656023 48014 Castel Bolognese (RA) - Italy Fax: +39.0546.656023
ALSA project is http://www.alsa-project.org sponsored by SuSE Linux http://www.suse.com
It sounds good!
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/