Beispiel #1
0
static gdb_sNode *
node (
  net_sMessage		*mp
)
{
  pwr_tStatus		sts;
  gdb_sNode		*np;

  if (mp->nid == pwr_cNNodeId) {
    errh_Error("Message from pwr_cNNodeId received");
    return NULL;
  }

  gdb_ScopeLock {
    np = hash_Search(&sts, gdbroot->nid_ht, &mp->nid);
  } gdb_ScopeUnlock;

  if (np == NULL) {
    errh_Error("Message about unknown node: (%s) received\n",
      cdh_NodeIdToString(NULL, mp->nid, 0, 0));
    return NULL;
  }
  
  return np;
}
Beispiel #2
0
static void
bugError (
  qcom_sGet 	*get
)
{

  errh_Warning("Unexpected message type <%d:%d> received from %x @ %s",
    get->type.b, get->type.s, get->pid,
    cdh_NodeIdToString(NULL, get->sender.nid, 0, 0));
}
Beispiel #3
0
static void nodeUp(net_sNodeUp* mp)
{
  pwr_tStatus sts;
  gdb_sNode* np;

  np = hash_Search(&sts, gdbroot->nid_ht, &mp->nid);
  if (np == NULL) {
    errh_Error("Message about unknown node: (%s) received\n",
        cdh_NodeIdToString(NULL, mp->nid, 0, 0));
    return;
  }
  errh_Info("Up, link to node %s (%s)", np->name,
      cdh_NodeIdToString(NULL, mp->nid, 0, 0));

  gdb_ScopeLock
  {
    lockMountServers(np);
    subc_ActivateList(&np->subc_lh, pwr_cNObjid);
    subc_ActivateList(&gdbroot->no_node->subc_lh, pwr_cNObjid);
    sanc_SubscribeMountServers(&sts, np);
  }
  gdb_ScopeUnlock;
}
Beispiel #4
0
static void
connectNode (
  gdb_sNode	*np
)
{

  gdb_AssumeUnlocked;

  if (!np->flags.b.connected) {
    errh_Info("Connected, link to %s (%s)",
      np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0));

    sendId(np);

    np->flags.b.connected = 1;
    np->flags.b.active = 1;
  }

}
Beispiel #5
0
static void
down (
  qdb_sNode   *np,
  char	      *s
)
{

  if (np->state == qdb_eState_down)
    return;

  qdb_ScopeLock {
    np->state = qdb_eState_down;
    nullId(np);
    clock_gettime(CLOCK_REALTIME, &np->timedown);
    removeBcast(np);
    linkNotification(np);
  } qdb_ScopeUnlock;

  errh_Info("Down, link to node %s (%s): %s", np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0), s);
}
Beispiel #6
0
gdb_sVolume *
cvolcm_ConnectVolume (
  pwr_tStatus		*sts,
  gdb_sVolume		*vp,
  net_sGvolume		*gvp,
  gdb_sNode		*np
)
{
  gdb_sTouchQ		*tqp;
  gdb_sVolume		*ovp;

  gdb_AssumeLocked;

  if (vp->g.nid != pwr_cNNodeId && vp->g.nid != np->nid) {
    errh_Error("Volume %s (%s) is loaded from another node.\nCurrent: %s, new: %s",
      vp->g.name.orig, cdh_VolumeIdToString(NULL, vp->g.vid, 1, 0),
      cdh_NodeIdToString(NULL, vp->g.nid, 1, 0),
      cdh_NodeIdToString(NULL, np->nid, 1, 0));
    return NULL;
  }

  vp->g = *gvp;

  pwr_Assert(vp->g.nid != pwr_cNNodeId);

  vp->l.nr = pool_Reference(NULL, gdbroot->pool, np);

  /* Add volume name to hash table.  */

  ovp = hash_Search(NULL, gdbroot->vn_ht, &vp->g.name);
  if (ovp != NULL) {
    if (ovp != vp) {
      errh_Warning("Volume name allready exist: %s, vid: %x\n", vp->g.name.orig, vp->g.vid);
      hash_Remove(NULL, gdbroot->vn_ht, ovp);
      ovp = hash_Insert(sts, gdbroot->vn_ht, vp);
      pwr_Assert(ovp == vp);  
    }
  } else {
    ovp = hash_Insert(sts, gdbroot->vn_ht, vp);
    pwr_Assert(ovp == vp);  
  }
  vp->l.flags.b.inVnTable = 1;

  pwr_Assert(!vp->l.flags.b.inOwnList);  
  pool_QinsertPred(sts, gdbroot->pool, &vp->l.own_ll, &np->own_lh);
  vp->l.flags.b.inOwnList = 1;

  /* Initiate touch queues.  */

  tqp = &vp->u.c.cacheLock;
  pool_Qinit(NULL, gdbroot->pool, &tqp->lh);
  tqp->lc_max = 0;
  tqp->flags.b.cacheLock = 1;
  tqp->next = pool_cNRef;

  tqp = &vp->u.c.cacheVol;
  pool_Qinit(NULL, gdbroot->pool, &tqp->lh);
#if defined OS_ELN
  tqp->lc_max = 100;
#else
  tqp->lc_max = 200;
#endif
  tqp->flags.b.cacheVol = 1;
  tqp->next = pool_Reference(NULL, gdbroot->pool, &np->cacheNode);

  vp->l.flags.b.isConnected = 1;
  vp->l.flags.b.isCached = 1;
  vp->l.flags.b.netCached = 1;
  vp->l.flags.b.remote = 1;
  
  return vp;
}