Let's conclude this section by looking at a few remaining miscellaneous procfs APIs. You can create a symbolic or soft link within /proc by using the proc_symlink() function.
Next, the proc_create_single_data() API can be very useful; it's used as a "shortcut", where you require just a "read" method to be attached to a procfs file:
struct proc_dir_entry *proc_create_single_data(const char *name, umode_t mode, struct
proc_dir_entry *parent, int (*show)(struct seq_file *, void *), void *data);
Using this API thus eliminates the need for a separate fops data structure. We can use this function to create and work with our second procfs file – the llkdproc_show_pgoff file:
... proc_create_single_data(PROC_FILE2, PROC_FILE2_PERMS, gprocdir, proc_show_pgoff, 0) ...
When read from the user space, the kernel's VFS and proc layer code paths will invoke the registered method – the proc_show_pgoff() function of our...