Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

hd.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <fcntl.h>
#include <signal.h>
#include <ctype.h>
#include <errno.h>
#include <dirent.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <linux/pci.h>
#include <linux/hdreg.h>
#include <linux/fs.h>
#include "hd.h"
#include "hddb.h"
#include "hd_int.h"
#include "memory.h"
#include "isapnp.h"
#include "monitor.h"
#include "pci.h"
#include "cpu.h"
#include "misc.h"
#include "mouse.h"
#include "floppy.h"
#include "ide.h"
#include "scsi.h"
#include "cdrom.h"
#include "bios.h"
#include "serial.h"
#include "net.h"
#include "version.h"
#include "usb.h"
#include "adb.h"
#include "modem.h"
#include "parallel.h"
#include "isa.h"
#include "dac960.h"
#include "smart.h"
#include "isdn.h"
#include "kbd.h"
#include "prom.h"
#include "sbus.h"
#include "int.h"
#include "braille.h"
#include "sys.h"
#include "dasd.h"
#include "i2o.h"
#include "cciss.h"
#include "manual.h"
#include "fb.h"
#include "veth.h"
#include "partition.h"
#include "disk.h"
#include "ataraid.h"
#include "pppoe.h"
#include "pcmcia.h"
#include "s390.h"

Data Structures

struct  disk_s
struct  s_mod_names
struct  s_pr_flags

Defines

#define u64   uint64_t
#define BLKSSZGET   _IO(0x12,104) /* get block device sector size */
#define PCI_DEVICE_ID_ARTOP_ATP860   0x0006
#define PCI_DEVICE_ID_ARTOP_ATP860R   0x0007
#define PCI_DEVICE_ID_CMD_649   0x0649
#define PCI_DEVICE_ID_PROMISE_20267   0x4d30
#define PCI_DEVICE_ID_INTEL_82443MX_1   0x7199
#define PCI_DEVICE_ID_INTEL_82372FB_1   0x7601
#define PCI_DEVICE_ID_INTEL_82820FW_5   0x244b
#define PCI_DEVICE_ID_AMD_VIPER_7409   0x7409
#define PCI_DEVICE_ID_CMD_648   0x0648
#define PCI_DEVICE_ID_TTI_HPT366   0x0004
#define PCI_DEVICE_ID_PROMISE_20262   0x4d38
#define INT_CRC(a, b)   crc64(&a, &hd->b, sizeof hd->b);
#define STR_CRC(a, b)   if(hd->b) crc64(&a, hd->b, strlen(hd->b) + 1);

Typedefs

typedef disk_s disk_t

Functions

s_pr_flagsget_pr_flags (enum probe_feature feature)
void fix_probe_features (hd_data_t *hd_data)
void set_probe_feature (hd_data_t *hd_data, enum probe_feature feature, unsigned val)
void free_old_hd_entries (hd_data_t *hd_data)
hd_tfree_hd_entry (hd_t *hd)
hd_tadd_hd_entry2 (hd_t **hd, hd_t *new_hd)
void timeout_alarm_handler (int signal)
void get_probe_env (hd_data_t *hd_data)
void hd_scan_xtra (hd_data_t *hd_data)
hd_thd_get_device_by_id (hd_data_t *hd_data, char *id)
int has_item (hd_hw_item_t *items, hd_hw_item_t item)
int has_hw_class (hd_t *hd, hd_hw_item_t *items)
void test_read_block0_open (void *arg)
void get_kernel_version (hd_data_t *hd_data)
int is_modem (hd_data_t *hd_data, hd_t *hd)
void assign_hw_class (hd_data_t *hd_data, hd_t *hd)
void short_vendor (char *vendor)
void create_model_name (hd_data_t *hd_data, hd_t *hd)
void sigchld_handler (int)
char * hd_shm_add_str (hd_data_t *hd_data, char *str)
str_list_thd_shm_add_str_list (hd_data_t *hd_data, str_list_t *sl)
void hd_set_probe_feature (hd_data_t *hd_data, enum probe_feature feature)
void hd_clear_probe_feature (hd_data_t *hd_data, enum probe_feature feature)
int hd_probe_feature (hd_data_t *hd_data, enum probe_feature feature)
void hd_set_probe_feature_hw (hd_data_t *hd_data, hd_hw_item_t item)
hd_data_thd_free_hd_data (hd_data_t *hd_data)
 Free all data.

