Changeset 18098 for trunk/Ohana/src/opihi/pcontrol/HostOps.c
- Timestamp:
- Jun 12, 2008, 12:52:06 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pcontrol/HostOps.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pcontrol/HostOps.c
r17476 r18098 1 1 # include "pcontrol.h" 2 3 Stack *HostPool_AllHosts; // virtual pool for user status queries 2 4 3 5 Stack *HostPool_Idle; // these hosts are waiting for something to do … … 9 11 10 12 void InitHostStacks () { 13 HostPool_AllHosts = InitStack (); 14 11 15 HostPool_Idle = InitStack (); 12 16 HostPool_Busy = InitStack (); … … 26 30 27 31 void FreeHostStacks () { 32 // AllHosts is a virtual stack : all hosts are references 33 FreeStack (HostPool_AllHosts); 34 28 35 FreeHostStack (HostPool_Idle); 29 36 FreeHostStack (HostPool_Busy); … … 36 43 char *GetHostStackName (int StackID) { 37 44 switch (StackID) { 45 case PCONTROL_HOST_ALLHOSTS: return ("ALLHOSTS"); 38 46 case PCONTROL_HOST_IDLE: return ("IDLE"); 39 47 case PCONTROL_HOST_DOWN: return ("DOWN"); … … 50 58 Stack *GetHostStack (int StackID) { 51 59 switch (StackID) { 60 case PCONTROL_HOST_ALLHOSTS: return (HostPool_AllHosts); 52 61 case PCONTROL_HOST_IDLE: return (HostPool_Idle); 53 62 case PCONTROL_HOST_DOWN: return (HostPool_Down); … … 63 72 64 73 Stack *GetHostStackByName (char *name) { 74 if (!strcasecmp (name, "all")) return (HostPool_AllHosts); 65 75 if (!strcasecmp (name, "idle")) return (HostPool_Idle); 66 76 if (!strcasecmp (name, "down")) return (HostPool_Down); … … 202 212 host[0].markoff = FALSE; 203 213 host[0].job = NULL; 214 215 PutHost (host, PCONTROL_HOST_ALLHOSTS, STACK_BOTTOM); 204 216 PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM); 205 217 return (host[0].HostID); … … 207 219 208 220 void DelHost (Host *host) { 221 222 Host *copy; 223 224 copy = PullStackByID (HostPool_AllHosts, host[0].HostID); 225 ASSERT (copy == host, "programming error: ALLHOSTS entry does not match"); 226 209 227 FreeIOBuffer (&host[0].comms_buffer); 210 228 FREE (host[0].hostname);
Note:
See TracChangeset
for help on using the changeset viewer.
