/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * * GPL HEADER END */ /* * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * * Copyright (c) 2011, 2012, Whamcloud, Inc. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef _OFD_INTERNAL_H #define _OFD_INTERNAL_H #include #include struct ofd_device { struct dt_device ofd_dt_dev; struct dt_device *ofd_osd; struct dt_device_param ofd_dt_conf; struct lu_site ofd_site; }; static inline struct ofd_device *ofd_dev(struct lu_device *d) { return container_of0(d, struct ofd_device, ofd_dt_dev.dd_lu_dev); } static inline struct obd_device *ofd_obd(struct ofd_device *ofd) { return ofd->ofd_dt_dev.dd_lu_dev.ld_obd; } static inline struct ofd_device *ofd_exp(struct obd_export *exp) { return ofd_dev(exp->exp_obd->obd_lu_dev); } static inline char *ofd_name(struct ofd_device *ofd) { return ofd->ofd_dt_dev.dd_lu_dev.ld_obd->obd_name; } struct ofd_object { struct lu_object_header ofo_header; struct dt_object ofo_obj; }; static inline struct ofd_object *ofd_obj(struct lu_object *o) { return container_of0(o, struct ofd_object, ofo_obj.do_lu); } /* * Common data shared by obdofd-level handlers. This is allocated per-thread * to reduce stack consumption. */ struct ofd_thread_info { const struct lu_env *fti_env; union { char name[64]; /* for ofd_init0() */ } fti_u; }; /* ofd_dev.c */ extern struct lu_context_key ofd_thread_key; /* ofd_obd.c */ extern struct obd_ops ofd_obd_ops; /* lproc_ofd.c */ void lprocfs_ofd_init_vars(struct lprocfs_static_vars *lvars); static inline struct ofd_thread_info * ofd_info(const struct lu_env *env) { struct ofd_thread_info *info; info = lu_context_key_get(&env->le_ctx, &ofd_thread_key); LASSERT(info); LASSERT(info->fti_env); LASSERT(info->fti_env == env); return info; } static inline struct ofd_thread_info * ofd_info_init(const struct lu_env *env, struct obd_export *exp) { struct ofd_thread_info *info; info = lu_context_key_get(&env->le_ctx, &ofd_thread_key); LASSERT(info); LASSERT(info->fti_env == NULL); info->fti_env = env; return info; } #endif /* _OFD_INTERNAL_H */