RETURN(0);
}
-static void mdc_object_release(const struct lu_context *ctx,
- struct lu_object *lo)
+static int mdc_object_print(const struct lu_context *ctx, void *cookie,
+ lu_printer_t p, const struct lu_object *lo)
{
-}
-
-static int mdc_object_exists(const struct lu_context *ctx, struct lu_object *lo)
-{
- /* we don't know does it exists or not - but suppose that it does*/
- return 1;
-}
-
-static int mdc_object_print(const struct lu_context *ctx,
- struct seq_file *f, const struct lu_object *lo)
-{
- return seq_printf(f, LUSTRE_MDC0_NAME"-object@%p", lo);
+ return (*p)(ctx, cookie, LUSTRE_MDC0_NAME"-object@%p", lo);
}
static struct lu_object_operations mdc_obj_ops = {
.loo_object_init = mdc_object_init,
- .loo_object_release = mdc_object_release,
.loo_object_free = mdc_object_free,
.loo_object_print = mdc_object_print,
- .loo_object_exists = mdc_object_exists
};
/* md_object_operations */
static int mdc_object_create(const struct lu_context *ctx,
- struct md_object *mo, struct lu_attr *attr)
+ struct md_object *mo,
+ const struct md_create_spec *spec,
+ struct md_attr *ma)
{
- struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+ struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
+ struct lu_attr *attr = &ma->ma_attr;
struct mdc_thread_info *mci;
int rc;
ENTRY;
mci = lu_context_key_get(ctx, &mdc_thread_key);
LASSERT(mci);
+ memset(&mci->mci_opdata, 0, sizeof(mci->mci_opdata));
mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
mci->mci_opdata.mod_time = attr->la_mtime;
- mci->mci_opdata.name = NULL;
- mci->mci_opdata.namelen = 0;
-
+ /*TODO: pack create_spec properly */
rc = md_create(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
attr->la_mode, attr->la_uid, attr->la_gid, 0, 0,
&mci->mci_req);
+ ptlrpc_req_finished(mci->mci_req);
+
RETURN(rc);
}
static int mdc_ref_add(const struct lu_context *ctx, struct md_object *mo)
{
- struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+ struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
struct mdc_thread_info *mci;
int rc;
ENTRY;
mci = lu_context_key_get(ctx, &mdc_thread_key);
LASSERT(mci);
+ memset(&mci->mci_opdata, 0, sizeof(mci->mci_opdata));
mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
- mci->mci_opdata.name = NULL;
- mci->mci_opdata.namelen = 0;
rc = md_link(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
+ ptlrpc_req_finished(mci->mci_req);
+
RETURN(rc);
}
-static int mdc_ref_del(const struct lu_context *ctx, struct md_object *mo)
+static int mdc_ref_del(const struct lu_context *ctx, struct md_object *mo,
+ struct md_attr *ma)
{
- struct mdc_device *mc = md2mdc_dev(md_device_get(mo));
+ struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
struct mdc_thread_info *mci;
int rc;
ENTRY;
-
+ /*XXX: update attr after reply */
mci = lu_context_key_get(ctx, &mdc_thread_key);
LASSERT(mci);
+ memset(&mci->mci_opdata, 0, sizeof(mci->mci_opdata));
mci->mci_opdata.fid1 = *lu_object_fid(&mo->mo_lu);
- mci->mci_opdata.name = NULL;
- mci->mci_opdata.namelen = 0;
rc = md_unlink(mc->mc_desc.cl_exp, &mci->mci_opdata, &mci->mci_req);
+ ptlrpc_req_finished(mci->mci_req);
+
RETURN(rc);
}
struct md_object *mo_p, struct md_object *mo_t,
const struct lu_fid *lf, const char *name)
{
- struct mdc_device *mc = md2mdc_dev(md_device_get(mo_p));
+ struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo_p));
struct mdc_thread_info *mci;
int rc;
ENTRY;
mci = lu_context_key_get(ctx, &mdc_thread_key);
LASSERT(mci);
+ memset(&mci->mci_opdata, 0, sizeof(mci->mci_opdata));
mci->mci_opdata.fid1 = *lu_object_fid(&mo_p->mo_lu);
mci->mci_opdata.fid2 = *lf;
rc = md_rename(mc->mc_desc.cl_exp, &mci->mci_opdata, NULL, 0,
name, strlen(name), &mci->mci_req);
+ ptlrpc_req_finished(mci->mci_req);
+
RETURN(rc);
}