char *target,
struct sptlrpc_rule_set *rset)
{
- struct lustre_cfg_bufs bufs;
- struct lustre_cfg *lcfg;
- struct llog_rec_hdr rec;
- int buflen;
- char param[48];
- int i, rc;
-
- for (i = 0; i < rset->srs_nrule; i++) {
- rule2string(&rset->srs_rules[i], param, sizeof(param));
-
- lustre_cfg_bufs_reset(&bufs, NULL);
- lustre_cfg_bufs_set_string(&bufs, 1, target);
- lustre_cfg_bufs_set_string(&bufs, 2, param);
- lcfg = lustre_cfg_new(LCFG_SPTLRPC_CONF, &bufs);
- LASSERT(lcfg);
-
- buflen = lustre_cfg_len(lcfg->lcfg_bufcount,
- lcfg->lcfg_buflens);
- rec.lrh_len = llog_data_len(buflen);
- rec.lrh_type = OBD_CFG_REC;
- rc = llog_write(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1);
- if (rc)
- CERROR("failed to write a rec: rc = %d\n", rc);
- lustre_cfg_free(lcfg);
- }
- return 0;
+ struct llog_cfg_rec *lcr;
+ struct lustre_cfg_bufs bufs;
+ char param[48];
+ int i, rc;
+
+ for (i = 0; i < rset->srs_nrule; i++) {
+ rule2string(&rset->srs_rules[i], param, sizeof(param));
+
+ lustre_cfg_bufs_reset(&bufs, NULL);
+ lustre_cfg_bufs_set_string(&bufs, 1, target);
+ lustre_cfg_bufs_set_string(&bufs, 2, param);
+ lcr = lustre_cfg_rec_new(LCFG_SPTLRPC_CONF, &bufs);
+ if (lcr == NULL)
+ return -ENOMEM;
+ rc = llog_write(NULL, llh, &lcr->lcr_hdr, LLOG_NEXT_IDX);
+ lustre_cfg_rec_free(lcr);
+ if (rc)
+ return rc;
+ }
+ return 0;
}
static int sptlrpc_record_rules(struct llog_handle *llh,
int rc;
ENTRY;
- ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt == NULL)
- RETURN(-EINVAL);
+ RETURN(-EINVAL);
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt);
dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd.dentry,
strlen(MOUNT_CONFIGS_DIR));
rc = lustre_rename(dentry, obd->obd_lvfs_ctxt.pwdmnt,
LOG_SPTLRPC_TMP, LOG_SPTLRPC);
out_dput:
- l_dput(dentry);
+ dput(dentry);
out_ctx:
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- llog_ctxt_put(ctxt);
- CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
- obd->obd_name, rc);
- RETURN(rc);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt);
+ llog_ctxt_put(ctxt);
+ CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
+ obd->obd_name, rc);
+ RETURN(rc);
}
static int local_read_handler(const struct lu_env *env,
RETURN(-EINVAL);
}
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt);
rc = llog_open(NULL, ctxt, &llh, NULL, LOG_SPTLRPC, LLOG_OPEN_EXISTS);
if (rc < 0) {
out_close:
llog_close(NULL, llh);
out_pop:
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- llog_ctxt_put(ctxt);
- CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
- obd->obd_name, rc);
- RETURN(rc);
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt);
+ llog_ctxt_put(ctxt);
+ CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
+ obd->obd_name, rc);
+ RETURN(rc);
}
#endif /* __KRENEL__ */