RETURN(rc);
}
-/* reads the catalog list */
-int llog_get_cat_list(struct obd_device *disk_obd,
- char *name, int idx, int count, struct llog_catid *idarray)
-{
- struct lvfs_run_ctxt saved;
- struct l_file *file;
- int rc, rc1 = 0;
- int size = sizeof(*idarray) * count;
- loff_t off = idx * sizeof(*idarray);
- ENTRY;
-
- if (!count)
- RETURN(0);
-
- push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
- if (!file || IS_ERR(file)) {
- rc = PTR_ERR(file);
- CERROR("OBD filter: cannot open/create %s: rc = %d\n",
- name, rc);
- GOTO(out, rc);
- }
-
- if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
- CERROR("%s is not a regular file!: mode = %o\n", name,
- file->f_dentry->d_inode->i_mode);
- GOTO(out, rc = -ENOENT);
- }
-
- CDEBUG(D_CONFIG, "cat list: disk size=%d, read=%d\n",
- (int)i_size_read(file->f_dentry->d_inode), size);
-
- /* read for new ost index or for empty file */
- memset(idarray, 0, size);
- if (i_size_read(file->f_dentry->d_inode) < off)
- GOTO(out, rc = 0);
-
- rc = fsfilt_read_record(disk_obd, file, idarray, size, &off);
- if (rc) {
- CERROR("OBD filter: error reading %s: rc %d\n", name, rc);
- GOTO(out, rc);
- }
-
- EXIT;
- out:
- pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- if (file && !IS_ERR(file))
- rc1 = filp_close(file, 0);
- if (rc == 0)
- rc = rc1;
- return rc;
-}
-EXPORT_SYMBOL(llog_get_cat_list);
-
-/* writes the cat list */
-int llog_put_cat_list(struct obd_device *disk_obd,
- char *name, int idx, int count, struct llog_catid *idarray)
-{
- struct lvfs_run_ctxt saved;
- struct l_file *file;
- int rc, rc1 = 0;
- int size = sizeof(*idarray) * count;
- loff_t off = idx * sizeof(*idarray);
-
- if (!count)
- GOTO(out1, rc = 0);
-
- push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- file = filp_open(name, O_RDWR | O_CREAT | O_LARGEFILE, 0700);
- if (!file || IS_ERR(file)) {
- rc = PTR_ERR(file);
- CERROR("OBD filter: cannot open/create %s: rc = %d\n",
- name, rc);
- GOTO(out, rc);
- }
-
- if (!S_ISREG(file->f_dentry->d_inode->i_mode)) {
- CERROR("%s is not a regular file!: mode = %o\n", name,
- file->f_dentry->d_inode->i_mode);
- GOTO(out, rc = -ENOENT);
- }
-
- rc = fsfilt_write_record(disk_obd, file, idarray, size, &off, 1);
- if (rc) {
- CDEBUG(D_INODE,"OBD filter: error writeing %s: rc %d\n",
- name, rc);
- GOTO(out, rc);
- }
-
-out:
- pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
- if (file && !IS_ERR(file))
- rc1 = filp_close(file, 0);
-
- if (rc == 0)
- rc = rc1;
-out1:
- RETURN(rc);
-}
-EXPORT_SYMBOL(llog_put_cat_list);
-
static int llog_lvfs_declare_create(const struct lu_env *env,
struct llog_handle *res,
struct thandle *th)
};
EXPORT_SYMBOL(llog_lvfs_ops);
#else /* !__KERNEL__ */
-int llog_get_cat_list(struct obd_device *disk_obd,
- char *name, int idx, int count,
- struct llog_catid *idarray)
-{
- LBUG();
- return 0;
-}
-
-int llog_put_cat_list(struct obd_device *disk_obd,
- char *name, int idx, int count,
- struct llog_catid *idarray)
-{
- LBUG();
- return 0;
-}
-
struct llog_operations llog_lvfs_ops = {};
#endif