コード例 #1
0
ファイル: rt_lst.c プロジェクト: jordibrus/proview
pwr_tBoolean
lst_IsLinked (
  thread_sMutex		*mp,
  lst_sEntry		*link
)
{
  pwr_tBoolean		is_linked;
  lst_sEntry		*pred;
  lst_sEntry		*succ;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  pred = link->blink;
  succ = link->flink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(pred->flink == link);
  pwr_Assert(succ->blink == link);

  is_linked = link->flink != link;

  if (mp != NULL) sync_MutexUnlock(mp);

  return is_linked;
}
コード例 #2
0
pool_sQlink *
pool_QinsertSucc (
  pwr_tStatus		*sts,
  pool_sHead		*php,
  pool_sQlink		*item,		/* Item to insert */
  pool_sQlink		*pred		/* Insert after this element */
)
{
  pool_sQlink		*succ;
  volatile pwr_tBoolean	result;

  result = checkInitQ(php, item);
  pwr_Assert(result);

  succ = pool_Address(NULL, php, pred->flink);
  
  pwr_Assert(checkQ(php, succ));
  pwr_Assert(checkQ(php, pred));
  pwr_Assert(succ->blink == pred->self);
  pwr_Assert(succ->self == pred->flink);

  item->blink = pred->self;
  item->flink = pred->flink;
  pred->flink = succ->blink = item->self;

  return succ;  
}
コード例 #3
0
ファイル: rt_lst.c プロジェクト: jordibrus/proview
lst_sEntry *
lst_InsertSucc (
  thread_sMutex		*mp,
  lst_sEntry		*pred,		/* Insert after this element */
  lst_sEntry		*link,		/* link to insert */
  void			*item		/* Item to insert */
)
{
  lst_sEntry		*succ;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  succ = pred->flink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(succ->blink == pred);

  link->blink = pred;
  link->flink = pred->flink;
  pred->flink = succ->blink = link;
  if (item != NULL)
    link->item = item;

  if (mp != NULL) sync_MutexUnlock(mp);

  return succ;  
}
コード例 #4
0
ファイル: rt_cvolcm.c プロジェクト: siamect/proview
void cvolcm_FlushNode(pwr_tStatus* sts, gdb_sNode* np)
{
  pool_sQlink* vl;
  gdb_sVolume* vp;
  gdb_sCclassVolume* cvp;
  pwr_tStatus lsts;

  gdb_AssumeLocked;
  pwr_Assert(np != gdbroot->my_node && np != gdbroot->no_node);

  for (vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh); vl != &np->own_lh;
       vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh)) {
    vp = pool_Qitem(vl, gdb_sVolume, l.own_ll);
    pwr_Assert(vp->l.flags.b.isCached);
    if (vp->l.flags.b.isCached)
      cvolcm_FlushVolume(NULL, vp);
  }

  for (vl = pool_Qsucc(NULL, gdbroot->pool, &np->ccvol_lh); vl != &np->ccvol_lh;
       vl = pool_Qsucc(NULL, gdbroot->pool, &np->ccvol_lh)) {
    cvp = pool_Qitem(vl, gdb_sCclassVolume, ccvol_ll);

    hash_Remove(&lsts, gdbroot->ccvol_ht, cvp);
    if (EVEN(lsts))
      errh_Bugcheck(lsts, "cached class volume inconsistency");

    pool_Qremove(NULL, gdbroot->pool, &cvp->ccvol_ll);
    pool_Free(NULL, gdbroot->pool, cvp);
  }
}
コード例 #5
0
pool_sQlink *
pool_QinsertPred (
  pwr_tStatus		*sts,
  pool_sHead		*php,
  pool_sQlink		*item,		/* Item to insert */
  pool_sQlink		*succ		/* Insert before this element */
)
{
  pool_sQlink		*pred;
  volatile pwr_tBoolean	result;

  result = checkInitQ(php, item);
  pwr_Assert(result);

  pred = pool_Address(sts, php, succ->blink);
  
  pwr_Assert(checkQ(php, succ));
  pwr_Assert(checkQ(php, pred));
  pwr_Assert(pred->flink == succ->self);
  pwr_Assert(pred->self == succ->blink);

  item->flink = succ->self;
  item->blink = succ->blink;
  succ->blink = pred->flink = item->self;

  return pred;  
}
コード例 #6
0
ファイル: rt_lst.c プロジェクト: jordibrus/proview
lst_sEntry *
lst_InsertPred (
  thread_sMutex		*mp,
  lst_sEntry		*succ,		/* Insert before this element */
  lst_sEntry		*link,		/* Link to insert */
  void			*item		/* Item to insert */
)
{
  lst_sEntry		*pred;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(checkInit(link));

  pred = succ->blink;
  
  pwr_Assert(check(succ));
  pwr_Assert(check(pred));
  pwr_Assert(pred->flink == succ);

  link->flink = succ;
  link->blink = succ->blink;
  succ->blink = pred->flink = link;
  if (item != NULL)
    link->item = item;

  if (mp != NULL) sync_MutexUnlock(mp);

  return pred;  
}
コード例 #7
0
ファイル: rt_lst.c プロジェクト: jordibrus/proview
pwr_tBoolean
lst_IsSucc (
  thread_sMutex		*mp,
  lst_sEntry		*pred,
  lst_sEntry		*link
)
{
  lst_sEntry		*succ;
  pwr_tBoolean		is_succ;

  if (mp != NULL) sync_MutexLock(mp);

  pwr_Assert(check(pred));
  pwr_Assert(check(link));


  succ = link->flink;
  
  if (succ != NULL) {
    pwr_Assert(check(succ));
    pwr_Assert(succ->blink == link);
    pwr_Assert(link->flink == succ);
  }

  is_succ = pred->flink == link;

  if (mp != NULL) sync_MutexUnlock(mp);

  return is_succ;  
}
コード例 #8
0
ファイル: co_dbs.c プロジェクト: jordibrus/proview
dbs_sQlink *
dbs_Qinsert(pwr_tStatus *sts, dbs_sQlink *pred, dbs_sQlink *item, dbs_sQlink *succ)
{

    pwr_Assert(pred->succ == succ->self);
    pwr_Assert(succ->pred == pred->self);

    pred->succ = succ->pred = item->self;
    item->pred = pred->self;
    item->succ = succ->self;

    return item;
}
コード例 #9
0
ファイル: co_dbs.c プロジェクト: jordibrus/proview
pwr_tBoolean
dbs_QisNull(pwr_tStatus *sts, const dbs_sVenv *vep, dbs_sQlink *item)
{
    pwr_tBoolean nullQ;

    nullQ = (item->self == dbs_cNref)
        || (item->pred == dbs_cNref)
        || (item->succ == dbs_cNref);
  
    pwr_Assert(item->pred == dbs_cNref);
    pwr_Assert(item->succ == dbs_cNref);
    pwr_Assert(item->self  == dbs_cNref);

    return nullQ;
}
コード例 #10
0
ファイル: rt_subs.c プロジェクト: ManfredHerrmann/proview
void
subs_UnlinkObject (
  gdb_sObject		*op
)
{
  sub_sServer		*sp;
  pool_sQlink		*sl;
  
  gdb_AssumeLocked;

  for (
    sl = pool_Qsucc(NULL, gdbroot->pool, &gdbroot->db->subs_lh);
    sl != &gdbroot->db->subs_lh;
  ) {
    sp = pool_Qitem(sl, sub_sServer, subs_ll);
    if (cdh_ObjidIsEqual(sp->aref.Objid, op->g.oid)) {
      sp->data	= pool_cNRef;
      sp->sts	= GDH__NOSUCHOBJ;

      if ( op->u.n.subcount > 0) /* Subscriptions on invalid offset will allocate buffer without increasing count */
	op->u.n.subcount--;
    }
  }

  pwr_Assert(op->u.n.subcount == 0);

}
コード例 #11
0
ファイル: rt_subs.c プロジェクト: hfuhuang/proview
void
subs_UnlinkObject (
    gdb_sObject		*op
)
{
    sub_sServer		*sp;
    pool_sQlink		*sl;

    gdb_AssumeLocked;

    for (
        sl = pool_Qsucc(NULL, gdbroot->pool, &gdbroot->db->subs_lh);
        sl != &gdbroot->db->subs_lh;
    ) {
        sp = pool_Qitem(sl, sub_sServer, subs_ll);
        if (cdh_ObjidIsEqual(sp->aref.Objid, op->g.oid)) {
            sp->data	= pool_cNRef;
            sp->sts	= GDH__NOSUCHOBJ;

            op->u.n.subcount--;
        }
    }

    pwr_Assert(op->u.n.subcount == 0);

}
コード例 #12
0
ファイル: rt_cvolcm.c プロジェクト: siamect/proview
void cvolcm_ExternVolumeFlush(gdb_sNode* np)
{
  pool_sQlink* vl;
  gdb_sVolume* vp;
  pool_sQlink* ol;
  gdb_sObject* op;
  gdb_sMountServer* msp;
  pwr_tStatus sts;

  // Flush local node
  gdb_AssumeLocked;

  for (vl = pool_Qsucc(NULL, gdbroot->pool, &np->own_lh); vl != &np->own_lh;
       vl = pool_Qsucc(NULL, gdbroot->pool, vl)) {
    vp = pool_Qitem(vl, gdb_sVolume, l.own_ll);
    pwr_Assert(vp->l.flags.b.isCached);
    if (vp->l.flags.b.isCached) {
      for (ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh);
           ol != &vp->l.obj_lh;
           ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh)) {
        op = pool_Qitem(ol, gdb_sObject, l.obj_ll);
        if (op->l.flags.b.isMountServer) {
          msp = (gdb_sMountServer*)hash_Search(
              &sts, gdbroot->ms_ht, &op->g.oid);
          if (msp == NULL)
            errh_Bugcheck(sts, "mount server inconsitency");
          msp->msor = pool_cNRef;
          pool_Qremove(NULL, gdbroot->pool, &msp->nodms_ll);
          /* Todo !!! Clear alarm and blocklevel in all mount clients. */
        }
        cvol_FlushObject(op);
      }
    }
  }
}
コード例 #13
0
ファイル: rt_ivol.c プロジェクト: Strongc/proview
pwr_tBoolean
ivol_BuildVolume (
  pwr_tStatus		*status,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  pwr_dStatus(sts, status, GDH__SUCCESS);

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    vol_LinkObject(sts, vp, op, vol_mLink_build);
    pwr_Assert(ODD(*sts));

  }
  return YES;
}
コード例 #14
0
ファイル: rt_ivol.c プロジェクト: Strongc/proview
static pwr_tBoolean
buildScObjects (
  pwr_tStatus		*status,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*scl;
  gdb_sScObject		*scp;

  pwr_dStatus(sts, status, GDH__SUCCESS); 

  /* Link all sc objects.  */

  for (
    scl = pool_Qsucc(sts, gdbroot->pool, &vp->u.n.sc_lh);
    scl != &vp->u.n.sc_lh;
    scl = pool_Qsucc(sts, gdbroot->pool, scl)
  ) {
    scp = pool_Qitem(scl, gdb_sScObject, sc_ll);

    vol_LinkScObject(sts, vp, scp, vol_mLinkSc_build);
    pwr_Assert(ODD(*sts));

  }
  return YES;
}
コード例 #15
0
ファイル: rt_ivol.c プロジェクト: Strongc/proview
static pwr_tBoolean
mountClients (
  pwr_tStatus		*sts,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    if (op->g.flags.b.isMountClient && op->g.oid.vid == gdbroot->db->vid) {
      /* Only root volumes can mount.  */
      mountVolume(sts, op);
      if ( *sts != GDH__NOMOUNTOBJECT)
	pwr_Assert(ODD(*sts));
    }
  }
  return YES;
}
コード例 #16
0
ファイル: co_time_spec.c プロジェクト: hfuhuang/proview
pwr_tDeltaTime *
time_Uptime (
  pwr_tStatus	  *status,
  pwr_tDeltaTime  *tp,
  pwr_tDeltaTime  *ap
)
{
  pwr_tDeltaTime  time;
  long		  tics;
  void		  *argv[2];

  pwr_dStatus(sts, status, TIME__SUCCESS);

  if (tp == NULL)
    tp = &time;

  argv[0] = (void *) 1;
  argv[1] = &tics;

  *sts = sys$cmexec(&uptime, argv);

  tp->tv_sec = tics / 100;
  tp->tv_nsec = (tics % 100) * 10000000;

  pwr_Assert(tp->tv_sec >= 0 && tp->tv_nsec >= 0);

  if (ap != NULL)
    return time_Dadd(tp, tp, ap);
  else
    return tp;
}
コード例 #17
0
ファイル: co_time.c プロジェクト: jordibrus/proview
pwr_tDeltaTime *
time_Adiff (
  pwr_tDeltaTime  *r,
  pwr_tTime   *t,
  pwr_tTime   *s
)
{
  pwr_tInt64     tv_nsec = t->tv_nsec - s->tv_nsec;
  pwr_tInt64     tv_sec  = t->tv_sec  - s->tv_sec;

  pwr_Assert(r != NULL);
  assertAbs(t);
  assertAbs(s);

  tv_sec  = tv_sec + tv_nsec / 1000000000;
  tv_nsec = tv_nsec % 1000000000;
  if (tv_nsec < 0 && tv_sec > 0) {
    tv_sec--;
    tv_nsec += 1000000000;
  } else if (tv_sec < 0 && tv_nsec > 0) {
    tv_sec++;
    tv_nsec -= 1000000000;
  }

  r->tv_sec = tv_sec;
  r->tv_nsec = tv_nsec;

  return r;
}
コード例 #18
0
ファイル: rt_plc_process.c プロジェクト: hfuhuang/proview
static void
create_thread (
  plc_sThread	*tp,
  plc_sProctbl	*ptp,
  plc_sProcess	*pp
)
{
  pwr_tStatus	sts;
  long int phase;

  tp->aref.Objid = ptp->thread;
  tp->init = ptp->init;
  tp->exec = ptp->exec;
  tp->first_scan = 1;

  tp->PlcThread = pwrb_PlcThread_Init(&sts, tp);
  tp->csup_lh = csup_Init(&sts, ptp->thread, tp->f_scan_time);

  tp->i_scan_time = tp->f_scan_time * 1000.0 + 0.5;

  time_FloatToD(&tp->scan_time, tp->f_scan_time);

  tp->pp = pp;
 
  plc_inittimer(tp);
  tp->exit = FALSE;
  link_io_copy_areas(tp);

  que_Create(&sts, &tp->q_in);
  que_Create(&sts, &tp->q_out);

  sts = gdh_ObjidToName(ptp->thread, tp->name, sizeof(tp->name), cdh_mNName);
  if (EVEN(sts)) {
    errh_Error("Get name of thread object %s, %m", cdh_ObjidToString(NULL, ptp->thread, 1), sts);
    return;
  }

  sts = gdh_ObjidToPointer(ptp->thread, (void *)&tp->PlcThread);
  if (EVEN(sts)) {
    errh_Error("Direct link to thread object \"%s\", %m", tp->name, sts);
    return;
  }

#if defined OS_LYNX && USE_RT_TIMER
  sem_init(&tp->ScanSem, 0, 0);
  tp->ScanMultiple = tp->i_scan_time / (CLK_TCK/1000);
  tp->IntervalCount = tp->ScanMultiple; 
#endif


  sts = thread_Create(&tp->tid, tp->name, (void *(*)())&plc_thread, tp);
  if (EVEN(sts)) {
    errh_Error("Creating thread \"%s\", %m", tp->name, sts);
    return;
  }

  /* Wait for thread to initialize.  */
  phase = (long int)que_Get(&sts, &tp->q_out, NULL, NULL);
  pwr_Assert(phase == 1);
}
コード例 #19
0
ファイル: rt_cvolcm.c プロジェクト: siamect/proview
/**
 * Adds a remote class volume.
 */
