int llog_declare_write_rec(const struct lu_env *env, struct llog_handle *handle, struct llog_rec_hdr *rec, int idx, struct thandle *th) { struct llog_operations *lop; int raised, rc; ENTRY; rc = llog_handle2ops(handle, &lop); if (rc) RETURN(rc); LASSERT(lop); if (lop->lop_declare_write_rec == NULL) RETURN(-EOPNOTSUPP); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lop->lop_declare_write_rec(env, handle, rec, idx, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); RETURN(rc); }
int llog_write_rec(const struct lu_env *env, struct llog_handle *handle, struct llog_rec_hdr *rec, struct llog_cookie *logcookies, int idx, struct thandle *th) { struct llog_operations *lop; int raised, rc, buflen; ENTRY; rc = llog_handle2ops(handle, &lop); if (rc) RETURN(rc); LASSERT(lop); if (lop->lop_write_rec == NULL) RETURN(-EOPNOTSUPP); buflen = rec->lrh_len; LASSERT(cfs_size_round(buflen) == buflen); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lop->lop_write_rec(env, handle, rec, logcookies, idx, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); RETURN(rc); }
int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_handle **lgh, struct llog_logid *logid, char *name, enum llog_open_param open_param) { int raised; int rc; ENTRY; LASSERT(ctxt); LASSERT(ctxt->loc_logops); if (ctxt->loc_logops->lop_open == NULL) { *lgh = NULL; RETURN(-EOPNOTSUPP); } *lgh = llog_alloc_handle(); if (*lgh == NULL) RETURN(-ENOMEM); (*lgh)->lgh_ctxt = ctxt; (*lgh)->lgh_logops = ctxt->loc_logops; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = ctxt->loc_logops->lop_open(env, *lgh, logid, name, open_param); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); if (rc) { llog_free_handle(*lgh); *lgh = NULL; } RETURN(rc); }
int llog_write_rec(const struct lu_env *env, struct llog_handle *handle, struct llog_rec_hdr *rec, struct llog_cookie *logcookies, int numcookies, void *buf, int idx, struct thandle *th) { struct llog_operations *lop; int raised, rc, buflen; rc = llog_handle2ops(handle, &lop); if (rc) return rc; LASSERT(lop); if (lop->lop_write_rec == NULL) return -EOPNOTSUPP; if (buf) buflen = rec->lrh_len + sizeof(struct llog_rec_hdr) + sizeof(struct llog_rec_tail); else buflen = rec->lrh_len; LASSERT(cfs_size_round(buflen) == buflen); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lop->lop_write_rec(env, handle, rec, logcookies, numcookies, buf, idx, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); return rc; }
int llog_declare_add(const struct lu_env *env, struct llog_handle *lgh, struct llog_rec_hdr *rec, struct thandle *th) { int raised, rc; if (lgh->lgh_logops->lop_declare_add == NULL) return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lgh->lgh_logops->lop_declare_add(env, lgh, rec, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); return rc; }
int llog_add(const struct lu_env *env, struct llog_handle *lgh, struct llog_rec_hdr *rec, struct llog_cookie *logcookies, struct thandle *th) { int raised, rc; ENTRY; if (lgh->lgh_logops->lop_add == NULL) RETURN(-EOPNOTSUPP); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lgh->lgh_logops->lop_add(env, lgh, rec, logcookies, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); RETURN(rc); }
int llog_create(const struct lu_env *env, struct llog_handle *handle, struct thandle *th) { struct llog_operations *lop; int raised, rc; rc = llog_handle2ops(handle, &lop); if (rc) return rc; if (lop->lop_create == NULL) return -EOPNOTSUPP; raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lop->lop_create(env, handle, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); return rc; }
int llog_declare_create(const struct lu_env *env, struct llog_handle *loghandle, struct thandle *th) { struct llog_operations *lop; int raised, rc; ENTRY; rc = llog_handle2ops(loghandle, &lop); if (rc) RETURN(rc); if (lop->lop_declare_create == NULL) RETURN(-EOPNOTSUPP); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = lop->lop_declare_create(env, loghandle, th); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); RETURN(rc); }
int llog_obd_add(const struct lu_env *env, struct llog_ctxt *ctxt, struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, struct llog_cookie *logcookies, int numcookies) { int raised, rc; if (!ctxt) { CERROR("No ctxt\n"); return -ENODEV; } if (ctxt->loc_flags & LLOG_CTXT_FLAG_UNINITIALIZED) return -ENXIO; CTXT_CHECK_OP(ctxt, obd_add, -EOPNOTSUPP); raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE); if (!raised) cfs_cap_raise(CFS_CAP_SYS_RESOURCE); rc = CTXTP(ctxt, obd_add)(env, ctxt, rec, lsm, logcookies, numcookies); if (!raised) cfs_cap_lower(CFS_CAP_SYS_RESOURCE); return rc; }
int cfs_capable(cfs_cap_t cap) { return cfs_cap_raised(cap); }