From bc0defd059dda11adee5bb068692461a86e95edc Mon Sep 17 00:00:00 2001 From: adilger Date: Thu, 3 Oct 2002 22:15:56 +0000 Subject: [PATCH] Helper functions for OST file handles. --- lustre/include/linux/obd_class.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 6c0844d..fdeed1c 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -442,11 +442,28 @@ static inline int obd_cancel_unused(struct lustre_handle *conn, extern int obd_init_caches(void); extern void obd_cleanup_caches(void); -static inline struct lustre_handle *obd_oa2handle(struct obdo *oa) +static inline struct lustre_handle *obdo_handle(struct obdo *oa) { return (struct lustre_handle *)&oa->o_inline; } +static inline void obd_oa2handle(struct lustre_handle *handle, struct obdo *oa) +{ + if (oa->o_valid |= OBD_MD_FLHANDLE) { + struct lustre_handle *oa_handle = obdo_handle(oa); + memcpy(handle, oa_handle, sizeof(*handle)); + } +} + +static inline void obd_handle2oa(struct obdo *oa, struct lustre_handle *handle) +{ + if (handle->addr) { + struct lustre_handle *oa_handle = obdo_handle(oa); + memcpy(oa_handle, handle, sizeof(*handle)); + oa->o_valid |= OBD_MD_FLHANDLE; + } +} + #ifdef __KERNEL__ /* support routines */ extern kmem_cache_t *obdo_cachep; -- 1.8.3.1