void cvolcm_AddClassVolume(
    pwr_tStatus* sts, gdb_sNode* np, const net_sGvolume* vp)
{
  gdb_sCclassVolume *ccvp, *rp;
  gdb_sVolume* cvp;

  gdb_AssumeLocked;
  pwr_Assert(vp != NULL);

  ccvp = pool_Alloc(sts, gdbroot->pool, sizeof(*ccvp));
  if (ccvp == NULL)
    return;

  ccvp->key.nid = vp->nid;
  ccvp->key.vid = vp->vid;
  ccvp->time = net_NetTimeToTime(&vp->time);

  cvp = hash_Search(sts, gdbroot->vid_ht, &vp->vid);
  if (cvp == NULL) /* This volume doesn't exist locally, but we may create it
                      later on */
    ccvp->equalClasses = 0;
  else {
    pwr_tTime t = net_NetTimeToTime(&cvp->g.time);
    ccvp->equalClasses = time_Acomp(&ccvp->time, &t) == 0 ? 1 : 0;
  }

  rp = hash_Insert(sts, gdbroot->ccvol_ht, ccvp);
  if (rp == NULL) { /* This was previously a bugcheck but obviously can occur */
    pool_Free(NULL, gdbroot->pool, ccvp);
    return;
  }

  pool_QinsertPred(NULL, gdbroot->pool, &ccvp->ccvol_ll, &np->ccvol_lh);
}
コード例 #20
0
static void *
allocLookaside (
  pwr_tStatus		*sts,
  pool_sHead		*php,
  pool_sList		*lp
)
{
  pool_sEntry		*ep;  
  pool_uRefBits		pr;
  pool_sSegment		*psp = &php->seg[lp->seg];
  
  
  ep = entryPAdd(psp->base, lp->next * pool_cDataSize);
  lp->next = ep->next;
  
  pr.m = pool_cNRef;
  pr.b.seg = psp->seg;
  pr.b.offs = (pool_tOffset)((char *)ep + sizeof(pool_sEntry) - (char *)psp->base);
  pwr_Assert(entryUnits(lp->size + sizeof(pool_sEntry)) == ep->size);
  ep->next = pr.m;
  psp->gpsp->alloccnt++;

  memset( entryPAdd( ep, sizeof(pool_sEntry)), 0, ep->size*pool_cDataSize - sizeof(pool_sEntry));
  return (void *)entryPAdd( ep, sizeof(pool_sEntry));
}
コード例 #21
0
ファイル: co_dbs.c プロジェクト: jordibrus/proview
dbs_sQlink *
dbs_Qpred(pwr_tStatus *sts, const dbs_sVenv *vep, dbs_sQlink *item)
{
    dbs_sQlink *pred;

    pwr_Assert(checkQ(vep, item));

    pred = dbs_Address(NULL, vep, item->pred);
  
    if (pred != NULL) {
        pwr_Assert(checkQ(vep, pred));
        pwr_Assert(pred->succ == item->self);
        pwr_Assert(pred->self == item->pred);
    }

    return pred;  
}
コード例 #22
0
ファイル: co_dbs.c プロジェクト: jordibrus/proview
dbs_sQlink *
dbs_Qsucc(pwr_tStatus *sts, const dbs_sVenv *vep, dbs_sQlink *item)
{
    dbs_sQlink *succ;

    pwr_Assert(checkQ(vep, item));

    succ = dbs_Address(NULL, vep, item->succ);
  
    if (succ != NULL) {
        pwr_Assert(checkQ(vep, succ));
        pwr_Assert(succ->pred == item->self);
        pwr_Assert(item->succ == succ->self);
    }

    return succ;  
}
コード例 #23
0
ファイル: rt_dl.c プロジェクト: hfuhuang/proview
dl_sLink *
dl_Create (
  pwr_tStatus		*sts,
  mvol_sAttribute	*ap,
  pwr_sAttrRef		*arp
)
{
  pwr_tStatus		lsts;
  dl_sLink		*dp;
  dl_sLink		*rdp;

  gdb_AssumeLocked;

  pwr_Assert(ap != NULL);
  pwr_Assert(ap->op != NULL);
  pwr_Assert(arp != NULL);

  dp = pool_Alloc(NULL, gdbroot->pool, sizeof(dl_sLink));

  do {
    gdbroot->db->dlid.rix++;
    dp->dlid = gdbroot->db->dlid;

    rdp = hash_Insert(&lsts, gdbroot->subc_ht, dp);
    if (rdp != dp && lsts != HASH__DUPLICATE)
      errh_Bugcheck(lsts, "hash_Insert");
  } while (rdp != dp);

  dp->user = gdbroot->my_pid;
  dp->aref = *arp;
  dp->opr   = pool_ItemReference(NULL, gdbroot->pool, ap->op);


  /* Lock the object */

  gdb_LockObject(sts, ap->op);

  /* Insert in list of direct links */

  pool_QinsertSucc(NULL, gdbroot->pool, &dp->dl_ll, &gdbroot->db->dl_lh);
  gdbroot->db->dl_lc++;

  return dp;
}
コード例 #24
0
ファイル: rt_sanc.c プロジェクト: siamect/proview
pwr_tBoolean sanc_Subscribe(pwr_tStatus* sts, gdb_sObject* op)
{
  gdb_sVolume* vp;
  gdb_sNode* np;

  if (sts != NULL)
    *sts = 1;

  gdb_AssumeLocked;

  if (op->l.flags.b.isNative)
    pwr_Return(NO, sts, SAN__NATIVE);

  if (op->u.c.flags.m & (gdb_mCo_sancAdd | gdb_mCo_sancAct)) {
    op->u.c.sanexp = 0;
    return YES;
  }

  vp = pool_Address(NULL, gdbroot->pool, op->l.vr);
  np = pool_Address(NULL, gdbroot->pool, vp->l.nr);

  if (op->u.c.flags.b.sancRem) {
    pool_Qremove(NULL, gdbroot->pool, &op->u.c.sanc_ll);
    op->u.c.flags.b.sancRem = 0;
    pwr_Assert(np->sancRem_lc != 0);
    np->sancRem_lc--;
    pool_QinsertPred(NULL, gdbroot->pool, &op->u.c.sanc_ll, &np->sancAct_lh);
    op->u.c.flags.b.sancAct = 1;
    np->sancAct_lc++;
    return YES;
  }

  pwr_Assert(!pool_QisLinked(NULL, gdbroot->pool, &op->u.c.sanc_ll));

  pool_QinsertPred(NULL, gdbroot->pool, &op->u.c.sanc_ll, &np->sancAdd_lh);
  op->u.c.flags.b.sancAdd = 1;
  memset(&op->l.al, 0, sizeof(op->l.al));
  np->sancAdd_lc++;
  ++gdbroot->db->sancid.rix;
  op->u.c.sanid = gdbroot->db->sancid;
  op->u.c.sanexp = 0;

  return YES;
}
コード例 #25
0
ファイル: rt_cvolcm.c プロジェクト: jordibrus/proview
void
cvolcm_FlushVolume (
  pwr_tStatus		*sts,
  gdb_sVolume		*vp 
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;
  gdb_sMountServer	*msp;

  gdb_AssumeLocked;

  for (
    ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(NULL, gdbroot->pool, &vp->l.obj_lh)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);
    if (op->l.flags.b.isMountServer) {
      msp = hash_Search(sts, gdbroot->ms_ht, &op->g.oid);
      if (msp == NULL) errh_Bugcheck(*sts, "mount server inconsitency");
      msp->msor = pool_cNRef;
      pool_Qremove(NULL, gdbroot->pool, &msp->nodms_ll);
      /* Todo !!! Clear alarm and blocklevel in all mount clients. */
    }
    cvol_FlushObject(op);
  }
  
  pwr_Assert(vp->l.flags.b.inOwnList);
  pool_Qremove(NULL, gdbroot->pool, &vp->l.own_ll);
  vp->l.flags.b.inOwnList = 0;
  vp->g.nid = pwr_cNNodeId;

  pwr_Assert(pool_QisEmpty(NULL, gdbroot->pool, &vp->u.c.cacheLock.lh));
  pwr_Assert(vp->u.c.cacheLock.lc == 0);
  pwr_Assert(pool_QisEmpty(NULL, gdbroot->pool, &vp->u.c.cacheVol.lh));
  pwr_Assert(vp->u.c.cacheVol.lc == 0);

  vp->l.flags.b.isConnected = 0;
  vp->l.flags.b.isCached = 0;
  vp->l.flags.b.netCached = 0;
  vp->l.flags.b.remote = 0;
}
コード例 #26
0
pwr_tBoolean
pool_QisNull (
  pwr_tStatus		*sts,
  pool_sHead		*php,
  pool_sQlink		*item
)
{
  pwr_tBoolean		nullQ;

  nullQ = (item->self == pool_cNRef)
    || (item->blink == pool_cNRef)
    || (item->flink == pool_cNRef);
  
  pwr_Assert(item->blink == pool_cNRef);
  pwr_Assert(item->flink == pool_cNRef);
  pwr_Assert(item->self  == pool_cNRef);

  return nullQ;
}
コード例 #27
0
ファイル: rt_sancm.c プロジェクト: Strongc/proview
void
sancm_MoveExpired (
    pwr_tStatus		*status,
    gdb_sNode		*np
)
{
    pool_sQlink		*ol;
    gdb_sObject		*op;

    if (status != NULL) *status = 1;

    gdb_AssumeLocked;

    if (np->sancAct_lc == 0) return;

    for (
        ol = pool_Qsucc(NULL, gdbroot->pool, &np->sancAct_lh);
        ol != &np->sancAct_lh;
    ) {
        op = pool_Qitem(ol, gdb_sObject, u.c.sanc_ll);
        ol = pool_Qsucc(NULL, gdbroot->pool, ol);

        pwr_Assert(op->u.c.flags.b.sancAct);

        if (op->u.c.sanexp) {
            pool_Qremove(NULL, gdbroot->pool, &op->u.c.sanc_ll);
            op->u.c.flags.b.sancAct = 0;
            pwr_Assert((op->u.c.flags.m & gdb_mCo_inSancList) == 0);
            pwr_Assert(np->sancAct_lc != 0);
            np->sancAct_lc--;

            pool_QinsertPred(NULL, gdbroot->pool, &op->u.c.sanc_ll, &np->sancRem_lh);
            op->u.c.flags.b.sancRem = 1;
            np->sancRem_lc++;
            op->u.c.sanexp = 0;
        } else if (!op->l.flags.b.isMountServer)
            op->u.c.sanexp = 1;
    }
}
コード例 #28
0
ファイル: rt_cvolsm.c プロジェクト: hfuhuang/proview
void
cvolsm_GetObjectInfo (
  qcom_sGet		*get
)
{
  pwr_tStatus		sts;
  mvol_sAttribute	Attribute;
  mvol_sAttribute	*ap;
  int			size;
  net_sGetObjectInfoR	*rmp;
  void			*p = NULL;
  net_sGetObjectInfo	*mp = get->data;
  qcom_sPut		put;
  gdb_sNode		*np;
  cdh_uTypeId		cid;
  gdb_sClass		*cp;

  gdb_AssumeUnlocked;

  size = mp->aref.Size + sizeof(net_sGetObjectInfoR) - sizeof(rmp->info);
  size = (size + 3) & ~3;   /* Size up to nearest multiple of 4.  */
  rmp = net_Alloc(&sts, &put, size, net_eMsg_getObjectInfoR);
  if (EVEN(sts)) return;

  gdb_ScopeLock {
    
    np = hash_Search(NULL, gdbroot->nid_ht, &get->sender.nid);
    pwr_Assert(np != NULL);

    memset( &Attribute, 0, sizeof(Attribute));
    ap = vol_ArefToAttribute(&sts, &Attribute, &mp->aref, gdb_mLo_owned, vol_mTrans_alias);
    if (ap == NULL || ap->op == NULL) break;

    p = vol_AttributeToAddress(&sts, ap);

  } gdb_ScopeUnlock;

  if (p != NULL) {
    size = mp->aref.Size;
    cid.pwr = mp->aref.Body;
    cid.c.bix = 0;	/* To get the class id.  */
    cp = hash_Search(&sts, gdbroot->cid_ht, &cid.pwr);
    if (cp != NULL)    
      ndc_ConvertData(&sts, np, cp, &mp->aref, rmp->info, p, (pwr_tUInt32 *)&size, ndc_eOp_encode, mp->aref.Offset, 0);
  }
  rmp->aref = mp->aref;
  rmp->sts  = sts;
  rmp->size = mp->aref.Size;

  net_Reply(&sts, get, &put, 0);
}
コード例 #29
0
ファイル: rt_plc_process.c プロジェクト: hfuhuang/proview
static void
init_threads (
  plc_sProcess	*pp
)
{
  int i;
  plc_sThread *tp;
  pwr_tStatus sts;
  long int phase;  

  for (i = 0, tp = pp->thread; i < pp->thread_count ; i++, tp++) {
    /* Tell thread it is time for phase 2.  */
    que_Put(&sts, &tp->q_in, &tp->event, (void *)2);
    phase = (long int)que_Get(&sts, &tp->q_out, NULL, NULL);
    pwr_Assert(phase == 2);
  }
}
コード例 #30
0
ファイル: rt_cvolcm.c プロジェクト: jordibrus/proview
void
cvolcm_DeleteObject (
  qcom_sGet		*get
)
{
  pwr_tStatus		sts;
  gdb_sObject		*op;
  gdb_sObject		*pop;
  gdb_sObject		*sop;
  pwr_tObjid		soid;
  gdb_sVolume		*vp;
  net_sDeleteObject	*dop = (net_sDeleteObject *) get->data;

  gdb_AssumeUnlocked;

  gdb_ScopeLock {
    pop = hash_Search(&sts, gdbroot->oid_ht, &dop->par.oid);
    op = hash_Search(&sts, gdbroot->oid_ht, &dop->notify.oid);
    if (op != NULL) {
      pwr_Assert(cdh_ObjidIsEqual(op->g.f.poid, dop->par.oid)); 
      vp = pool_Address(NULL, gdbroot->pool, op->l.vr);
      cvol_FreeObject(&sts, vp, op, vol_mLink_cacheDelete);
    }

    if (pop == NULL) break;

    pop->g.soid = dop->par.soid;
    if (cdh_ObjidIsNull(pop->g.soid)) {
      pop->g.flags.b.isParent = 0;
    }

    soid = dop->par.oid;
    soid.oix = dop->sib.blink;
    sop = hash_Search(&sts, gdbroot->oid_ht, &soid);
    if (sop != NULL)
      sop->g.sib.flink = dop->sib.newflink;

    soid.oix = dop->sib.flink;
    sop = hash_Search(&sts, gdbroot->oid_ht, &soid);
    if (sop != NULL)
      sop->g.sib.blink = dop->sib.newblink;
  } gdb_ScopeUnlock;
}