driver_info_tfree_driver_info (driver_info_t *di)
int exists_hd_entry (hd_data_t *hd_data, hd_t *old_hd, hd_t *hd_ex)
hd_thd_free_hd_list (hd_t *hd)
 Free hardware items returned by e.g. hd_list().

hd_detail_tfree_hd_detail (hd_detail_t *d)
misc_tfree_misc (misc_t *m)
scsi_tfree_scsi (scsi_t *scsi, int free_all)
hd_manual_thd_free_manual (hd_manual_t *manual)
void * new_mem (size_t size)
void * resize_mem (void *p, size_t n)
void * add_mem (void *p, size_t elem_size, size_t n)
char * new_str (const char *s)
void * free_mem (void *p)
void join_res_io (hd_res_t **res1, hd_res_t *res2)
void join_res_irq (hd_res_t **res1, hd_res_t *res2)
void join_res_dma (hd_res_t **res1, hd_res_t *res2)
int have_common_res (hd_res_t *res1, hd_res_t *res2)
hd_res_tfree_res_list (hd_res_t *res)
hd_res_tadd_res_entry (hd_res_t **res, hd_res_t *new_res)
hd_smbios_tfree_smbios_list (hd_smbios_t *sm)
hd_smbios_tadd_smbios_entry (hd_smbios_t **sm, hd_smbios_t *new_sm)
hd_tadd_hd_entry (hd_data_t *hd_data, unsigned line, unsigned count)
void hd_scan (hd_data_t *hd_data)
char * isa_id2str (unsigned id)
char * eisa_vendor_str (unsigned v)
unsigned name2eisa_id (char *s)
char * canon_str (char *s, int len)
int hex (char *s, int n)
int str2float (char *s, int n)
char * float2str (int f, int n)
hd_thd_get_device_by_idx (hd_data_t *hd_data, unsigned idx)
char * mod_name_by_idx (unsigned idx)
void str_printf (char **buf, int offset, char *format,...)
void hexdump (char **buf, int with_ascii, unsigned data_len, unsigned char *data)
str_list_tread_file (char *file_name, unsigned start_line, unsigned lines)
str_list_tread_dir (char *dir_name, int type)
char * hd_read_symlink (char *link_name)
void progress (hd_data_t *hd_data, unsigned pos, unsigned count, char *msg)
enum probe_feature hd_probe_feature_by_name (char *name)
char * hd_probe_feature_by_value (enum probe_feature feature)
void remove_hd_entries (hd_data_t *hd_data)
void remove_tagged_hd_entries (hd_data_t *hd_data)
int hd_module_is_active (hd_data_t *hd_data, char *mod)
int hd_has_special_eide (hd_data_t *hd_data)
int hd_has_pcmcia (hd_data_t *hd_data)
int hd_apm_enabled (hd_data_t *hd_data)
int hd_usb_support (hd_data_t *hd_data)
int hd_smp_support (hd_data_t *hd_data)
int hd_color (hd_data_t *hd_data)
int hd_mac_color (hd_data_t *hd_data)
unsigned hd_display_adapter (hd_data_t *hd_data)
enum cpu_arch hd_cpu_arch (hd_data_t *hd_data)
enum boot_arch hd_boot_arch (hd_data_t *hd_data)
void hd_copy (hd_t *dst, hd_t *src)
hd_thd_list (hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old)
hd_thd_list_with_status (hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status)
hd_thd_list2 (hd_data_t *hd_data, hd_hw_item_t *items, int rescan)
hd_thd_list_with_status2 (hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status)
hd_thd_base_class_list (hd_data_t *hd_data, unsigned base_class)
hd_thd_sub_class_list (hd_data_t *hd_data, unsigned base_class, unsigned sub_class)
hd_thd_bus_list (hd_data_t *hd_data, unsigned bus)
int hd_timeout (void(*func)(void *), void *arg, int timeout)
str_list_tread_kmods (hd_data_t *hd_data)
str_list_tget_cmdline (hd_data_t *hd_data, char *key)
char * get_cmd_param (hd_data_t *hd_data, int field)
unsigned get_disk_crc (unsigned char *data, unsigned len)
disk_tadd_disk_entry (disk_t **dl, disk_t *new_dl)
disk_tfree_disk_list (disk_t *dl)
int dev_name_duplicate (disk_t *dl, char *dev_name)
unsigned hd_boot_disk (hd_data_t *hd_data, int *matches)
void update_irq_usage (hd_data_t *hd_data)
int run_cmd (hd_data_t *hd_data, char *cmd)
int probe_module (hd_data_t *hd_data, char *module)
int load_module_with_params (hd_data_t *hd_data, char *module, char *params)
int load_module (hd_data_t *hd_data, char *module)
int unload_module (hd_data_t *hd_data, char *module)
int cmp_hd (hd_t *hd1, hd_t *hd2)
unsigned has_something_attached (hd_data_t *hd_data, hd_t *hd)
void crc64 (uint64_t *id, void *p, int len)
char * numid2str (uint64_t id, int len)
void hd_add_old_id (hd_t *hd)
void hd_add_id (hd_data_t *hd_data, hd_t *hd)
devtree_tfree_devtree (hd_data_t *hd_data)
unsigned char * read_block0 (hd_data_t *hd_data, char *dev, int *timeout)
char * vend_id2str (unsigned vend)
int hd_change_status (const char *id, hd_status_t status, const char *config_string)
void hd_getdisksize (hd_data_t *hd_data, char *dev, int fd, hd_res_t **geo, hd_res_t **size)
str_list_thd_split (char del, char *str)
char * hd_join (char *del, str_list_t *str)
int is_pcmcia_ctrl (hd_data_t *hd_data, hd_t *hd)
void hd_set_hw_class (hd_t *hd, hd_hw_item_t hw_class)
int hd_is_hw_class (hd_t *hd, hd_hw_item_t hw_class)
void hd_fork (hd_data_t *hd_data, int timeout, int total_timeout)
void hd_fork_done (hd_data_t *hd_data)
void hd_shm_init (hd_data_t *hd_data)
void hd_shm_clean (hd_data_t *hd_data)
void hd_shm_done (hd_data_t *hd_data)
void * hd_shm_add (hd_data_t *hd_data, void *ptr, unsigned len)
int hd_is_shm_ptr (hd_data_t *hd_data, void *ptr)
void hd_move_to_shm (hd_data_t *hd_data)

