Motr  M0
service.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 
30 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_DIXCM
31 #include "lib/trace.h"
32 #include "lib/memory.h"
33 #include "lib/errno.h"
34 #include "reqh/reqh_service.h"
35 #include "cm/cm.h"
36 #include "cm/cp.h"
37 #include "dix/cm/cm.h"
38 #include "dix/cm/service.h"
39 #include "rpc/rpc_opcodes.h"
40 
41 M0_INTERNAL void m0_dix_cm_repair_cpx_init(void);
42 M0_INTERNAL void m0_dix_cm_repair_cpx_fini(void);
43 
46  const struct m0_reqh_service_type *stype);
47 
50 };
51 
53  &dix_repair_svc_type_ops, "M0_CST_DIX_REP",
54  M0_CST_DIX_REP);
55 
57 static int dix_repair_svc_start(struct m0_reqh_service *service);
58 static void dix_repair_svc_stop(struct m0_reqh_service *service);
59 
60 static const struct m0_reqh_service_ops dix_repair_svc_ops = {
62  .rso_start_async = m0_reqh_service_async_start_simple,
63  .rso_stop = dix_repair_svc_stop,
64  .rso_fini = m0_dix_cm_svc_fini
65 };
66 
67 extern const struct m0_cm_ops dix_repair_ops;
69 
76  const struct m0_reqh_service_type *stype)
77 {
78  M0_ENTRY("stype: %p", stype);
79  M0_PRE(service != NULL && stype != NULL);
82 }
83 
85 {
86  int rc;
87 
89  if (rc == 0) {
94  }
95  return M0_RC(rc);
96 }
97 
99 {
104 }
105 
106 #undef M0_TRACE_SUBSYSTEM
107 
110 /*
111  * Local variables:
112  * c-indentation-style: "K&R"
113  * c-basic-offset: 8
114  * tab-width: 8
115  * fill-column: 80
116  * scroll-step: 1
117  * End:
118  */
119 /*
120  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
121  */
#define M0_PRE(cond)
int(* rso_start)(struct m0_reqh_service *service)
Definition: reqh_service.h:360
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_dix_repair_sw_onwire_fop_fini(void)
Definition: sw_fop.c:84
M0_INTERNAL void m0_dix_cm_repair_trigger_fop_init(void)
Definition: trigger_fop.c:63
M0_INTERNAL void m0_dix_cm_repair_cpx_fini(void)
M0_INTERNAL void m0_dix_cm_repair_trigger_fop_fini(void)
Definition: trigger_fop.c:45
M0_INTERNAL void m0_dix_cm_svc_stop(struct m0_reqh_service *service)
Definition: service.c:96
M0_INTERNAL void m0_dix_cm_repair_cpx_init(void)
const struct m0_cm_ops dix_repair_ops
Definition: cm.c:79
M0_INTERNAL int m0_dix_cm_svc_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype, const struct m0_reqh_service_ops *svc_ops, const struct m0_cm_ops *cm_ops, struct m0_dix_cm_type *dcmt)
Definition: service.c:50
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
M0_DIX_CM_TYPE_DECLARE(dix_rebalance, M0_CM_DIX_REB_OPCODE, &dix_rebalance_svc_type_ops, "M0_CST_DIX_REB", M0_CST_DIX_REB)
static const struct m0_reqh_service_ops dix_repair_svc_ops
Definition: service.c:60
static const struct socktype stype[]
Definition: sock.c:1156
M0_INTERNAL int m0_dix_cm_svc_start(struct m0_reqh_service *service)
Definition: service.c:81
static int dix_repair_svc_start(struct m0_reqh_service *service)
Definition: service.c:84
M0_EXTERN struct m0_dix_cm_type dix_repair_dcmt
Definition: cm.h:175
const struct m0_fom_type_ops dix_repair_cp_fom_type_ops
Definition: cm.h:286
static void dix_repair_svc_stop(struct m0_reqh_service *service)
Definition: service.c:98
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
int(* rsto_service_allocate)(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: reqh_service.h:435
M0_INTERNAL void m0_dix_cm_svc_fini(struct m0_reqh_service *service)
Definition: service.c:113
M0_EXTERN struct m0_cm_type dix_repair_cmt
Definition: cm.h:173
M0_INTERNAL void m0_dix_repair_sw_onwire_fop_init(void)
Definition: sw_fop.c:65
static const struct m0_reqh_service_type_ops dix_repair_svc_type_ops
Definition: service.c:48
static int dix_repair_svc_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: service.c:75
M0_INTERNAL void m0_cm_cp_init(struct m0_cm_type *cmtype, const struct m0_fom_type_ops *ft_ops)
Definition: cp.c:580
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
int32_t rc
Definition: trigger_fop.h:47