Motr  M0
service.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-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 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SNSCM
24 #include "lib/memory.h"
25 #include "lib/assert.h"
26 #include "lib/errno.h"
27 #include "lib/trace.h"
28 #include "lib/misc.h"
29 
30 #include "reqh/reqh_service.h"
31 #include "sns/cm/trigger_fop.h"
32 #include "sns/cm/cm.h"
33 #include "sns/cm/service.h"
34 #include "sns/cm/sns_cp_onwire.h"
35 
44 static int repair_svc_allocate(struct m0_reqh_service **service,
45  const struct m0_reqh_service_type *stype);
46 
49 };
50 
52  &repair_svc_type_ops, "M0_CST_SNS_REP", M0_CST_SNS_REP);
53 
55 static int repair_svc_start(struct m0_reqh_service *service);
56 static void repair_svc_stop(struct m0_reqh_service *service);
57 
58 static const struct m0_reqh_service_ops repair_svc_ops = {
60  .rso_start_async = m0_reqh_service_async_start_simple,
61  .rso_stop = repair_svc_stop,
62  .rso_fini = m0_sns_cm_svc_fini
63 };
64 
65 M0_EXTERN const struct m0_cm_ops sns_repair_ops;
66 M0_EXTERN const struct m0_fom_type_ops repair_cp_fom_type_ops;
67 
68 M0_INTERNAL void m0_sns_cm_repair_cpx_init(void);
69 M0_INTERNAL void m0_sns_cm_repair_cpx_fini(void);
70 
77  const struct m0_reqh_service_type *stype)
78 {
79  M0_ENTRY("stype: %p", stype);
80  M0_PRE(service != NULL && stype != NULL);
82  &sns_repair_ops));
83 }
84 
86 {
87  int rc;
88 
90  if (rc == 0) {
95  }
96  return M0_RC(rc);
97 }
98 
100 {
105 }
106 
107 #undef M0_TRACE_SUBSYSTEM
108 
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  */
#define M0_PRE(cond)
M0_INTERNAL void m0_sns_cm_svc_stop(struct m0_reqh_service *service)
Definition: service.c:108
int(* rso_start)(struct m0_reqh_service *service)
Definition: reqh_service.h:360
#define NULL
Definition: misc.h:38
M0_INTERNAL void m0_sns_cm_repair_sw_onwire_fop_fini(void)
Definition: sw_onwire_fop.c:81
M0_EXTERN const struct m0_fom_type_ops repair_cp_fom_type_ops
Definition: service.c:66
M0_INTERNAL int m0_sns_cm_svc_start(struct m0_reqh_service *service)
Definition: service.c:73
M0_EXTERN const struct m0_cm_ops sns_repair_ops
Definition: service.c:65
static const struct m0_reqh_service_type_ops repair_svc_type_ops
Definition: service.c:47
M0_INTERNAL int m0_sns_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)
Definition: service.c:43
return M0_RC(rc)
M0_INTERNAL void m0_sns_cm_repair_trigger_fop_init(void)
Definition: trigger_fop.c:55
#define M0_ENTRY(...)
Definition: trace.h:170
M0_INTERNAL void m0_sns_cm_svc_fini(struct m0_reqh_service *service)
Definition: service.c:125
M0_INTERNAL void m0_sns_cm_repair_cpx_init(void)
static const struct socktype stype[]
Definition: sock.c:1156
static int repair_svc_start(struct m0_reqh_service *service)
Definition: service.c:85
static void repair_svc_stop(struct m0_reqh_service *service)
Definition: service.c:99
M0_EXTERN struct m0_cm_type sns_repair_cmt
Definition: cm.c:383
Definition: cm.h:286
M0_INTERNAL void m0_sns_cm_repair_sw_onwire_fop_init(void)
Definition: sw_onwire_fop.c:63
M0_INTERNAL void m0_sns_cm_repair_cpx_fini(void)
static int repair_svc_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: service.c:76
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_CM_TYPE_DECLARE(sns_rebalance, M0_CM_REBALANCE_OPCODE, &rebalance_svc_type_ops, "M0_CST_SNS_REB", M0_CST_SNS_REB)
static const struct m0_reqh_service_ops repair_svc_ops
Definition: service.c:58
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_sns_cm_repair_trigger_fop_fini(void)
Definition: trigger_fop.c:43
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
int32_t rc
Definition: trigger_fop.h:47