ARPDAS_QNX6 1.0
Defines | Functions | Variables
TMbfr.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <ctype.h>
#include "TMbfr.h"
#include "nortlib.h"
#include "nl_assert.h"
#include "oui.h"
#include "rundir.h"
Include dependency graph for TMbfr.c:

Go to the source code of this file.

Defines

#define LOG_EVENTS   0
#define log_event(x)

Functions

static int io_read (resmgr_context_t *ctp, io_read_t *msg, RESMGR_OCB_T *ocb)
static int io_write (resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *ocb)
static int io_notify (resmgr_context_t *ctp, io_notify_t *msg, RESMGR_OCB_T *ocb)
static void do_write (IOFUNC_OCB_T *ocb, int nonblock, int new_rows)
static int io_open (resmgr_context_t *ctp, io_open_t *msg, IOFUNC_ATTR_T *attr, void *extra)
static void read_reply (RESMGR_OCB_T *ocb, int nonblock)
static int process_tm_info (IOFUNC_OCB_T *ocb)
static int data_state_T1 (IOFUNC_OCB_T *ocb, int nonblock)
static int data_state_T2 (IOFUNC_OCB_T *ocb, int nonblock)
static int data_state_T3 (IOFUNC_OCB_T *ocb, int nonblock)
static void queue_tstamp (tstamp_t *ts)
static dq_descriptor_tnew_dq_descriptor (TS_queue_t *TS)
static dq_descriptor_tdq_deref (dq_descriptor_t *dqd, int use_next)
static dq_descriptor_tdq_expire_check (dq_descriptor_t *dqd)
static void enqueue_read (IOFUNC_OCB_T *ocb, int nonblock)
static void run_read_queue (void)
static void lock_dq (void)
static void unlock_dq (void)
static int all_closed (void)
static int allocate_qrows (IOFUNC_OCB_T *ocb, int nrows_req, int nonblock)
static void enqueue_reader (IOFUNC_OCB_T *ocb)
static void dequeue_reader (IOFUNC_OCB_T *ocb)
static void run_write_queue (void)
int min_reader (dq_descriptor_t *dqd)
static tm_ocb_tocb_calloc (resmgr_context_t *ctp, IOFUNC_ATTR_T *device)
static void ocb_free (struct tm_ocb *ocb)
static int setup_mount (char *namebase, int node_type, int mode, IOFUNC_ATTR_T *attr, resmgr_io_funcs_t *funcs)
static void shutdown_mount (int id, char *name)
int main (int argc, char **argv)
static void do_read_reply (RESMGR_OCB_T *ocb, int nb, iov_t *iov, int n_parts)

Variables

static int(* data_state_eval )(IOFUNC_OCB_T *ocb, int nonblock)
static resmgr_connect_funcs_t connect_funcs
static resmgr_io_funcs_t rd_io_funcs
static resmgr_io_funcs_t wr_io_funcs
static IOFUNC_ATTR_T dg_attr
static IOFUNC_ATTR_T dcf_attr
static IOFUNC_ATTR_T dco_attr
static int dg_id
static int dcf_id
static int dco_id
static resmgr_attr_t resmgr_attr
static dispatch_t * dpp
static pthread_mutex_t dg_mutex = PTHREAD_MUTEX_INITIALIZER
static pthread_mutex_t dq_mutex = PTHREAD_MUTEX_INITIALIZER
static int dg_opened = 0
data_queue_t Data_Queue
DQD_Queue_t DQD_Queue
static tm_ocb_tblocked_writer
static tm_ocb_tall_readers
static iofunc_funcs_t ocb_funcs
static iofunc_mount_t mountpoint = { 0, 0, 0, 0, &ocb_funcs }

Define Documentation

#define log_event (   x)

Definition at line 67 of file TMbfr.c.

Referenced by enqueue_read(), io_notify(), io_read(), io_write(), run_read_queue(), and run_write_queue().

#define LOG_EVENTS   0

Definition at line 55 of file TMbfr.c.


Function Documentation

static int all_closed ( void  ) [static]

Definition at line 286 of file TMbfr.c.

References dcf_attr, dco_attr, and dg_attr.

Referenced by main().

Here is the caller graph for this function:

static int allocate_qrows ( IOFUNC_OCB_T *  ocb,
int  nrows_req,
int  nonblock 
) [static]
static int data_state_T1 ( IOFUNC_OCB_T *  ocb,
int  nonblock 
) [static]

Definition at line 733 of file TMbfr.c.

References allocate_qrows(), assert, DQD_Queue_t::last, dataqueue::last, lock_dq(), dq_descriptor::n_Qrows, dataqueue::nbQrow, dataqueue::total_Qrows, and unlock_dq().

Referenced by process_tm_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static int data_state_T2 ( IOFUNC_OCB_T *  ocb,
int  nonblock 
) [static]

Definition at line 768 of file TMbfr.c.

References assert, and nl_error.

Referenced by process_tm_info().

Here is the caller graph for this function:

