Block devices
Implementation internals » Device handling

Block device functions. More...

## Functions

static void | get_block_devs (hd_data_t *hd_data)
static void | add_partitions (hd_data_t *hd_data, hd_t *hd, char *path)
static void | add_cdrom_info (hd_data_t *hd_data, hd_t *hd)
static void | add_other_sysfs_info (hd_data_t *hd_data, hd_t *hd)
static void | add_ide_sysfs_info (hd_data_t *hd_data, hd_t *hd)
static void | add_scsi_sysfs_info (hd_data_t *hd_data, hd_t *hd, char *sf_dev)
static void | read_partitions (hd_data_t *hd_data)
static void | read_cdroms (hd_data_t *hd_data)
static cdrom_info_t * | new_cdrom_entry (cdrom_info_t **ci)
static cdrom_info_t * | get_cdrom_entry (cdrom_info_t *ci, int n)
static void | get_scsi_tape (hd_data_t *hd_data)
static void | get_generic_scsi_devs (hd_data_t *hd_data)
static void | add_disk_size (hd_data_t *hd_data, hd_t *hd)
void | hd_scan_sysfs_block (hd_data_t *hd_data)
char * | hd_sysfs_find_driver (hd_data_t *hd_data, char *sysfs_id, int exact)
cdrom_info_t * | hd_read_cdrom_info (hd_data_t *hd_data, hd_t *hd)
void | hd_scan_sysfs_scsi (hd_data_t *hd_data)

## Detailed Description

Block device functions.

## Function Documentation

## add_cdrom_info()

void add_cdrom_info | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

static

References ADD2LOG, s_hd_t::is_s::bd, s_hd_t::is_s::bdr, s_hd_t::is_s::bdre, cdrom_info_s::cdr, s_hd_t::is_s::cdr, hd_detail_t::cdrom, cdrom_info_s::cdrw, s_hd_t::is_s::cdrw, hd_detail_cdrom_t::data, s_hd_t::detail, DRIVE_CDROM_CAPS_BDR, DRIVE_CDROM_CAPS_BDRE, DRIVE_CDROM_CAPS_BDROM, DRIVE_CDROM_CAPS_DVDPLUSR, DRIVE_CDROM_CAPS_DVDPLUSRDL, DRIVE_CDROM_CAPS_DVDPLUSRW, DRIVE_CDROM_CAPS_DVDPLUSRWDL, DRIVE_CDROM_CAPS_DVDRDL, DRIVE_CDROM_CAPS_DVDRW, DRIVE_CDROM_CAPS_HDDVDR, DRIVE_CDROM_CAPS_HDDVDROM, DRIVE_CDROM_CAPS_HDDVDRW, cdrom_info_s::dvd, s_hd_t::is_s::dvd, s_hd_t::is_s::dvdpr, s_hd_t::is_s::dvdprdl, s_hd_t::is_s::dvdprw, s_hd_t::is_s::dvdprwdl, cdrom_info_s::dvdr, s_hd_t::is_s::dvdr, cdrom_info_s::dvdram, s_hd_t::is_s::dvdram, s_hd_t::is_s::dvdrdl, s_hd_t::is_s::dvdrw, free_hd_detail(), get_dvd_profile(), s_hd_t::is_s::hd, hd_data, hd_detail_cdrom, hd_probe_feature(), hd_read_cdrom_info(), hd_report_this(), s_hd_t::is_s::hdr, s_hd_t::is_s::hdrw, hd_id_t::id, s_hd_t::is, s_hd_t::is_s::mo, s_hd_t::is_s::mrw, s_hd_t::is_s::mrww, cdrom_info_s::name, new_mem(), cdrom_info_s::next, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram, pr_block_cdrom, s_hd_t::prog_if, hd_detail_t::type, and s_hd_t::unix_dev_name.

Referenced by get_block_devs().

## add_disk_size()

void add_disk_size | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

static

References add_res_entry(), free_mem(), hd_data, hd_getdisksize(), hd_id_t::id, s_hd_t::is, s_hd_t::is_s::notready, PROGRESS, s_hd_t::res, sc_sdev_disk, str_printf(), s_hd_t::sub_class, and s_hd_t::unix_dev_name.

