Tips and tricks

Convenience functions

struct proc_dir_entry* create_proc_read_entry(const char* name, mode_t mode, struct proc_dir_entry* parent, read_proc_t* read_proc, void* data);

This function creates a regular file in exactly the same way as create_proc_entry from the Section called Creating a regular file in the chapter called Managing procfs entries does, but also allows to set the read function read_proc in one call. This function can set the data as well, like explained in the Section called A single call back for many files in the chapter called Communicating with userland.