static int data_state_T3 ( IOFUNC_OCB_T *  ocb,
int  nonblock 
) [static]

Definition at line 775 of file TMbfr.c.

References allocate_qrows(), assert, dataqueue::first, dataqueue::full, DQD_Queue_t::last, dataqueue::last, lock_dq(), dq_descriptor::MFCtr, dq_descriptor::n_Qrows, dataqueue::nbQrow, new_dq_descriptor(), dq_descriptor::Qrows_expired, dataqueue::total_Qrows, and unlock_dq().

Referenced by process_tm_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dequeue_reader ( IOFUNC_OCB_T *  ocb) [static]

Definition at line 96 of file TMbfr.c.

References assert, IOFUNC_OCB_T, lock_dq(), tm_ocb::next_ocb, and unlock_dq().

Referenced by ocb_free().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_read_reply ( RESMGR_OCB_T *  ocb,
int  nb,
iov_t *  iov,
int  n_parts 
) [static]

Definition at line 945 of file TMbfr.c.

References assert, new_memory(), and dataqueue::pbuf_size.

Referenced by read_reply().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_write ( IOFUNC_OCB_T *  ocb,
int  nonblock,
int  new_rows 
) [static]
static dq_descriptor_t * dq_deref ( dq_descriptor_t dqd,
int  use_next 
) [static]

Definition at line 161 of file TMbfr.c.

References assert, dq_expire_check(), dq_descriptor::next, and dq_descriptor::ref_count.

Referenced by ocb_free(), and read_reply().

Here is the call graph for this function:

Here is the caller graph for this function:

static dq_descriptor_t * dq_expire_check ( dq_descriptor_t dqd) [static]

Definition at line 171 of file TMbfr.c.

References assert, DQD_Queue_t::first, free_memory, dq_descriptor::n_Qrows, dq_descriptor::next, tsqueue::ref_count, dq_descriptor::ref_count, and dq_descriptor::TSq.

Referenced by allocate_qrows(), and dq_deref().

Here is the caller graph for this function:

static void enqueue_read ( IOFUNC_OCB_T *  ocb,
int  nonblock 
) [static]

Definition at line 76 of file TMbfr.c.

References dg_opened, log_event, and nl_error.

Referenced by read_reply().

Here is the caller graph for this function:

static void enqueue_reader ( IOFUNC_OCB_T *  ocb) [static]

Definition at line 89 of file TMbfr.c.

References all_readers, lock_dq(), and unlock_dq().

Referenced by ocb_calloc().

Here is the call graph for this function:

Here is the caller graph for this function:

int io_notify ( resmgr_context_t *  ctp,
io_notify_t *  msg,
RESMGR_OCB_T *  ocb 
) [static]

Definition at line 390 of file TMbfr.c.

References tm_attr::attr, dg_opened, DQD_Queue_t::first, lock_dq(), log_event, dq_descriptor::n_Qrows, dq_descriptor::next, tm_attr::notify, dq_descriptor::Qrows_expired, and unlock_dq().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static int io_open ( resmgr_context_t *  ctp,
io_open_t *  msg,
IOFUNC_ATTR_T *  attr,
void *  extra 
) [static]

Definition at line 369 of file TMbfr.c.

References assert, dg_mutex, dg_opened, nl_error, and TM_DG.

Referenced by main().

Here is the caller graph for this function:

static int io_read ( resmgr_context_t *  ctp,
io_read_t *  msg,
RESMGR_OCB_T *  ocb 
) [static]

Definition at line 1117 of file TMbfr.c.

References log_event, dataqueue::nbDataHdr, dataqueue::nbQrow, read_reply(), run_write_queue(), and dataqueue::total_Qrows.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static int io_write ( resmgr_context_t *  ctp,
io_write_t *  msg,
RESMGR_OCB_T *  ocb 
) [static]

Definition at line 420 of file TMbfr.c.

References assert, do_write(), log_event, and TM_DG.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void lock_dq ( void  ) [static]

Definition at line 188 of file TMbfr.c.

References dq_mutex, and nl_error.

Referenced by data_state_T1(), data_state_T3(), dequeue_reader(), do_write(), enqueue_reader(), io_notify(), ocb_free(), process_tm_info(), read_reply(), and run_read_queue().

Here is the caller graph for this function:

int main ( int  argc,
char **  argv 
)
int min_reader ( dq_descriptor_t dqd)

Definition at line 146 of file TMbfr.c.

References DQD_Queue_t::first, IOFUNC_OCB_T, dq_descriptor::n_Qrows, tm_ocb::next_ocb, and dq_descriptor::Qrows_expired.

Referenced by allocate_qrows().

Here is the caller graph for this function:

static dq_descriptor_t * new_dq_descriptor ( TS_queue_t TS) [static]
static tm_ocb_t* ocb_calloc ( resmgr_context_t *  ctp,
IOFUNC_ATTR_T *  device 
) [static]
static void ocb_free ( struct tm_ocb ocb) [static]
static int process_tm_info ( IOFUNC_OCB_T *  ocb) [static]
static void queue_tstamp ( tstamp_t ts) [static]