Referenced by add_ide_sysfs_info(), and add_other_sysfs_info().

## add_ide_sysfs_info()

void add_ide_sysfs_info | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

static

References add_disk_size(), add_res_entry(), add_str_list(), u_hd_res_t::cache, canon_str(), res_disk_geo_t::cyls, s_hd_t::device, u_hd_res_t::disk_geo, s_hd_t::drivers, free_mem(), free_str_list(), geo_logical, geo_physical, res_disk_geo_t::geotype, hd_data, hd_report_this(), res_disk_geo_t::heads, hd_id_t::id, hd_id_t::name, new_mem(), s_str_list_t::next, PROC_IDE, read_file(), s_hd_t::res, res_cache, res_disk_geo, res_size, s_hd_t::revision, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_tape, search_str_list(), res_disk_geo_t::sectors, s_hd_t::serial, res_cache_t::size, u_hd_res_t::size, size_unit_sectors, s_hd_t::slot, s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sysfs_bus_id, res_cache_t::type, res_disk_geo_t::type, res_size_t::type, res_size_t::unit, s_hd_t::unix_dev_name, res_size_t::val1, res_size_t::val2, and s_hd_t::vendor.

Referenced by get_block_devs().

## add_other_sysfs_info()

void add_other_sysfs_info | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

static

References add_disk_size(), s_hd_t::device, hd_data, hd_set_hw_class(), hw_redasd, hd_id_t::name, new_str(), s_hd_t::slot, str_printf(), and s_hd_t::sysfs_id.

Referenced by get_block_devs().

## add_partitions()

void add_partitions | ( | hd_data_t * | hd_data,
|  | hd_t * | hd,
|  | char * | path )

static

References add_hd_entry(), s_hd_t::attached_to, s_hd_t::base_class, bc_partition, hd_data, hd_sysfs_dev2_name(), hd_id_t::id, s_hd_t::idx, s_str_list_t::next, s_str_list_t::str, str_printf(), s_hd_t::sysfs_id, and s_hd_t::unix_dev_name.

Referenced by get_block_devs().

## add_scsi_sysfs_info()

void add_scsi_sysfs_info | ( | hd_data_t * | hd_data,
|  | hd_t * | hd,
|  | char * | sf_dev )

static

References ADD2LOG, add_res_entry(), u_hd_res_t::any, s_hd_t::attached_to, s_hd_t::base_class, bc_scanner, bc_storage_device, s_hd_t::bus, bus_ide, bus_pci, scsi_s::cache, canon_str(), res_fc_t::controller_id, scsi_s::controller_id, hd_detail_scsi_t::data, s_hd_t::detail, scsi_s::dev_name, s_hd_t::device, s_hd_t::drivers, u_hd_res_t::fc, s_hd_t::is_s::fcoe, res_fc_t::fcp_lun, scsi_s::fcp_lun, res_fc_t::fcp_lun_ok, scsi_s::fcp_lun_ok, free_mem(), free_res_list(), s_hd_t::func, get_sysfs_attr_by_path(), hd_attr_uint(), hd_data, hd_detail_scsi, hd_get_device_by_idx(), hd_getdisksize(), hd_log_hex(), hd_probe_feature(), hd_report_this(), hd_sysfs_id(), hd_id_t::id, s_hd_t::is, MAKE_ID, hd_id_t::name, new_mem(), new_str(), s_str_list_t::next, s_hd_t::is_s::notready, pif_cdr, res_fc_t::port_id, res_fc_t::port_id_ok, pr_scsi_noserial, s_hd_t::prog_if, PROGRESS, s_hd_t::res, res_fc, s_hd_t::revision, s_hd_t::rom_id, sc_sdev_cdrom, sc_sdev_disk, sc_sdev_other, sc_sdev_scanner, hd_detail_t::scsi, search_str_list(), s_hd_t::serial, s_hd_t::slot, s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sub_device, s_hd_t::sub_vendor, s_hd_t::sysfs_bus_id, s_hd_t::sysfs_device_link, TAG_PCI, hd_detail_t::type, res_any_t::type, s_hd_t::unix_dev_name, s_hd_t::vendor, res_fc_t::wwpn, scsi_s::wwpn, res_fc_t::wwpn_ok, and scsi_s::wwpn_ok.