Variables

pid_t child_id
volatile pid_t child
s_mod_names pr_modules []
s_pr_flags pr_flags []

Define Documentation

#define BLKSSZGET   _IO(0x12,104) /* get block device sector size */
 

#define INT_CRC a,
 )     crc64(&a, &hd->b, sizeof hd->b);
 

#define PCI_DEVICE_ID_AMD_VIPER_7409   0x7409
 

#define PCI_DEVICE_ID_ARTOP_ATP860   0x0006
 

#define PCI_DEVICE_ID_ARTOP_ATP860R   0x0007
 

#define PCI_DEVICE_ID_CMD_648   0x0648
 

#define PCI_DEVICE_ID_CMD_649   0x0649
 

#define PCI_DEVICE_ID_INTEL_82372FB_1   0x7601
 

#define PCI_DEVICE_ID_INTEL_82443MX_1   0x7199
 

#define PCI_DEVICE_ID_INTEL_82820FW_5   0x244b
 

#define PCI_DEVICE_ID_PROMISE_20262   0x4d38
 

#define PCI_DEVICE_ID_PROMISE_20267   0x4d30
 

#define PCI_DEVICE_ID_TTI_HPT366   0x0004
 

#define STR_CRC a,
 )     if(hd->b) crc64(&a, hd->b, strlen(hd->b) + 1);
 

#define u64   uint64_t
 


Typedef Documentation

typedef struct disk_s disk_t
 


Function Documentation

disk_t* add_disk_entry disk_t **  dl,
disk_t new_dl
 

hd_t* add_hd_entry hd_data_t hd_data,
unsigned  line,
unsigned  count
 

hd_t * add_hd_entry2 hd_t **  hd,
hd_t new_hd
[static]
 

void* add_mem void *  p,
size_t  elem_size,
size_t  n
 

hd_res_t* add_res_entry hd_res_t **  res,
hd_res_t new_res
 

hd_smbios_t* add_smbios_entry hd_smbios_t **  sm,
hd_smbios_t new_sm
 

void assign_hw_class hd_data_t hd_data,
hd_t hd
[static]
 

char* canon_str char *  s,
int  len
 

int cmp_hd hd_t hd1,
hd_t hd2
 

void crc64 uint64_t *  id,
void *  p,
int  len
 

void create_model_name hd_data_t hd_data,
hd_t hd
[static]
 