Definition at line 823 of file TMbfr.c.

References new_dq_descriptor(), new_memory(), tsqueue::ref_count, and tsqueue::TS.

Referenced by do_write(), and process_tm_info().

Here is the call graph for this function:

Here is the caller graph for this function:

static void read_reply ( RESMGR_OCB_T *  ocb,
int  nonblock 
) [static]
static void run_read_queue ( void  ) [static]

Definition at line 122 of file TMbfr.c.

References all_readers, tm_ocb::rw_u::read_s::blocked, dcf_attr, dco_attr, lock_dq(), log_event, tm_ocb::next_ocb, tm_ocb::rw_u::read, read_reply(), run_write_queue(), tm_ocb::rw, and unlock_dq().

Referenced by do_write(), and ocb_free().

Here is the call graph for this function:

Here is the caller graph for this function:

static void run_write_queue ( void  ) [static]

Definition at line 106 of file TMbfr.c.

References data_state_eval, do_write(), log_event, tm_ocb::part_s::nbdata, and tm_ocb::part.

Referenced by io_read(), and run_read_queue().

Here is the call graph for this function:

Here is the caller graph for this function:

static int setup_mount ( char *  namebase,
int  node_type,
int  mode,
IOFUNC_ATTR_T *  attr,
resmgr_io_funcs_t *  funcs 
) [static]

Definition at line 254 of file TMbfr.c.

References connect_funcs, dpp, mountpoint, nl_error, resmgr_attr, and tm_dev_name().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void shutdown_mount ( int  id,
char *  name 
) [static]

Definition at line 279 of file TMbfr.c.

References dpp, and nl_error.

Referenced by main().

Here is the caller graph for this function:

static void unlock_dq ( void  ) [static]

Definition at line 194 of file TMbfr.c.

References dq_mutex, and nl_error.

Referenced by data_state_T1(), data_state_T3(), dequeue_reader(), do_write(), enqueue_reader(), io_notify(), ocb_free(), process_tm_info(), read_reply(), and run_read_queue().

Here is the caller graph for this function:


Variable Documentation

tm_ocb_t* all_readers [static]

Definition at line 53 of file TMbfr.c.

Referenced by enqueue_reader(), and run_read_queue().

Definition at line 52 of file TMbfr.c.

resmgr_connect_funcs_t connect_funcs [static]

Definition at line 40 of file TMbfr.c.

Referenced by main(), and setup_mount().

Definition at line 50 of file TMbfr.c.

int(* data_state_eval)(IOFUNC_OCB_T *ocb, int nonblock) [static]

Definition at line 25 of file TMbfr.c.

Referenced by do_write(), process_tm_info(), and run_write_queue().

IOFUNC_ATTR_T dcf_attr

Definition at line 42 of file TMbfr.c.

Referenced by all_closed(), main(), and run_read_queue().

int dcf_id

Definition at line 43 of file TMbfr.c.

Referenced by main().

IOFUNC_ATTR_T dco_attr

Definition at line 42 of file TMbfr.c.

Referenced by all_closed(), main(), and run_read_queue().

int dco_id

Definition at line 43 of file TMbfr.c.

Referenced by main().

IOFUNC_ATTR_T dg_attr [static]

Definition at line 42 of file TMbfr.c.

Referenced by all_closed(), and main().

int dg_id [static]

Definition at line 43 of file TMbfr.c.

Referenced by main().

pthread_mutex_t dg_mutex = PTHREAD_MUTEX_INITIALIZER [static]

Definition at line 46 of file TMbfr.c.

Referenced by io_open().

int dg_opened = 0 [static]

Definition at line 49 of file TMbfr.c.

Referenced by enqueue_read(), io_notify(), io_open(), main(), ocb_free(), and read_reply().

dispatch_t* dpp [static]

Definition at line 45 of file TMbfr.c.

Referenced by main(), setup_mount(), and shutdown_mount().

pthread_mutex_t dq_mutex = PTHREAD_MUTEX_INITIALIZER [static]

Definition at line 47 of file TMbfr.c.

Referenced by lock_dq(), and unlock_dq().

Definition at line 51 of file TMbfr.c.

iofunc_mount_t mountpoint = { 0, 0, 0, 0, &ocb_funcs } [static]

Definition at line 252 of file TMbfr.c.

Referenced by setup_mount().

iofunc_funcs_t ocb_funcs [static]
Initial value:
 { 
    _IOFUNC_NFUNCS,
    ocb_calloc,
    ocb_free
}

Definition at line 245 of file TMbfr.c.

resmgr_io_funcs_t rd_io_funcs [static]

Definition at line 41 of file TMbfr.c.

Referenced by main().

resmgr_attr_t resmgr_attr [static]

Definition at line 44 of file TMbfr.c.

Referenced by main(), and setup_mount().

resmgr_io_funcs_t wr_io_funcs

Definition at line 41 of file TMbfr.c.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines