static void osd_thread_fini (struct ptlrpc_thread *t, void *data);
static int osd_type_init (struct lu_device_type *t);
static void osd_type_fini (struct lu_device_type *t);
-static int osd_object_init (struct lu_object *l);
-static void osd_object_release(struct lu_object *l);
+static int osd_object_init (struct lu_context *ctxt, struct lu_object *l);
+static void osd_object_release(struct lu_context *ctxt, struct lu_object *l);
static int osd_object_print (struct seq_file *f, const struct lu_object *o);
static void osd_device_free (struct lu_device *m);
static void osd_device_fini (struct lu_device *d);
return NULL;
}
-static int osd_object_init(struct lu_object *l)
+static int osd_getattr(struct inode *inode, struct lu_attr *attr)
+{
+ //attr->atime = inode->i_atime;
+ //attr->mtime = inode->i_mtime;
+ //attr->ctime = inode->i_ctime;
+ attr->mode = inode->i_mode;
+ attr->size = inode->i_size;
+ attr->blocks = inode->i_blocks;
+ attr->uid = inode->i_uid;
+ attr->gid = inode->i_gid;
+ attr->flags = inode->i_flags;
+ attr->nlink = inode->i_nlink;
+ return 0;
+}
+
+static int osd_object_init(struct lu_context *ctxt, struct lu_object *l)
{
struct osd_device *d = osd_dev(l->lo_dev);
struct osd_object *o = osd_obj(l);
struct lu_fid *f = lu_object_fid(l);
+
+ /* fill lu_attr in ctxt */
+ //XXX temporary hack for proto only
+ osd_getattr(d->od_mount->lmi_sb->s_root->d_inode, &ctxt->lc_attr);
/*
* use object index to locate dentry/inode by fid.
return inode->i_nlink == !!S_ISDIR(inode->i_mode);
}
-static void osd_object_release(struct lu_object *l)
+static void osd_object_release(struct lu_context *ctxt, struct lu_object *l)
{
struct osd_object *o = osd_obj(l);
void *buf, int size, int mode)
{
struct osd_device *osd = dt2osd_dev(d);
- struct super_block *sb = osd->od_mount->lmi_sb;
+ //struct super_block *sb = osd->od_mount->lmi_sb;
int result = -EOPNOTSUPP;
ENTRY;
if (mode == LUSTRE_CONFIG_GET) {
/* to be continued */
+ return 0;
} else {
/* to be continued */
+ return 0;
}
RETURN (result);
RETURN (result);
}
+static int osd_attr_get(struct lu_context *ctxt, struct dt_object *dt,
+ void *buf, int size, const char *name,
+ struct md_params *arg)
+{
+ struct osd_object *o = dt2osd_obj(dt);
+ struct osd_device *dev = osd_obj2dev(o);
+ //struct super_block *sb = dev->od_mount->lmi_sb;
+ struct inode *inode = o->oo_dentry->d_inode;
+ int result = -EOPNOTSUPP;
+
+ ENTRY;
+
+ memset(buf, 0, size);
+ //TODO
+ RETURN (result);
+
+}
+
static struct dt_device_operations osd_dt_ops = {
.dt_root_get = osd_root_get,
.dt_config = osd_config,
struct lustre_mount_info *od_mount;
};
+static inline struct osd_object * dt2osd_obj(struct dt_object *o)
+{
+ return container_of(o, struct osd_object, oo_dt);
+}
+
+static inline struct osd_device * osd_obj2dev(struct osd_object *o) {
+ struct lu_device *lu = o->oo_dt.do_lu.lo_dev;
+ struct dt_device *dt = container_of(lu, struct dt_device, dd_lu_dev);
+
+ return container_of(dt, struct osd_device, od_dt_dev);
+}
+
static inline struct osd_device * dt2osd_dev(struct dt_device *dt) {
return container_of(dt, struct osd_device, od_dt_dev);
}