if (loghandle == NULL)
RETURN(ERR_PTR(-ENOMEM));
- OBD_ALLOC(loghandle->lgh_hdr, LLOG_CHUNK_SIZE);
- if (loghandle->lgh_hdr == NULL) {
- OBD_FREE(loghandle, sizeof(*loghandle));
- RETURN(ERR_PTR(-ENOMEM));
- }
sema_init(&loghandle->lgh_lock, 1);
RETURN(loghandle);
}
EXPORT_SYMBOL(llog_cancel_rec);
-int llog_init_handle(struct llog_handle *handle, int flags, struct obd_uuid *uuid)
+int llog_init_handle(struct llog_handle *handle, int flags,
+ struct obd_uuid *uuid)
{
int rc;
struct llog_log_hdr *llh;
-
+ ENTRY;
LASSERT(handle->lgh_hdr == NULL);
OBD_ALLOC(llh, sizeof(*llh));
- if (!llh)
+ if (llh == NULL)
RETURN(-ENOMEM);
handle->lgh_hdr = llh;
- rc = llog_lvfs_read_hdr(handle);
- if (rc == 0) {
+ rc = llog_read_header(handle);
+ if (rc == 0) {
LASSERT(llh->llh_flags == flags);
LASSERT(obd_uuid_equals(uuid, &llh->llh_tgtuuid));
RETURN(0);
if (rc)
OBD_FREE(llh, sizeof(*llh));
return(rc);
-
}
+EXPORT_SYMBOL(llog_init_handle);
int llog_process_log(struct llog_handle *loghandle, llog_cb_t cb, void *data)
{
struct llog_handle *handle;
struct l_dentry *dchild;
struct obdo *oa = NULL;
- int rc, cleanup_phase = 1, open_flags = O_RDWR | O_CREAT | O_LARGEFILE;
+ int rc = 0, cleanup_phase = 1;
+ int open_flags = O_RDWR | O_CREAT | O_LARGEFILE;
ENTRY;
handle = llog_alloc_handle();
- if (!handle)
+ if (handle == NULL)
RETURN(-ENOMEM);
*res = handle;
-
if (logid != NULL) {
dchild = obd_lvfs_fid2dentry(obd->obd_log_exp, logid->lgl_oid,
logid->lgl_ogr);
} else if (name) {
LASSERT(strlen(name) <= 18);
sprintf(logname, "LOGS/%s", name);
-
+
handle->lgh_file = l_filp_open(logname, open_flags, 0644);
if (IS_ERR(handle->lgh_file)) {
rc = PTR_ERR(handle->lgh_file);
handle->lgh_file->f_dentry->d_inode->i_generation;
} else {
oa = obdo_alloc();
- if (!oa)
+ if (oa == NULL)
GOTO(cleanup, rc = -ENOMEM);
/* XXX */
oa->o_gr = 1;
oa->o_valid = OBD_MD_FLGROUP;
rc = obd_create(obd->obd_log_exp, oa, NULL, NULL);
- if (rc)
+ if (rc)
GOTO(cleanup, rc);
- dchild = obd_lvfs_fid2dentry(obd->obd_log_exp, oa->o_id, oa->o_gr);
+ dchild = obd_lvfs_fid2dentry(obd->obd_log_exp, oa->o_id,
+ oa->o_gr);
if (IS_ERR(dchild))
GOTO(cleanup, rc = PTR_ERR(dchild));
cleanup_phase = 2;
- handle->lgh_file = l_dentry_open(&obd->obd_ctxt, dchild, open_flags);
+ handle->lgh_file = l_dentry_open(&obd->obd_ctxt, dchild,
+ open_flags);
if (IS_ERR(handle->lgh_file))
GOTO(cleanup, rc = PTR_ERR(handle->lgh_file));
handle->lgh_id.lgl_oid = oa->o_id;
return rc;
}
-
static int llog_lvfs_close(struct llog_handle *handle)
{
int rc;