ARPDAS_QNX6 1.0
|
#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"
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_t * | new_dq_descriptor (TS_queue_t *TS) |
static dq_descriptor_t * | dq_deref (dq_descriptor_t *dqd, int use_next) |
static dq_descriptor_t * | dq_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_t * | ocb_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_t * | blocked_writer |
static tm_ocb_t * | all_readers |
static iofunc_funcs_t | ocb_funcs |
static iofunc_mount_t | mountpoint = { 0, 0, 0, 0, &ocb_funcs } |
#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().
static int all_closed | ( | void | ) | [static] |
static int allocate_qrows | ( | IOFUNC_OCB_T * | ocb, |
int | nrows_req, | ||
int | nonblock | ||
) | [static] |
Definition at line 600 of file TMbfr.c.
References assert, dq_expire_check(), dataqueue::first, DQD_Queue_t::first, dataqueue::full, dataqueue::last, min_reader(), dq_descriptor::n_Qrows, dataqueue::nbQrow, dq_descriptor::next, nl_error, dq_descriptor::Qrows_expired, dataqueue::row, dq_descriptor::starting_Qrow, TM_STATE_DATA, TM_STATE_HDR, and dataqueue::total_Qrows.
Referenced by data_state_T1(), and data_state_T3().
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().
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().
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().
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().
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().
static void do_write | ( | IOFUNC_OCB_T * | ocb, |
int | nonblock, | ||
int | new_rows | ||
) | [static] |
Definition at line 463 of file TMbfr.c.
References assert, data_state_eval, DQD_Queue_t::last, lock_dq(), tm_ocb::rw_u::write_s::nb_msg, nl_error, dataqueue::nonblocking, dataqueue::output_tm_type, process_tm_info(), queue_tstamp(), run_read_queue(), tm_ocb::rw, tm_info, TM_STATE_DATA, TM_STATE_HDR, TM_STATE_INFO, TMHDR_WORD, TMTYPE_DATA_T1, TMTYPE_DATA_T2, TMTYPE_DATA_T3, TMTYPE_DATA_T4, TMTYPE_INIT, TMTYPE_TSTAMP, unlock_dq(), and tm_ocb::rw_u::write.
Referenced by io_write(), and run_write_queue().
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().
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().
static void enqueue_read | ( | IOFUNC_OCB_T * | ocb, |
int | nonblock | ||
) | [static] |
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().
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().
static int io_open | ( | resmgr_context_t * | ctp, |
io_open_t * | msg, | ||
IOFUNC_ATTR_T * | attr, | ||
void * | extra | ||
) | [static] |
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().
static int io_write | ( | resmgr_context_t * | ctp, |
io_write_t * | msg, | ||
RESMGR_OCB_T * | ocb | ||
) | [static] |
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().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 292 of file TMbfr.c.
References all_closed(), connect_funcs, dcf_attr, dcf_id, dco_attr, dco_id, dg_attr, dg_id, dg_opened, dpp, io_notify(), io_open(), io_read(), io_write(), nl_error, rd_io_funcs, resmgr_attr, setup_mount(), setup_rundir(), shutdown_mount(), TM_DCf, TM_DCo, TM_DG, and wr_io_funcs.
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().
static dq_descriptor_t * new_dq_descriptor | ( | TS_queue_t * | TS | ) | [static] |
Definition at line 833 of file TMbfr.c.
References DQD_Queue_t::first, dataqueue::last, DQD_Queue_t::last, dq_descriptor::MFCtr, dq_descriptor::n_Qrows, new_memory(), dq_descriptor::next, dq_descriptor::Qrows_expired, dq_descriptor::ref_count, tsqueue::ref_count, dq_descriptor::Row_num, dq_descriptor::starting_Qrow, and dq_descriptor::TSq.
Referenced by data_state_T3(), and queue_tstamp().
static tm_ocb_t* ocb_calloc | ( | resmgr_context_t * | ctp, |
IOFUNC_ATTR_T * | device | ||
) | [static] |
Definition at line 200 of file TMbfr.c.
References tm_ocb::rw_u::read_s::blocked, tm_ocb::data, tm_ocb::part_s::dptr, tm_ocb::data_s::dqd, enqueue_reader(), tm_ocb::part_s::hdr, tm_ocb::rw_u::read_s::ionotify, tm_ocb::data_s::n_Qrows, tm_ocb::part_s::nbdata, tm_ocb::next_ocb, tm_ocb::part, tm_ocb::rw_u::read, tm_ocb::rw_u::read_s::rows_missing, tm_ocb::rw, tm_ocb::state, TM_DG, and TM_STATE_HDR.
static void ocb_free | ( | struct tm_ocb * | ocb | ) | [static] |
Definition at line 223 of file TMbfr.c.
References tm_ocb::rw_u::read_s::blocked, tm_ocb::rw_u::read_s::buf, tm_ocb::data, dequeue_reader(), dg_opened, dq_deref(), tm_ocb::data_s::dqd, tm_ocb::hdr, tm_ocb::rw_u::read_s::ionotify, lock_dq(), tm_ocb::rw_u::read, run_read_queue(), tm_ocb::rw, TM_DG, and unlock_dq().
static int process_tm_info | ( | IOFUNC_OCB_T * | ocb | ) | [static] |
Definition at line 862 of file TMbfr.c.
References data_state_eval, data_state_T1(), data_state_T2(), data_state_T3(), dataqueue::first, dataqueue::full, dataqueue::last, lock_dq(), dataqueue::nbDataHdr, dataqueue::nbQrow, new_memory(), nl_error, tm_info_t::nrowminf, dataqueue::output_tm_type, dataqueue::pbuf_size, queue_tstamp(), dataqueue::raw, dataqueue::row, tm_info_t::t_stmp, TM_HDR_SIZE_T1, TM_HDR_SIZE_T2, TM_HDR_SIZE_T3, tm_info, tmi, TMTYPE_DATA_T1, TMTYPE_DATA_T2, TMTYPE_DATA_T3, dataqueue::total_Qrows, dataqueue::total_size, and unlock_dq().
Referenced by do_write().
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().
static void read_reply | ( | RESMGR_OCB_T * | ocb, |
int | nonblock | ||
) | [static] |
Definition at line 985 of file TMbfr.c.
References assert, dg_opened, do_read_reply(), dq_deref(), enqueue_read(), DQD_Queue_t::first, lock_dq(), dq_descriptor::MFCtr, dq_descriptor::n_Qrows, dataqueue::nbDataHdr, dataqueue::nbQrow, dq_descriptor::next, nl_error, tm_info_t::nrowminf, dataqueue::output_tm_type, dq_descriptor::Qrows_expired, dq_descriptor::ref_count, dataqueue::row, dq_descriptor::Row_num, dq_descriptor::starting_Qrow, TM_DCo, tm_info, TM_STATE_HDR, TMHDR_WORD, TMTYPE_DATA_T1, TMTYPE_DATA_T2, TMTYPE_DATA_T3, TMTYPE_INIT, TMTYPE_TSTAMP, dataqueue::total_Qrows, tsqueue::TS, dq_descriptor::TSq, and unlock_dq().
Referenced by io_read(), and run_read_queue().
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().
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().
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().
static void shutdown_mount | ( | int | id, |
char * | name | ||
) | [static] |
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().
tm_ocb_t* all_readers [static] |
Definition at line 53 of file TMbfr.c.
Referenced by enqueue_reader(), and run_read_queue().
tm_ocb_t* blocked_writer [static] |
resmgr_connect_funcs_t connect_funcs [static] |
Definition at line 40 of file TMbfr.c.
Referenced by main(), and setup_mount().
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().
IOFUNC_ATTR_T dco_attr |
Definition at line 42 of file TMbfr.c.
Referenced by all_closed(), main(), and run_read_queue().
IOFUNC_ATTR_T dg_attr [static] |
Definition at line 42 of file TMbfr.c.
Referenced by all_closed(), and main().
pthread_mutex_t dg_mutex = PTHREAD_MUTEX_INITIALIZER [static] |
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().
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] |
{ _IOFUNC_NFUNCS, ocb_calloc, ocb_free }
resmgr_io_funcs_t rd_io_funcs [static] |
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 |