#ifndef __LVFS_H__
#define __LVFS_H__
+#include <linux/kp30.h>
+
#if defined __KERNEL__
#include <linux/lvfs_linux.h>
#endif
#endif
};
-
#ifdef OBD_CTXT_DEBUG
#define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC
#else
#define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0)
#endif
+/* lvfs_common.c */
+struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *, __u64, __u32, void *data);
+
#ifdef __KERNEL__
void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx,
int lustre_fwrite(struct file *file, const void *buf, int len, loff_t *off);
int lustre_fsync(struct file *file);
-/* lvfs_common.c */
-struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *, __u64, __u32, void *data);
-
static inline void l_dput(struct dentry *de)
{
if (!de || IS_ERR(de))
#ifndef __LVFS_LINUX_H__
#define __LVFS_LINUX_H__
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/sched.h>
+
+#include <linux/lvfs.h>
+
#define l_file file
#define l_dentry dentry
#define l_inode inode
-#define l_dentry_open dentry_open
#define l_filp_open filp_open
+struct obd_run_ctxt;
+struct l_file *l_dentry_open(struct obd_run_ctxt *, struct l_dentry *,
+ int flags);
+
#endif
GOTO(out_up, dchild);
}
- err = ll_vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG, NULL);
+ err = ll_vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG,
+ NULL);
if (err)
GOTO(out_err, err);
}
EXPORT_SYMBOL(lustre_fsync);
-
-
-
-
-
+struct l_file *l_dentry_open(struct obd_run_ctxt *ctxt, struct l_dentry *de,
+ int flags)
+{
+ mntget(ctxt->pwdmnt);
+ return dentry_open(de, ctxt->pwdmnt, flags);
+}
+EXPORT_SYMBOL(l_dentry_open);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
}
RETURN(rc);
}
-EXPORT_SYMBOL(llog_lvfs_write_record);
+EXPORT_SYMBOL(llog_lvfs_write_rec);
int llog_lvfs_next_block(struct llog_handle *loghandle, int cur_idx,
int next_idx, __u64 *cur_offset, void *buf, int len)
rc = obd_create(obd->obd_log_exp, oa, NULL, NULL);
if (rc)
GOTO(out_handle, rc);
- de = obd_lvfs_fid2dentry(handle->lgh_obd, oa->o_id, oa->o_gr);
+ de = obd_lvfs_fid2dentry(obd->obd_log_exp, oa->o_id, oa->o_gr);
if (IS_ERR(de))
GOTO(out_handle, rc = PTR_ERR(de));
- handle->lgh_file = l_dentry_open(de, open_flags);
+ handle->lgh_file = l_dentry_open(&obd->obd_ctxt, de,
+ open_flags);
if (IS_ERR(handle->lgh_file))
GOTO(out_handle, rc = PTR_ERR(handle->lgh_file));
handle->lgh_id.lgl_oid = oa->o_id;
return rc;
}
-
int llog_lvfs_close(struct llog_handle *handle)
{
int rc;
RETURN(rc);
}
-#if 0
int llog_lvfs_destroy(struct llog_handle *handle)
{
+ struct obdo *oa;
+ int rc;
+ ENTRY;
+
+ oa = obdo_alloc();
+ if (oa == NULL)
+ RETURN(-ENOMEM);
+ oa->o_id = handle->lgh_id.lgl_oid;
+ oa->o_gr = handle->lgh_id.lgl_ogr;
+ oa->o_generation = handle->lgh_id.lgl_ogen;
+ oa->o_valid = OBD_MD_FLGROUP | OBD_MD_FLGENER;
+ rc = llog_lvfs_close(handle);
+ if (rc)
+ GOTO(out, rc);
+
+ rc = obd_destroy(handle->lgh_obd->obd_log_exp, oa, NULL, NULL);
+ out:
+ obdo_free(oa);
+ RETURN(rc);
}
+#if 0
/* This is a callback from the llog_* functions.
* Assumes caller has already pushed us into the kernel context. */
int mds_log_close(struct llog_handle *cathandle, struct llog_handle *loghandle)