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_rebalance_cpx_init(void);
42 M0_INTERNAL void m0_dix_cm_rebalance_cpx_fini(void);
43 
46  const struct m0_reqh_service_type *stype);
47 
50 };
51 
53  &dix_rebalance_svc_type_ops, "M0_CST_DIX_REB",
54  M0_CST_DIX_REB);
55 
59 
62  .rso_start_async = m0_reqh_service_async_start_simple,
63  .rso_stop = dix_rebalance_svc_stop,
64  .rso_fini = m0_dix_cm_svc_fini
65 };
66 
67 extern const struct m0_cm_ops dix_rebalance_ops;
69 
76  const struct m0_reqh_service_type *stype)
77 {
78  M0_ENTRY("stype: %p", stype);
79  M0_PRE(service != NULL && stype != NULL);
84 }
85 
87 {
88  int rc;
89 
91  if (rc == 0) {
97  }
98  return M0_RC(rc);
99 }
100 
102 {
107 }
108 
109 #undef M0_TRACE_SUBSYSTEM
110 
113 /*
114  * Local variables:
115  * c-indentation-style: "K&R"
116  * c-basic-offset: 8
117  * tab-width: 8
118  * fill-column: 80
119  * scroll-step: 1
120  * End:
121  */
122 /*
123  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
124  */
M0_INTERNAL void m0_dix_cm_rebalance_trigger_fop_init(void)
Definition: trigger_fop.c:63
#define M0_PRE(cond)
M0_EXTERN struct m0_cm_type dix_rebalance_cmt
Definition: cm.h:174
int(* rso_start)(struct m0_reqh_service *service)
Definition: reqh_service.h:360
const struct m0_fom_type_ops dix_rebalance_cp_fom_type_ops
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_dix_rebalance_sw_onwire_fop_fini(void)
Definition: sw_fop.c:84
static int dix_rebalance_svc_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: service.c:75
M0_INTERNAL void m0_dix_cm_svc_stop(struct m0_reqh_service *service)
Definition: service.c:96
const struct m0_cm_ops dix_rebalance_ops
Definition: cm.c:79
M0_INTERNAL void m0_dix_rebalance_sw_onwire_fop_init(void)
Definition: sw_fop.c:65
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 void dix_rebalance_svc_stop(struct m0_reqh_service *service)
Definition: service.c:101
static int dix_rebalance_svc_start(struct m0_reqh_service *service)
Definition: service.c:86
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
M0_EXTERN struct m0_dix_cm_type dix_rebalance_dcmt
Definition: cm.h:176
static const struct m0_reqh_service_type_ops dix_rebalance_svc_type_ops
Definition: service.c:48
static const struct m0_reqh_service_ops dix_rebalance_svc_ops
Definition: service.c:60
Definition: cm.h:286
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
M0_INTERNAL void m0_dix_cm_rebalance_cpx_fini(void)
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_INTERNAL void m0_cm_cp_init(struct m0_cm_type *cmtype, const struct m0_fom_type_ops *ft_ops)
Definition: cp.c:580
M0_INTERNAL void m0_dix_cm_rebalance_cpx_init(void)
M0_INTERNAL void m0_dix_cm_rebalance_trigger_fop_fini(void)
Definition: trigger_fop.c:45
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
int32_t rc
Definition: trigger_fop.h:47