]> git.baikalelectronics.ru Git - kernel.git/commit
sysfs, kernfs: introduce kernfs[_find_and]_get() and kernfs_put()
authorTejun Heo <tj@kernel.org>
Thu, 28 Nov 2013 19:54:30 +0000 (14:54 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Nov 2013 01:55:10 +0000 (17:55 -0800)
commit97ba8e56bedbf36bee64b81eed4e15403f432432
tree8e3a3b9891e6b9d4804299cd23110c91d8f8016e
parentcabc80e90d05815728875ad810fc36e4f39b3471
sysfs, kernfs: introduce kernfs[_find_and]_get() and kernfs_put()

Introduce kernfs interface for finding, getting and putting
sysfs_dirents.

* sysfs_find_dirent() is renamed to kernfs_find_ns() and lockdep
  assertion for sysfs_mutex is added.

* sysfs_get_dirent_ns() is renamed to kernfs_find_and_get().

* Macro inline dancing around __sysfs_get/put() are removed and
  kernfs_get/put() are made proper functions implemented in
  fs/sysfs/dir.c.

While the conversions are mostly equivalent, there's one difference -
kernfs_get() doesn't return the input param as its return value.  This
change is intentional.  While passing through the input increases
writability in some areas, it is unnecessary and has been shown to
cause confusion regarding how the last ref is handled.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/dir.c
fs/sysfs/file.c
fs/sysfs/group.c
fs/sysfs/inode.c
fs/sysfs/mount.c
fs/sysfs/symlink.c
fs/sysfs/sysfs.h
include/linux/kernfs.h
include/linux/sysfs.h