int dev_name_duplicate disk_t dl,
char *  dev_name
 

char* eisa_vendor_str unsigned  v  ) 
 

int exists_hd_entry hd_data_t hd_data,
hd_t old_hd,
hd_t hd_ex
 

void fix_probe_features hd_data_t hd_data  )  [static]
 

char* float2str int  f,
int  n
 

devtree_t* free_devtree hd_data_t hd_data  ) 
 

disk_t* free_disk_list disk_t dl  ) 
 

driver_info_t* free_driver_info driver_info_t di  ) 
 

hd_detail_t* free_hd_detail hd_detail_t d  ) 
 

hd_t * free_hd_entry hd_t hd  )  [static]
 

void* free_mem void *  p  ) 
 

misc_t* free_misc misc_t m  ) 
 

void free_old_hd_entries hd_data_t hd_data  )  [static]
 

hd_res_t* free_res_list hd_res_t res  ) 
 

scsi_t* free_scsi scsi_t scsi,
int  free_all
 

hd_smbios_t* free_smbios_list hd_smbios_t sm  ) 
 

char* get_cmd_param hd_data_t hd_data,
int  field
 

str_list_t* get_cmdline hd_data_t hd_data,
char *  key
 

unsigned get_disk_crc unsigned char *  data,
unsigned  len
 

void get_kernel_version hd_data_t hd_data  )  [static]
 

struct s_pr_flags * get_pr_flags enum probe_feature  feature  )  [static]
 

void get_probe_env hd_data_t hd_data  )  [static]
 

int has_hw_class hd_t hd,
hd_hw_item_t items
[static]
 

int has_item hd_hw_item_t items,
hd_hw_item_t  item
[static]
 

unsigned has_something_attached hd_data_t hd_data,
hd_t hd
 

int have_common_res hd_res_t res1,
hd_res_t res2
 

void hd_add_id hd_data_t hd_data,
hd_t hd
 

void hd_add_old_id hd_t hd  ) 
 

int hd_apm_enabled hd_data_t hd_data  ) 
 

hd_t* hd_base_class_list hd_data_t hd_data,
unsigned  base_class
 

enum boot_arch hd_boot_arch hd_data_t hd_data  ) 
 

unsigned hd_boot_disk hd_data_t hd_data,
int *  matches
 

hd_t* hd_bus_list hd_data_t hd_data,
unsigned  bus
 

int hd_change_status const char *  id,
hd_status_t  status,
const char *  config_string
 

void hd_clear_probe_feature hd_data_t hd_data,
enum probe_feature  feature
 

int hd_color hd_data_t hd_data  ) 
 

void hd_copy hd_t dst,
hd_t src
 

enum cpu_arch hd_cpu_arch hd_data_t hd_data  ) 
 

unsigned hd_display_adapter hd_data_t hd_data  ) 
 

void hd_fork hd_data_t hd_data,
int  timeout,
int  total_timeout
 

void hd_fork_done hd_data_t hd_data  ) 
 

hd_data_t* hd_free_hd_data hd_data_t hd_data  ) 
 

Free all data.

hd_t* hd_free_hd_list hd_t hd  ) 
 

Free hardware items returned by e.g. hd_list().

Note:
This may not free it.

hd_manual_t* hd_free_manual hd_manual_t manual  ) 
 

hd_t * hd_get_device_by_id hd_data_t hd_data,
char *  id
[static]
 

hd_t* hd_get_device_by_idx hd_data_t hd_data,
unsigned  idx
 

void hd_getdisksize hd_data_t hd_data,
char *  dev,
int  fd,
hd_res_t **  geo,
hd_res_t **  size
 

int hd_has_pcmcia hd_data_t hd_data  ) 
 

int hd_has_special_eide hd_data_t hd_data  ) 
 

int hd_is_hw_class hd_t hd,
hd_hw_item_t  hw_class
 

int hd_is_shm_ptr hd_data_t hd_data,
void *  ptr
 

char* hd_join char *  del,
str_list_t str
 

hd_t* hd_list hd_data_t hd_data,
hd_hw_item_t  item,
int  rescan,
hd_t hd_old
 

hd_t* hd_list2 hd_data_t hd_data,
hd_hw_item_t items,
int  rescan
 

hd_t* hd_list_with_status hd_data_t hd_data,
hd_hw_item_t  item,
hd_status_t  status
 

