Whamcloud - gitweb
LU-17504 build: fix gcc-13 [-Werror=stringop-overread] error
[fs/lustre-release.git] / lustre / include / obd_target.h
index d59282f..567be84 100644 (file)
  *
  * 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.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Intel, Inc.
+ * Copyright (c) 2011, 2014, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
 #ifndef __OBD_TARGET_H
 #define __OBD_TARGET_H
+#include <lprocfs_status.h>
+#include <obd.h>
 
 /* server-side individual type definitions */
 
@@ -46,30 +43,18 @@ struct obd_device_target {
        struct lu_target       *obt_lut;
        __u64                   obt_mount_count;
        struct obd_job_stats    obt_jobstats;
+       struct nm_config_file   *obt_nodemap_config_file;
 };
 
-#define FILTER_SUBDIR_COUNT 32 /* set to zero for no subdirs */
-
-struct filter_obd {
-       /* NB this field MUST be first */
-       struct obd_device_target        fo_obt;
-       rwlock_t                        fo_sptlrpc_lock;
-       struct sptlrpc_rule_set         fo_sptlrpc_rset;
-
-       /* capability related */
-       unsigned int                    fo_fl_oss_capa;
-       cfs_list_t                      fo_capa_keys;
-       cfs_hlist_head_t               *fo_capa_hash;
-       int                             fo_sec_level;
-};
+#define OBJ_SUBDIR_COUNT 32 /* set to zero for no subdirs */
 
 struct echo_obd {
        struct obd_device_target        eo_obt;
        struct obdo                     eo_oa;
        spinlock_t                      eo_lock;
-       __u64                           eo_lastino;
+       u64                             eo_lastino;
        struct lustre_handle            eo_nl_lock;
-       cfs_atomic_t                    eo_prep;
+       atomic_t                        eo_prep;
 };
 
 struct ost_obd {
@@ -81,4 +66,54 @@ struct ost_obd {
        struct mutex             ost_health_mutex;
 };
 
+static inline struct obd_device_target *obd2obt(struct obd_device *obd)
+{
+       struct obd_device_target *obt;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*obt));
+
+       if (!obd)
+               return NULL;
+       obt = (void *)&obd->u;
+       LASSERT(obt->obt_magic == OBT_MAGIC);
+       return obt;
+}
+
+static inline struct obd_device_target *obd_obt_init(struct obd_device *obd)
+{
+       struct obd_device_target *obt;
+
+       obt = (void *)&obd->u;
+       obt->obt_magic = OBT_MAGIC;
+       obt->obt_instance = 0;
+
+       return obt;
+}
+
+static inline struct echo_obd *obd2echo(struct obd_device *obd)
+{
+       struct echo_obd *echo;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*echo));
+
+       if (!obd)
+               return NULL;
+       echo = (void *)&obd->u;
+
+       return echo;
+}
+
+static inline struct ost_obd *obd2ost(struct obd_device *obd)
+{
+       struct ost_obd *ost;
+
+       BUILD_BUG_ON(sizeof(obd->u) < sizeof(*ost));
+
+       if (!obd)
+               return NULL;
+       ost = (void *)&obd->u;
+
+       return ost;
+}
+
 #endif /* __OBD_TARGET_H */