IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3189


Ignore:
Timestamp:
Feb 11, 2005, 8:45:09 AM (21 years ago)
Author:
eugene
Message:

pcontrol work

Location:
trunk/Ohana/src/opihi/pcontrol
Files:
4 edited

Legend:

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

    r3187 r3189  
    4848}
    4949
    50 int FindHost (char *name, int QueueID) {
     50int FindHost (IDtype HostID, int QueueID) {
     51
     52  Queue *queue;
     53
     54  queue = GetHostQueue (QueueID);
     55  if (queue == NULL) return (-2);
     56
     57  for (i = 0; i < queue[0].Nobject; i++) {
     58    host = (Host *) queue[0].object;
     59    if (host[0].HostID == HostID) {
     60      return (i);
     61    }
     62  }
     63  return (-1);
     64}
     65
     66int FindNamedHost (char *name, int QueueID) {
    5167
    5268  Queue *queue;
     
    7490  host[0].stdout   = 0;
    7591  host[0].stderr   = 0;
    76   host[0].ID       = NextHostID();
     92  host[0].HostID   = NextHostID();
    7793
    7894  host[0].markoff  = FALSE;
  • trunk/Ohana/src/opihi/pcontrol/JobOps.c

    r3187 r3189  
    4848}
    4949 
    50 int FindJob (int JobID, int QueueID) {
     50int FindJob (IDtype JobID, int QueueID) {
    5151
    5252  Job *job;
  • trunk/Ohana/src/opihi/pcontrol/host.c

    r3187 r3189  
    3939
    4040  if (On) {
    41     host = FindHost (argv[1], PCONTROL_HOST_OFF);
    42     if (host == NULL) {
     41    N = FindNamedHost (argv[1], PCONTROL_HOST_OFF);
     42    if (N < 0) {
    4343      fprintf (stderr, "host %s is not OFF\n", argv[1]);
    4444      return (FALSE);
    4545    }
    46     DownHost (host);
     46    host = GetHost (PCONTROL_HOST_OFF, N);
     47    PutHost (host, PCONTROL_HOST_DOWN, QUEUE_BOTTOM);
    4748    return (TRUE);
    4849  }
    4950
    5051  if (Off) {
    51     host = FindHost (argv[1], PCONTROL_HOST_IDLE);
    52     if (host != NULL) {
    53       OffHost (host);
     52    N = FindNamedHost (argv[1], PCONTROL_HOST_IDLE);
     53    if (N >= 0) {
     54      host = GetHost (PCONTROL_HOST_OFF, N);
     55      PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM);
    5456      return (TRUE);
    5557    }
    56     host = FindHost (argv[1], PCONTROL_HOST_DOWN);
    57     if (host != NULL) {
    58       OffHost (host);
     58    N = FindNamedHost (argv[1], PCONTROL_HOST_DOWN);
     59    if (N >= 0) {
     60      host = GetHost (PCONTROL_HOST_OFF, N);
     61      PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM);
    5962      return (TRUE);
    6063    }
    61     host = FindHost (argv[1], PCONTROL_HOST_BUSY);
    62     if (host != NULL) {
    63       MarkOffHost (host);
     64    N = FindNamedHost (argv[1], PCONTROL_HOST_BUSY);
     65    if (N >= 0) {
     66      host = GetHost (PCONTROL_HOST_OFF, N);
     67      PutHost (host, PCONTROL_HOST_OFF, QUEUE_BOTTOM);
    6468      return (TRUE);
    6569    }
  • trunk/Ohana/src/opihi/pcontrol/kill.c

    r3187 r3189  
    44
    55  Job *job;
    6   int JobID;
     6  int JobID, N;
    77
    88  if (argc < 2) {
     
    1212  JobID = atoi (argv[1]);
    1313
    14   job = FindJob (JobID, PCONTROL_JOB_BUSY);
    15   if (job != NULL) {
    16     KillJob (job);
    17     return (TRUE);
     14  N = FindJob (JobID, PCONTROL_JOB_BUSY);
     15  if (N < 0) {
     16    fprintf (stderr, "job %s not BUSY\n", argv[1]);
     17    return (FALSE);
    1818  }
    19 
    20   fprintf (stderr, "job %s not BUSY\n", argv[1]);
    21   return (FALSE);
     19  job = GetJob (PCONTROL_JOB_BUSY, N);
     20  KillJob (job);
     21  return (TRUE);
    2222}
    2323
     
    2525
    2626  Job *job;
    27   int JobID;
     27  int JobID, N;
    2828
    2929  if (argc < 2) {
     
    3232  }
    3333  JobID = atoi (argv[1]);
     34  /* use a string interp to convert JobIDs to ints ? */
    3435
    35   job = FindJob (JobID, PCONTROL_JOB_PENDING);
    36   if (job != NULL) {
     36  N = FindJob (JobID, PCONTROL_JOB_PENDING);
     37  if (N >= 0) {
     38    job = GetJob (PCONTROL_JOB_PENDING, N);
    3739    DelJob (job);
    3840    return (TRUE);
    3941  }
    40   job = FindJob (JobID, PCONTROL_JOB_CRASH);
    41   if (job != NULL) {
     42  N = FindJob (JobID, PCONTROL_JOB_CRASH);
     43  if (N >= 0) {
     44    job = GetJob (PCONTROL_JOB_CRASH, N);
    4245    DelJob (job);
    4346    return (TRUE);
    4447  }
    45   job = FindJob (JobID, PCONTROL_JOB_EXIT);
    46   if (job != NULL) {
     48  N = FindJob (JobID, PCONTROL_JOB_EXIT);
     49  if (N >= 0) {
     50    job = GetJob (PCONTROL_JOB_EXIT, N);
    4751    DelJob (job);
    4852    return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.