Motr  M0
capa.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2020 Seagate Technology LLC and/or its Affiliates
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * For any questions about this software or licensing,
17  * please email opensource@seagate.com or cortx-questions@seagate.com.
18  *
19  */
20 
21 
22 #include "capa.h"
23 
29 M0_INTERNAL int m0_capa_init(struct m0_capa_ctxt *ctxt)
30 {
31  /* TODO This is only stub */
32  return 0;
33 }
34 
35 M0_INTERNAL void m0_capa_fini(struct m0_capa_ctxt *ctxt)
36 {
37  /* TODO This is only stub */
38  return;
39 }
40 
41 M0_INTERNAL int m0_capa_new(struct m0_object_capa *capa,
43  enum m0_capa_operation opcode, void *data)
44 {
45  capa->oc_ctxt = NULL;
46  capa->oc_owner = NULL;
47  capa->oc_type = type;
48  capa->oc_opcode = opcode;
49  capa->oc_data = data;
50  m0_atomic64_set(&capa->oc_ref, 0);
51  return 0;
52 }
53 
54 M0_INTERNAL int m0_capa_get(struct m0_capa_ctxt *ctxt,
55  struct m0_capa_issuer *owner,
56  struct m0_object_capa *capa)
57 {
58  /* TODO This is only stub */
59  capa->oc_ctxt = ctxt;
60  capa->oc_owner = owner;
61 
62  m0_atomic64_inc(&capa->oc_ref);
63  return 0;
64 }
65 
66 M0_INTERNAL void m0_capa_put(struct m0_capa_ctxt *ctxt,
67  struct m0_object_capa *capa)
68 {
69  /* TODO This is only stub */
70  M0_ASSERT(m0_atomic64_get(&capa->oc_ref) > 0);
71  m0_atomic64_dec(&capa->oc_ref);
72  return;
73 }
74 
75 M0_INTERNAL int m0_capa_auth(struct m0_capa_ctxt *ctxt,
76  struct m0_object_capa *capa,
77  enum m0_capa_operation op)
78 {
79  /* TODO This is only stub */
80  return 0;
81 }
82 
83 M0_INTERNAL int m0_capa_ctxt_init(struct m0_capa_ctxt *ctxt)
84 {
85  /* TODO This is only stub */
86  return 0;
87 }
88 
89 M0_INTERNAL void m0_capa_ctxt_fini(struct m0_capa_ctxt *ctxt)
90 {
91  /* TODO This is only stub */
92 }
93 
96 /*
97  * Local variables:
98  * c-indentation-style: "K&R"
99  * c-basic-offset: 8
100  * tab-width: 8
101  * fill-column: 80
102  * scroll-step: 1
103  * End:
104  */
M0_INTERNAL int m0_capa_auth(struct m0_capa_ctxt *ctxt, struct m0_object_capa *capa, enum m0_capa_operation op)
Definition: capa.c:75
static void m0_atomic64_inc(struct m0_atomic64 *a)
struct m0_capa_issuer * oc_owner
Definition: capa.h:93
M0_INTERNAL void m0_capa_fini(struct m0_capa_ctxt *ctxt)
Definition: capa.c:35
enum m0_capa_operation oc_opcode
Definition: capa.h:95
#define NULL
Definition: misc.h:38
m0_capa_operation
Definition: capa.h:67
struct m0_atomic64 oc_ref
Definition: capa.h:96
void * oc_data
Definition: capa.h:101
struct m0_bufvec data
Definition: di.c:40
M0_INTERNAL int m0_capa_init(struct m0_capa_ctxt *ctxt)
Definition: capa.c:29
M0_INTERNAL int m0_capa_ctxt_init(struct m0_capa_ctxt *ctxt)
Definition: capa.c:83
op
Definition: libdemo.c:64
M0_INTERNAL void m0_capa_put(struct m0_capa_ctxt *ctxt, struct m0_object_capa *capa)
Definition: capa.c:66
int opcode
Definition: crate.c:301
#define M0_ASSERT(cond)
static void m0_atomic64_dec(struct m0_atomic64 *a)
m0_capa_entity_type
Definition: capa.h:58
static int64_t m0_atomic64_get(const struct m0_atomic64 *a)
M0_INTERNAL int m0_capa_new(struct m0_object_capa *capa, enum m0_capa_entity_type type, enum m0_capa_operation opcode, void *data)
Definition: capa.c:41
struct m0_capa_ctxt * oc_ctxt
Definition: capa.h:91
M0_INTERNAL int m0_capa_get(struct m0_capa_ctxt *ctxt, struct m0_capa_issuer *owner, struct m0_object_capa *capa)
Definition: capa.c:54
int type
Definition: dir.c:1031
M0_INTERNAL void m0_capa_ctxt_fini(struct m0_capa_ctxt *ctxt)
Definition: capa.c:89
enum m0_capa_entity_type oc_type
Definition: capa.h:94
static void m0_atomic64_set(struct m0_atomic64 *a, int64_t num)