Esempio n. 1
0
/*
 * Try to read block 0 for block devices.
 */
void int_media_check(hd_data_t *hd_data)
{
  hd_t *hd;
  int i, j = 0;

  for(hd = hd_data->hd; hd; hd = hd->next) {
    if(!hd_report_this(hd_data, hd)) continue;
    if(
      hd->base_class.id == bc_storage_device &&
      (
        /* hd->sub_class.id == sc_sdev_cdrom || */ /* cf. cdrom.c */
        hd->sub_class.id == sc_sdev_disk ||
        hd->sub_class.id == sc_sdev_floppy
      ) &&
      hd->unix_dev_name &&
      !hd->block0 &&
      !hd->is.notready &&
      hd->status.available != status_no
    ) {
      i = 5;
      PROGRESS(4, ++j, hd->unix_dev_name);
      hd->block0 = read_block0(hd_data, hd->unix_dev_name, &i);
      hd->is.notready = hd->block0 ? 0 : 1;
#if defined(__i386__) || defined(__x86_64__)
      if(hd->block0) {
        ADD2LOG("  mbr sig: 0x%08x\n", edd_disk_signature(hd));
      }
#endif
    }
  }
}
Esempio n. 2
0
/*
 * Try to read block 0 for block devices.
 */
void int_media_check(hd_data_t *hd_data)
{
    hd_t *hd;
    int i, j = 0;

    for(hd = hd_data->hd; hd; hd = hd->next) {
        if(!hd_report_this(hd_data, hd)) continue;
        if(
            hd->base_class.id == bc_storage_device &&
            (
                /* hd->sub_class.id == sc_sdev_cdrom || */ /* cf. cdrom.c */
                hd->sub_class.id == sc_sdev_disk ||
                hd->sub_class.id == sc_sdev_floppy
            ) &&
            hd->unix_dev_name &&
            !hd->block0 &&
            !hd->is.notready &&
            hd->status.available != status_no
        ) {
            i = 5;
            PROGRESS(4, ++j, hd->unix_dev_name);
            hd->block0 = read_block0(hd_data, hd->unix_dev_name, &i);
            hd->is.notready = hd->block0 ? 0 : 1;
        }
    }
}
Esempio n. 3
0
int hd_write_config(hd_data_t *hd_data, hd_t *hd)
{
  char *udi;

  if(!hd_report_this(hd_data, hd)) return 0;

  hd2prop(hd_data, hd);

  udi = hd->unique_id;
  if(hd->udi) udi = hd->udi;

  if(!udi) return 5;

  return hd_write_properties(udi, hd->persistent_prop);
}