Referenced by get_block_devs(), get_generic_scsi_devs(), and get_scsi_tape().

## get_block_devs()

void get_block_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_cdrom_info(), add_hd_entry(), add_ide_sysfs_info(), add_other_sysfs_info(), add_partitions(), add_scsi_sysfs_info(), add_str_list(), s_hd_t::attached_to, res_io_t::base, s_hd_t::base_class, bc_storage_device, s_hd_t::bus, bus_ide, bus_none, bus_pci, bus_scsi, hd_detail_t::ccw, hd_detail_ccw_t::data, s_hd_t::detail, s_hd_t::drivers, free_mem(), free_str_list(), get_sysfs_attr_by_path(), hd_attr_uint(), hd_data, hd_detail_ccw, hd_probe_feature(), hd_read_sysfs_link(), hd_sysfs_find_driver(), hd_sysfs_id(), hd_sysfs_name2_dev(), hd_id_t::id, s_hd_t::idx, u_hd_res_t::io, ccw_s::lcss, hd_dev_num_t::major, hd_dev_num_t::minor, new_str(), s_hd_t::next, s_str_list_t::next, u_hd_res_t::next, pr_block_part, hd_dev_num_t::range, read_dir(), read_file(), s_hd_t::res, res_io, sc_sdev_cdrom, sc_sdev_disk, sc_sdev_other, search_str_list(), s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sysfs_bus_id, s_hd_t::sysfs_device_link, s_hd_t::sysfs_id, hd_detail_ccw_t::type, hd_dev_num_t::type, res_io_t::type, s_hd_t::unix_dev_name, s_hd_t::unix_dev_name2, and s_hd_t::unix_dev_num.

Referenced by hd_scan_sysfs_block().

## get_cdrom_entry()

cdrom_info_t * get_cdrom_entry | ( | cdrom_info_t * | ci,
|  | int | n )

static

References cdrom_info_s::next.

Referenced by read_cdroms().

## get_generic_scsi_devs()

void get_generic_scsi_devs | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_hd_entry(), add_scsi_sysfs_info(), add_str_list(), s_hd_t::attached_to, s_hd_t::base_class, bc_storage_device, s_hd_t::bus, bus_scsi, s_hd_t::drivers, free_mem(), free_str_list(), get_sysfs_attr_by_path(), hd_attr_uint(), hd_data, hd_read_sysfs_link(), hd_sysfs_find_driver(), hd_sysfs_id(), hd_sysfs_name2_dev(), hd_id_t::id, s_hd_t::idx, hd_dev_num_t::major, hd_dev_num_t::minor, new_str(), s_hd_t::next, s_str_list_t::next, hd_dev_num_t::range, read_dir(), sc_sdev_other, s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sysfs_bus_id, s_hd_t::sysfs_device_link, s_hd_t::sysfs_id, hd_dev_num_t::type, s_hd_t::unix_dev_name, s_hd_t::unix_dev_name2, s_hd_t::unix_dev_num, and s_hd_t::unix_dev_num2.

Referenced by hd_scan_sysfs_scsi().

## get_scsi_tape()

void get_scsi_tape | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_hd_entry(), add_scsi_sysfs_info(), add_str_list(), s_hd_t::attached_to, s_hd_t::base_class, bc_storage_device, s_hd_t::bus, bus_scsi, s_hd_t::drivers, free_mem(), free_str_list(), get_sysfs_attr_by_path(), hd_attr_uint(), hd_data, hd_read_sysfs_link(), hd_sysfs_find_driver(), hd_sysfs_id(), hd_sysfs_name2_dev(), hd_id_t::id, s_hd_t::idx, hd_dev_num_t::major, hd_dev_num_t::minor, s_hd_t::module, new_str(), s_hd_t::next, s_str_list_t::next, hd_dev_num_t::range, read_dir(), sc_sdev_tape, s_str_list_t::str, str_printf(), s_hd_t::sub_class, s_hd_t::sysfs_bus_id, s_hd_t::sysfs_device_link, s_hd_t::sysfs_id, hd_dev_num_t::type, s_hd_t::unix_dev_name, and s_hd_t::unix_dev_num.

