From: tappro Date: Wed, 17 May 2006 18:56:25 +0000 (+0000) Subject: add lookup() method in md_dir_operations X-Git-Tag: v1_8_0_110~486^2~1811 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=49dfc8391986db08c15bed4df19c4de9c80d1515;p=fs%2Flustre-release.git add lookup() method in md_dir_operations add few methods in md_object_operations define inlines for calling the md_ operations --- diff --git a/lustre/include/linux/md_object.h b/lustre/include/linux/md_object.h index 799fa0a..a24a821 100644 --- a/lustre/include/linux/md_object.h +++ b/lustre/include/linux/md_object.h @@ -62,17 +62,22 @@ struct md_object_operations { /* part of cross-ref operation */ int (*moo_object_create)(struct lu_context *, struct md_object *, struct lu_attr *); - int (*moo_object_destroy)(struct lu_context *, struct md_object *); - + int (*moo_ref_add)(struct lu_context *, struct md_object *); + int (*moo_ref_del)(struct lu_context *, struct md_object *); + int (*moo_open)(struct lu_context *, struct md_object *); + int (*moo_close)(struct lu_context *, struct md_object *); }; /* * Operations implemented for each directory object. */ struct md_dir_operations { - int (*mdo_mkdir)(struct lu_context *ctxt, struct lu_attr *attr, - struct md_object *obj, - const char *name, struct md_object *child); + int (*mdo_lookup)(struct lu_context *, struct md_object *, + const char *, struct lu_fid *); + + int (*mdo_mkdir)(struct lu_context *, struct lu_attr *, + struct md_object *, const char *, + struct md_object *); int (*mdo_rename)(struct lu_context *ctxt, struct md_object *spobj, struct md_object *tpobj, struct md_object *sobj, @@ -84,10 +89,10 @@ struct md_dir_operations { /* partial ops for cross-ref case */ int (*mdo_name_insert)(struct lu_context *, struct md_object *, - const char *name, const struct lu_fid *, + const char *, const struct lu_fid *, struct lu_attr *); int (*mdo_name_remove)(struct lu_context *, struct md_object *, - const char *name, struct lu_attr *); + const char *, struct lu_attr *); }; struct md_device_operations { @@ -159,4 +164,37 @@ static inline void md_device_fini(struct md_device *md) lu_device_fini(&md->md_lu_dev); } +/* md operations */ +static inline int mo_attr_get(struct lu_context *cx, struct md_object *m, + struct lu_attr *at) +{ + return m->mo_ops->moo_attr_get(cx, m, at); +} + +static inline int mo_object_create(struct lu_context *cx, struct md_object *m, + struct lu_attr *at) +{ + return m->mo_ops->moo_object_create(cx, m, at); +} + +static inline int mdo_lookup(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); +} + +static inline int mdo_mkdir(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); +} + +static inline int mdo_name_insert(struct lu_context *cx, struct md_object *p, + const char *name, struct lu_fid *f, + struct lu_attr *at) +{ + return p->mo_dir_ops->mdo_name_insert(cx, p, name, f, at); +} + #endif /* _LINUX_MD_OBJECT_H */