Motr  M0
service.c File Reference
#include "lib/trace.h"
#include "dtm0/service.h"
#include "be/dtm0_log.h"
#include "dtm0/addb2.h"
#include "dtm0/drlink.h"
#include "dtm0/dtx.h"
#include "dtm0/fop.h"
#include "dtm0/svc_internal.h"
#include "lib/errno.h"
#include "lib/memory.h"
#include "lib/string.h"
#include "lib/tlist.h"
#include "module/instance.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "rpc/rpc_machine.h"
Include dependency graph for service.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_DTM0
 

Functions

static struct m0_dtm0_serviceto_dtm (struct m0_reqh_service *service)
 
static int dtm0_service_start (struct m0_reqh_service *service)
 
static void dtm0_service_stop (struct m0_reqh_service *service)
 
static void dtm0_service_prepare_to_stop (struct m0_reqh_service *service)
 
static int dtm0_service_allocate (struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
 
static void dtm0_service_fini (struct m0_reqh_service *service)
 
 M0_TL_DESCR_DEFINE (dopr, "dtm0_process", static, struct dtm0_process, dop_link, dop_magic, M0_DTM0_PROC_MAGIC, M0_DTM0_PROC_HEAD_MAGIC)
 
 M0_TL_DEFINE (dopr, static, struct dtm0_process)
 
 M0_BOB_DEFINE (static, &dtm0_service_bob, m0_dtm0_service)
 
M0_INTERNAL struct m0_dtm0_servicem0_dtm0_fom2service (struct m0_fom *fom)
 
static void dtm0_service__init (struct m0_dtm0_service *s)
 
static void dtm0_service__fini (struct m0_dtm0_service *s)
 
M0_INTERNAL int m0_dtm_client_service_start (struct m0_reqh *reqh, struct m0_fid *cli_srv_fid, struct m0_reqh_service **out)
 
M0_INTERNAL void m0_dtm_client_service_stop (struct m0_reqh_service *svc)
 
M0_INTERNAL struct dtm0_processdtm0_service_process__lookup (struct m0_reqh_service *reqh_dtm0_svc, const struct m0_fid *remote_dtm0)
 
M0_INTERNAL int m0_dtm0_service_process_connect (struct m0_reqh_service *s, struct m0_fid *remote_srv, const char *remote_ep, bool async)
 
static int dtm0_process_disconnect (struct dtm0_process *process)
 
M0_INTERNAL int m0_dtm0_service_process_disconnect (struct m0_reqh_service *s, struct m0_fid *remote_srv)
 
M0_INTERNAL struct m0_rpc_sessionm0_dtm0_service_process_session_get (struct m0_reqh_service *s, const struct m0_fid *remote_srv)
 
static int dtm0_service__alloc (struct m0_reqh_service **service, const struct m0_reqh_service_type *stype, const struct m0_reqh_service_ops *ops)
 
static int volatile_log_init (struct m0_dtm0_service *dtm0)
 
static int persistent_log_init (struct m0_dtm0_service *dtm0)
 
static int dtm_service__origin_fill (struct m0_reqh_service *service)
 
M0_INTERNAL int m0_dtm0_stype_init (void)
 
M0_INTERNAL void m0_dtm0_stype_fini (void)
 
M0_INTERNAL bool m0_dtm0_is_a_volatile_dtm (struct m0_reqh_service *service)
 
M0_INTERNAL bool m0_dtm0_is_a_persistent_dtm (struct m0_reqh_service *service)
 
M0_INTERNAL struct m0_dtm0_servicem0_dtm0_service_find (const struct m0_reqh *reqh)
 
M0_INTERNAL bool m0_dtm0_in_ut (void)
 
M0_INTERNAL int dtm0_process_init (struct dtm0_process *proc, struct m0_dtm0_service *dtms, const struct m0_fid *rem_svc_fid)
 
M0_INTERNAL void dtm0_process_fini (struct dtm0_process *proc)
 
M0_INTERNAL void dtm0_service_conns_term (struct m0_dtm0_service *service)
 

Variables

static const struct m0_reqh_service_type_ops dtm0_service_type_ops
 
static const struct m0_reqh_service_ops dtm0_service_ops
 
struct m0_reqh_service_type dtm0_service_type
 
static const struct m0_bob_type dtm0_service_bob
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_DTM0

Definition at line 22 of file service.c.

Function Documentation

◆ dtm0_process_disconnect()

static int dtm0_process_disconnect ( struct dtm0_process process)
static

Definition at line 170 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_process_fini()

M0_INTERNAL void dtm0_process_fini ( struct dtm0_process proc)

Definition at line 464 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_process_init()

M0_INTERNAL int dtm0_process_init ( struct dtm0_process proc,
struct m0_dtm0_service dtms,
const struct m0_fid rem_svc_fid 
)

Definition at line 421 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service__alloc()

static int dtm0_service__alloc ( struct m0_reqh_service **  service,
const struct m0_reqh_service_type stype,
const struct m0_reqh_service_ops ops 
)
static

Definition at line 231 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service__fini()

static void dtm0_service__fini ( struct m0_dtm0_service s)
static

Definition at line 104 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service__init()

static void dtm0_service__init ( struct m0_dtm0_service s)
static

Service part

Definition at line 96 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service_allocate()

static int dtm0_service_allocate ( struct m0_reqh_service **  service,
const struct m0_reqh_service_type stype 
)
static

Definition at line 251 of file service.c.

Here is the call graph for this function:

◆ dtm0_service_conns_term()

M0_INTERNAL void dtm0_service_conns_term ( struct m0_dtm0_service service)

Terminates all the connections established from a local service.

Definition at line 471 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service_fini()

static void dtm0_service_fini ( struct m0_reqh_service service)
static

Definition at line 367 of file service.c.

Here is the call graph for this function:

◆ dtm0_service_prepare_to_stop()

static void dtm0_service_prepare_to_stop ( struct m0_reqh_service service)
static

Definition at line 339 of file service.c.

Here is the call graph for this function:

◆ dtm0_service_process__lookup()

M0_INTERNAL struct dtm0_process* dtm0_service_process__lookup ( struct m0_reqh_service reqh_dtm0_svc,
const struct m0_fid remote_dtm0 
)

Definition at line 149 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtm0_service_start()

static int dtm0_service_start ( struct m0_reqh_service service)
static

Definition at line 333 of file service.c.

Here is the call graph for this function:

◆ dtm0_service_stop()

static void dtm0_service_stop ( struct m0_reqh_service service)
static

It is safe to remove any remaining entries from the log when a process with volatile log is going to die.

Definition at line 348 of file service.c.

Here is the call graph for this function:

◆ dtm_service__origin_fill()

static int dtm_service__origin_fill ( struct m0_reqh_service service)
static

Definition at line 285 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( static  ,
dtm0_service_bob,
m0_dtm0_service   
)

◆ m0_dtm0_fom2service()

M0_INTERNAL struct m0_dtm0_service* m0_dtm0_fom2service ( struct m0_fom fom)

Get the DTM0 service this FOM belongs to.

Definition at line 88 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_dtm0_in_ut()

M0_INTERNAL bool m0_dtm0_in_ut ( void  )

Definition at line 415 of file service.c.

Here is the caller graph for this function:

◆ m0_dtm0_is_a_persistent_dtm()

M0_INTERNAL bool m0_dtm0_is_a_persistent_dtm ( struct m0_reqh_service service)

Definition at line 399 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_dtm0_is_a_volatile_dtm()

M0_INTERNAL bool m0_dtm0_is_a_volatile_dtm ( struct m0_reqh_service service)

Definition at line 393 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_dtm0_service_find()

M0_INTERNAL struct m0_dtm0_service* m0_dtm0_service_find ( const struct m0_reqh reqh)

Definition at line 406 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_dtm0_service_process_connect()

M0_INTERNAL int m0_dtm0_service_process_connect ( struct m0_reqh_service s,
struct m0_fid remote_srv,
const char *  remote_ep,
bool  async 
)

Definition at line 158 of file service.c.

◆ m0_dtm0_service_process_disconnect()

M0_INTERNAL int m0_dtm0_service_process_disconnect ( struct m0_reqh_service s,
struct m0_fid remote_srv 
)

Definition at line 209 of file service.c.

Here is the call graph for this function:

◆ m0_dtm0_service_process_session_get()

M0_INTERNAL struct m0_rpc_session* m0_dtm0_service_process_session_get ( struct m0_reqh_service s,
const struct m0_fid remote_srv 
)

Definition at line 222 of file service.c.

Here is the call graph for this function:

◆ m0_dtm0_stype_fini()

M0_INTERNAL void m0_dtm0_stype_fini ( void  )

Definition at line 385 of file service.c.

Here is the call graph for this function:

◆ m0_dtm0_stype_init()

M0_INTERNAL int m0_dtm0_stype_init ( void  )

Definition at line 374 of file service.c.

Here is the call graph for this function:

◆ m0_dtm_client_service_start()

M0_INTERNAL int m0_dtm_client_service_start ( struct m0_reqh reqh,
struct m0_fid cli_srv_fid,
struct m0_reqh_service **  out 
)

Definition at line 113 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_dtm_client_service_stop()

M0_INTERNAL void m0_dtm_client_service_stop ( struct m0_reqh_service svc)

Definition at line 139 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( dopr  ,
static  ,
struct dtm0_process   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( dopr  ,
"dtm0_process"  ,
static  ,
struct dtm0_process  ,
dop_link  ,
dop_magic  ,
M0_DTM0_PROC_MAGIC  ,
M0_DTM0_PROC_HEAD_MAGIC   
)

◆ persistent_log_init()

static int persistent_log_init ( struct m0_dtm0_service dtm0)
static

Definition at line 271 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_dtm()

static struct m0_dtm0_service * to_dtm ( struct m0_reqh_service service)
static

Definition at line 82 of file service.c.

Here is the caller graph for this function:

◆ volatile_log_init()

static int volatile_log_init ( struct m0_dtm0_service dtm0)
static

Definition at line 257 of file service.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ dtm0_service_bob

const struct m0_bob_type dtm0_service_bob
static
Initial value:
= {
.bt_name = "dtm0 service",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_dtm0_service, dos_magix),
.bt_magix = M0_DTM0_SVC_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

typed container_of

Definition at line 74 of file service.c.

◆ dtm0_service_ops

const struct m0_reqh_service_ops dtm0_service_ops
static
Initial value:
= {
.rso_start = dtm0_service_start,
.rso_stop = dtm0_service_stop,
.rso_fini = dtm0_service_fini,
.rso_prepare_to_stop = dtm0_service_prepare_to_stop,
}
static void dtm0_service_fini(struct m0_reqh_service *service)
Definition: service.c:367
static void dtm0_service_prepare_to_stop(struct m0_reqh_service *service)
Definition: service.c:339
static void dtm0_service_stop(struct m0_reqh_service *service)
Definition: service.c:348
static int dtm0_service_start(struct m0_reqh_service *service)
Definition: service.c:333

Definition at line 53 of file service.c.

◆ dtm0_service_type

struct m0_reqh_service_type dtm0_service_type
Initial value:
= {
.rst_name = "M0_CST_DTM0",
.rst_ops = &dtm0_service_type_ops,
.rst_level = M0_RS_LEVEL_LATE,
}
static const struct m0_reqh_service_type_ops dtm0_service_type_ops
Definition: service.c:49

Definition at line 60 of file service.c.

◆ dtm0_service_type_ops

const struct m0_reqh_service_type_ops dtm0_service_type_ops
static
Initial value:
= {
.rsto_service_allocate = dtm0_service_allocate
}
static int dtm0_service_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: service.c:251

Definition at line 49 of file service.c.