Changeset 4450 for trunk/Ohana/src/opihi/pcontrol/HostOps.c
- Timestamp:
- Jul 4, 2005, 5:35:47 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/HostOps.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/HostOps.c
r3212 r4450 33 33 fprintf (stderr, "error: unknown host stack : programming error\n"); 34 34 exit (1); 35 } 36 37 Host *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); 35 57 } 36 58 … … 79 101 } 80 102 103 Host *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 121 Host *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 81 137 int FindNamedHost (char *name, int StackID) { 82 138 … … 119 175 FREE (host); 120 176 } 121
Note:
See TracChangeset
for help on using the changeset viewer.
