static inline int mo_attr_get(const struct lu_context *cx, struct md_object *m,
struct lu_attr *at)
{
- return m->mo_ops->moo_attr_get(cx, m, at);
+ if (m->mo_ops->moo_attr_get)
+ return m->mo_ops->moo_attr_get(cx, m, at);
+ else
+ return -ENODEV;
}
static inline int mo_xattr_get(const struct lu_context *cx,
struct md_object *m,
void *buf, int buf_len, const char *name)
{
- return m->mo_ops->moo_xattr_get(cx, m, buf, buf_len, name);
+ if (m->mo_ops->moo_xattr_get);
+ return m->mo_ops->moo_xattr_get(cx, m, buf, buf_len, name);
+ else
+ return -ENODEV;
}
static inline int mo_open(const struct lu_context *cx, struct md_object *m)
{
- return m->mo_ops->moo_open(cx, m);
+ if (m->mo_ops->moo_open)
+ return m->mo_ops->moo_open(cx, m);
+ else
+ return -ENODEV;
}
static inline int mo_object_create(const struct lu_context *cx,
struct md_object *m, struct lu_attr *at)
{
- return m->mo_ops->moo_object_create(cx, m, at);
+ if (m->mo_ops->moo_object_create)
+ return m->mo_ops->moo_object_create(cx, m, at);
+ else
+ return -ENODEV;
}
static inline int mdo_lookup(const struct lu_context *cx, struct md_object *p,
const char *name, struct lu_fid *f)
{
- return p->mo_dir_ops->mdo_lookup(cx, p, name, f);
+ if (p->mo_dir_ops->mdo_lookup)
+ return p->mo_dir_ops->mdo_lookup(cx, p, name, f);
+ else
+ return -ENODEV;
}
static inline int mdo_mkdir(const struct lu_context *cx, struct lu_attr *at,
struct md_object *p, const char *name,
struct md_object *c)
{
- return p->mo_dir_ops->mdo_mkdir(cx, at, p, name, c);
+ if (p->mo_dir_ops->mdo_mkdir)
+ return p->mo_dir_ops->mdo_mkdir(cx, at, p, name, c);
+ else
+ return -ENODEV;
}
static inline int mdo_create(const struct lu_context *cx,
struct md_object *p, const char *name,
struct md_object *c, struct lu_attr *at)
{
- return c->mo_dir_ops->mdo_create(cx, p, name, c, at);
+ if (c->mo_dir_ops->mdo_create)
+ return c->mo_dir_ops->mdo_create(cx, p, name, c, at);
+ else
+ return -ENODEV;
}
static inline int mdo_name_insert(const struct lu_context *cx,
const char *name, const struct lu_fid *f,
struct lu_attr *at)
{
- return p->mo_dir_ops->mdo_name_insert(cx, p, name, f, at);
+ if (p->mo_dir_ops->mdo_name_insert);
+ return p->mo_dir_ops->mdo_name_insert(cx, p, name, f, at);
+ else
+ return -ENODEV;
}
#endif /* _LINUX_MD_OBJECT_H */