Referenced by hd_scan_sysfs_scsi().

## hd_read_cdrom_info()

cdrom_info_t * hd_read_cdrom_info | ( | hd_data_t * | hd_data,
|  | hd_t * | hd )

References ADD2LOG, cdrom_info_s::application, cdrom_info_s::bootable, cdrom_info_s::c, canon_str(), cdrom_info_s::catalog, cdrom_info_s::cdrom, hd_detail_t::cdrom, cdrom_info_s::creation_date, hd_detail_cdrom_t::data, s_hd_t::detail, cdrom_info_s::el_torito, free_hd_detail(), free_mem(), cdrom_info_s::geo, cdrom_info_s::h, hd_data, hd_detail_cdrom, cdrom_info_s::id_string, s_hd_t::is, cdrom_info_s::iso9660, cdrom_info_s::label, cdrom_info_s::load_address, cdrom_info_s::load_count, cdrom_info_s::media_type, cdrom_info_s::name, new_mem(), s_hd_t::is_s::notready, cdrom_info_s::ok, cdrom_info_s::platform, cdrom_info_s::preparer, cdrom_info_s::publisher, cdrom_info_s::s, cdrom_info_s::size, cdrom_info_s::start, hd_detail_t::type, s_hd_t::unix_dev_name, and cdrom_info_s::volume.

Referenced by add_cdrom_info().

## hd_scan_sysfs_block()

void hd_scan_sysfs_block | ( | hd_data_t * | hd_data | ) |

References ADD2LOG, free_str_list(), get_block_devs(), hd_data, hd_probe_feature(), hd_sysfs_driver_list(), load_module(), mod_block, pr_block, pr_block_mods, PROGRESS, read_cdroms(), read_partitions(), and remove_hd_entries().

Referenced by hd_scan_no_hal().

## hd_scan_sysfs_scsi()

void hd_scan_sysfs_scsi | ( | hd_data_t * | hd_data | ) |

References get_generic_scsi_devs(), get_scsi_tape(), hd_data, hd_probe_feature(), load_module(), mod_scsi, pr_scsi, PROGRESS, and remove_hd_entries().

Referenced by hd_scan_no_hal().

## hd_sysfs_find_driver()

char * hd_sysfs_find_driver | ( | hd_data_t * | hd_data,
|  | char * | sysfs_id,
|  | int | exact )

References s_sysfsdrv_t::device, s_sysfsdrv_t::driver, hd_data, and s_sysfsdrv_t::next.

Referenced by add_pci_data(), get_block_devs(), get_generic_scsi_devs(), get_scsi_tape(), get_usb_devs(), hd_add_driver_data(), hd_read_ibmebus(), hd_read_macio(), hd_read_mdio(), hd_read_of_platform(), hd_read_platform(), hd_read_ps3_system_bus(), hd_read_vio(), hd_read_xen(), and pcmcia_read_data().

## new_cdrom_entry()

cdrom_info_t * new_cdrom_entry | ( | cdrom_info_t ** | ci | ) |

static

References new_mem(), and cdrom_info_s::next.

Referenced by read_cdroms().

## read_cdroms()

void read_cdroms | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_str_list(), cdrom_info_s::cdr, cdrom_info_s::cdrw, cdrom_info_s::dvd, cdrom_info_s::dvdr, cdrom_info_s::dvdram, free_str_list(), get_cdrom_entry(), hd_data, HD_DEB_CDROM, line, cdrom_info_s::name, new_cdrom_entry(), new_str(), s_str_list_t::next, PROC_CDROM_INFO, read_file(), cdrom_info_s::speed, and s_str_list_t::str.

Referenced by hd_scan_sysfs_block().

## read_partitions()

void read_partitions | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, add_str_list(), free_mem(), free_str_list(), hd_data, new_str(), s_str_list_t::next, PROC_PARTITIONS, read_file(), search_str_list(), and s_str_list_t::str.

Referenced by hd_scan_sysfs_block().