IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 4, 2005, 5:35:47 PM (21 years ago)
Author:
eugene
Message:

substantial dev work on scheduler/pcontrol/pclient

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/HostOps.c

    r3212 r4450  
    3333  fprintf (stderr, "error: unknown host stack : programming error\n");
    3434  exit (1);
     35}
     36
     37Host *FindHostStack (IDtype HostID) {
     38
     39  Host *host;
     40
     41  host = FindHostPtr (HostID, PCONTROL_HOST_IDLE);
     42  if (host != NULL) return (host);
     43
     44  host = FindHostPtr (HostID, PCONTROL_HOST_DOWN);
     45  if (host != NULL) return (host);
     46
     47  host = FindHostPtr (HostID, PCONTROL_HOST_DONE);
     48  if (host != NULL) return (host);
     49
     50  host = FindHostPtr (HostID, PCONTROL_HOST_BUSY);
     51  if (host != NULL) return (host);
     52
     53  host = FindHostPtr (HostID, PCONTROL_HOST_OFF);
     54  if (host != NULL) return (host);
     55
     56  return (NULL);
    3557}
    3658
     
    79101}
    80102
     103Host *FindHostPtr (IDtype HostID, int StackID) {
     104
     105  int i;
     106  Host *host;
     107  Stack *stack;
     108
     109  stack = GetHostStack (StackID);
     110  if (stack == NULL) return (NULL);
     111
     112  for (i = 0; i < stack[0].Nobject; i++) {
     113    host = (Host *) stack[0].object[i];
     114    if (host[0].HostID == HostID) {
     115      return (host);
     116    }
     117  }
     118  return (NULL);
     119}
     120
     121Host *PullHost (IDtype HostID, int StackID) {
     122 
     123  int N;
     124  Host *host;
     125
     126  N = FindHost (HostID, StackID);
     127  if (N < 0) return (NULL);
     128
     129  host = GetHost (StackID, N);
     130  if (host == NULL) {
     131    fprintf (stderr, "programming error! host missing from stack\n");
     132    exit (1);
     133  }
     134  return (host);
     135}
     136
    81137int FindNamedHost (char *name, int StackID) {
    82138
     
    119175  FREE (host);
    120176}
    121 
Note: See TracChangeset for help on using the changeset viewer.