summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/include/linux/libcfs/libcfs.h
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-03-29 15:26:48 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 15:16:58 +0200
commit05e6557b8ed833546ee2b66ce6b58fecf09f439e (patch)
treea2cd87c97111677ec5a30d5f82260482c1d64f9f /drivers/staging/lustre/include/linux/libcfs/libcfs.h
parent93aa2c2a5091bd47819a3ead4af70fb57fda5065 (diff)
downloadop-kernel-dev-05e6557b8ed833546ee2b66ce6b58fecf09f439e.zip
op-kernel-dev-05e6557b8ed833546ee2b66ce6b58fecf09f439e.tar.gz
staging: lustre: add container_of_safe()
Luster has a container_of0() function which is similar to container_of() but passes an IS_ERR_OR_NULL() pointer through unchanged. This could be generally useful: bcache at last has a similar function. Naming is hard, but the precedent set by hlist_entry_safe() suggests a _safe suffix might be most consistent. So add container_of_safe() to kernel.h, and replace all occurrences of container_of0() with one of - list_first_entry, list_next_entry, when that is a better fit, - container_of(), when the pointer is used as a validpointer in surrounding code, - container_of_safe() when there is no obviously better alternative. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/include/linux/libcfs/libcfs.h')
-rw-r--r--drivers/staging/lustre/include/linux/libcfs/libcfs.h11
1 files changed, 0 insertions, 11 deletions
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 5d10aa3..6e7754b 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -143,17 +143,6 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
int libcfs_ioctl(unsigned long cmd, void __user *arg);
-/* container_of depends on "likely" which is defined in libcfs_private.h */
-static inline void *__container_of(void *ptr, unsigned long shift)
-{
- if (IS_ERR_OR_NULL(ptr))
- return ptr;
- return (char *)ptr - shift;
-}
-
-#define container_of0(ptr, type, member) \
- ((type *)__container_of((void *)(ptr), offsetof(type, member)))
-
#define _LIBCFS_H
extern struct miscdevice libcfs_dev;
OpenPOWER on IntegriCloud