Example #1
0
File: jack.c Project: huuh/huuwax
int jack_init(struct device *dv, const char *name)
{
    struct jack *jack;

    /* If this is the first JACK deck, initialise the global JACK services */

    if (client == NULL) {
        if (start_jack_client() == -1)
            return -1;
    }

    jack = malloc(sizeof(struct jack));
    if (jack == NULL) {
        perror("malloc");
        return -1;
    }

    jack->started = false;
    if (register_ports(jack, name) == -1)
        goto fail;

    dv->local = jack;
    dv->ops = &jack_ops;

    assert(ndeck < sizeof device);
    device[ndeck] = dv;
    ndeck++;

    return 0;

 fail:
    free(jack);
    return -1;
}
Example #2
0
int jack_init(struct device_t *dv, const char *name)
{
    struct jack_t *jack;

    /* If this is the first JACK deck, initialise the global JACK services */

    if (client == NULL) {
        if (start_jack_client() == -1)
            return -1;
    }

    jack = malloc(sizeof(struct jack_t));
    if (!jack) {
        perror("malloc");
        return -1;
    }

    jack->started = 0;
    if (register_ports(jack, name) == -1)
        goto fail;

    dv->local = jack;
    dv->type = &jack_type;

    assert(decks < MAX_DECKS);
    device[decks] = dv;
    decks++;

    return 0;

 fail:
    free(jack);
    return -1;
}
Example #3
0
int main (void)
{
  ipc_structure_type ipc_structure;
  ata_drive_type *ata_drive;
  unsigned int drive_number;

  /* Set the name of the server. */

  system_process_name_set (PACKAGE_NAME);
  system_thread_name_set ("Initialising");

  log_init (&log_structure, PACKAGE_NAME, &empty_tag);

  for ( drive_number = 0 ; drive_number < number_of_probe ; drive_number++ )
  {
    if (!register_ports (ata_probe_drives[drive_number]))
    {
      continue;
    }

    ata_drive = ata_probe (ata_probe_drives[drive_number]);

    if (ata_drive != NULL)
    {
      switch (ata_drive->type)
      {
	case ATA_HARD_DRIVE :
        {
	  create_hard_drive_service (ata_drive);
          break;
        }

	case ATA_CDROM :
        {
	  create_cdrom_service (ata_drive);
          break;
        }
        /* FIXME: what we must do there ? */
        default :
        {
        }
      }
      ata_drivers[number_of_drives] = ata_drive;
      number_of_drives++;
    }
    else
    {
      unregister_ports (ata_probe_drives[drive_number]);
    }
  }

  system_call_process_parent_unblock ();
  return 0;
}