kernfs (Linux)

{{Short description|Set of functions in the Linux kernel}}

{{For|the pseudo file system in BSD operating systems|kernfs (BSD)}}

{{Lowercase title}}

{{Use mdy dates|date=August 2014}}

In the Linux kernel, kernfs is a set of functions that contain the functionality required for creating the pseudo file systems used internally by various kernel subsystems so that they may use virtual files. For example, sysfs provides a set of virtual files by exporting information about hardware devices and associated device drivers from the kernel's device model to user space.

The creation of kernfs resulted from splitting off part of the internal logic used by sysfs. The associated patchset, with Tejun Heo as its main author, was merged into the Linux kernel mainline in kernel version 3.14, which was released on March 30, 2014.{{cite web

| url = http://kernelnewbies.org/Linux_3.14#head-2a1c60de23027315150ffb8ccb8c8cee01e5377d

| title = Linux kernel 3.14, Section 3. Core

| date = March 30, 2014 | access-date = July 25, 2014

| website = kernelnewbies.org

}}

Kernfs took the independent and reusable functionality of sysfs so other kernel subsystems can implement their own pseudo file systems more easily and consistently.{{cite web

| url = https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=b8441ed279bff09a0a5ddeacf8f4087d2fb424ca

| title = Linux kernel source tree: kernel/git/torvalds/linux.git: sysfs, kernfs: add skeletons for kernfs

| date = October 13, 2013 | access-date = April 2, 2014

| author = Tejun Heo | publisher = kernel.org

}}{{cite web

| url = https://www.phoronix.com/scan.php?px=MTU3NzQ&page=news_item

| title = Linux kernel's sysfs logic turns into "kernfs" for 3.14

| date = January 20, 2014 | access-date = April 2, 2014

| author = Michael Larabel | publisher = Phoronix

}}{{cite web

| url = https://lwn.net/Articles/571590/

| title = sysfs: separate out kernfs, part #1

| date = October 24, 2013 | access-date = July 25, 2014

| author = Tejun Heo | publisher = LWN.net

}}

One of the primary users of kernfs is the pseudo file system used internally by cgroups, whose redesign continued into version 3.15 of the Linux kernel.{{cite web

| url = https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2bd59d48ebfb3df41ee56938946ca0dd30887312

| title = Linux kernel source tree: kernel/git/torvalds/linux.git: cgroups: convert to kernfs

| date = February 11, 2014 | access-date = May 23, 2014

| author = Tejun Heo | publisher = kernel.org

}}

See also

{{Portal|Linux}}

  • procfs{{snd}} a pseudo file system in Unix-like operating systems that presents information about processes (and about some other system information)
  • tmpfs{{snd}} a pseudo file system for temporary file storage on many Unix-like operating systems

References

{{Reflist|30em}}