4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2012, Intel, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/osp/osp_object.c
38 * Lustre OST Proxy Device
40 * Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
41 * Author: Mikhail Pershin <mike.tappro@intel.com>
45 # define EXPORT_SYMTAB
47 #define DEBUG_SUBSYSTEM S_MDS
49 #include "osp_internal.h"
51 struct dt_object_operations osp_obj_ops = {
54 static int osp_object_init(const struct lu_env *env, struct lu_object *o,
55 const struct lu_object_conf *unused)
57 struct osp_object *po = lu2osp_obj(o);
59 po->opo_obj.do_ops = &osp_obj_ops;
64 static void osp_object_free(const struct lu_env *env, struct lu_object *o)
66 struct osp_object *obj = lu2osp_obj(o);
67 struct lu_object_header *h = o->lo_header;
69 dt_object_fini(&obj->opo_obj);
70 lu_object_header_fini(h);
71 OBD_SLAB_FREE_PTR(obj, osp_object_kmem);
74 static void osp_object_release(const struct lu_env *env, struct lu_object *o)
79 static int osp_object_print(const struct lu_env *env, void *cookie,
80 lu_printer_t p, const struct lu_object *l)
82 const struct osp_object *o = lu2osp_obj((struct lu_object *)l);
84 return (*p)(env, cookie, LUSTRE_OSP_NAME"-object@%p", o);
87 static int osp_object_invariant(const struct lu_object *o)
92 struct lu_object_operations osp_lu_obj_ops = {
93 .loo_object_init = osp_object_init,
94 .loo_object_free = osp_object_free,
95 .loo_object_release = osp_object_release,
96 .loo_object_print = osp_object_print,
97 .loo_object_invariant = osp_object_invariant