hd_t* hd_list_with_status2 hd_data_t hd_data,
hd_hw_item_t items,
hd_status_t  status
 

int hd_mac_color hd_data_t hd_data  ) 
 

int hd_module_is_active hd_data_t hd_data,
char *  mod
 

void hd_move_to_shm hd_data_t hd_data  ) 
 

int hd_probe_feature hd_data_t hd_data,
enum probe_feature  feature
 

enum probe_feature hd_probe_feature_by_name char *  name  ) 
 

char* hd_probe_feature_by_value enum probe_feature  feature  ) 
 

char* hd_read_symlink char *  link_name  ) 
 

void hd_scan hd_data_t hd_data  ) 
 

void hd_scan_xtra hd_data_t hd_data  )  [static]
 

void hd_set_hw_class hd_t hd,
hd_hw_item_t  hw_class
 

void hd_set_probe_feature hd_data_t hd_data,
enum probe_feature  feature
 

void hd_set_probe_feature_hw hd_data_t hd_data,
hd_hw_item_t  item
 

void* hd_shm_add hd_data_t hd_data,
void *  ptr,
unsigned  len
 

char * hd_shm_add_str hd_data_t hd_data,
char *  str
[static]
 

str_list_t * hd_shm_add_str_list hd_data_t hd_data,
str_list_t sl
[static]
 

void hd_shm_clean hd_data_t hd_data  ) 
 

void hd_shm_done hd_data_t hd_data  ) 
 

void hd_shm_init hd_data_t hd_data  ) 
 

int hd_smp_support hd_data_t hd_data  ) 
 

str_list_t* hd_split char  del,
char *  str
 

hd_t* hd_sub_class_list hd_data_t hd_data,
unsigned  base_class,
unsigned  sub_class
 

int hd_timeout void(*  func)(void *),
void *  arg,
int  timeout
 

int hd_usb_support hd_data_t hd_data  ) 
 

int hex char *  s,
int  n
 

void hexdump char **  buf,
int  with_ascii,
unsigned  data_len,
unsigned char *  data
 

int is_modem hd_data_t hd_data,
hd_t hd
[static]
 

int is_pcmcia_ctrl hd_data_t hd_data,
hd_t hd
 

char* isa_id2str unsigned  id  ) 
 

void join_res_dma hd_res_t **  res1,
hd_res_t res2
 

void join_res_io hd_res_t **  res1,
hd_res_t res2
 

void join_res_irq hd_res_t **  res1,
hd_res_t res2
 

int load_module hd_data_t hd_data,
char *  module
 

int load_module_with_params hd_data_t hd_data,
char *  module,
char *  params
 

char* mod_name_by_idx unsigned  idx  ) 
 

unsigned name2eisa_id char *  s  ) 
 

void* new_mem size_t  size  ) 
 

char* new_str const char *  s  ) 
 

char* numid2str uint64_t  id,
int  len
 

int probe_module hd_data_t hd_data,
char *  module
 

void progress hd_data_t hd_data,
unsigned  pos,
unsigned  count,
char *  msg
 

unsigned char* read_block0 hd_data_t hd_data,
char *  dev,
int *  timeout
 

str_list_t* read_dir char *  dir_name,
int  type
 

str_list_t* read_file char *  file_name,
unsigned  start_line,
unsigned  lines
 

str_list_t* read_kmods hd_data_t hd_data  ) 
 

void remove_hd_entries hd_data_t hd_data  ) 
 

void remove_tagged_hd_entries hd_data_t hd_data  ) 
 

void* resize_mem void *  p,
size_t  n
 

int run_cmd hd_data_t hd_data,
char *  cmd
 

void set_probe_feature hd_data_t hd_data,
enum probe_feature  feature,
unsigned  val
[static]
 

void short_vendor char *  vendor  )  [static]
 

void sigchld_handler int   )  [static]
 

int str2float char *  s,
int  n
 

void str_printf char **  buf,
int  offset,
char *  format,
  ...
 

void test_read_block0_open void *  arg  )  [static]
 

void timeout_alarm_handler int  signal  )  [static]
 

int unload_module hd_data_t hd_data,
char *  module
 

void update_irq_usage hd_data_t hd_data  ) 
 

char* vend_id2str unsigned  vend  ) 
 


Variable Documentation

volatile pid_t child [static]
 

pid_t child_id [static]
 

struct s_pr_flags pr_flags[] [static]
 

struct s_mod_names pr_modules[] [static]