hd_int.h
Go to the documentation of this file.00001 #define PROC_CMDLINE "/proc/cmdline"
00002 #define PROC_PCI_DEVICES "/proc/bus/pci/devices"
00003 #define PROC_PCI_BUS "/proc/bus/pci"
00004 #define PROC_CPUINFO "/proc/cpuinfo"
00005 #define PROC_IOPORTS "/proc/ioports"
00006 #define PROC_DMA "/proc/dma"
00007 #define PROC_INTERRUPTS "/proc/interrupts"
00008 #define PROC_NVRAM_22 "/proc/driver/nvram"
00009 #define PROC_NVRAM_24 "/proc/nvram"
00010 #define PROC_IDE "/proc/ide"
00011 #define PROC_SCSI "/proc/scsi"
00012 #define PROC_SCSI_SCSI "/proc/scsi/scsi"
00013 #define PROC_CDROM_INFO "/proc/sys/dev/cdrom/info"
00014 #define PROC_NET_IF_INFO "/proc/net/dev"
00015 #define PROC_MODULES "/proc/modules"
00016 #define PROC_DRIVER_SERIAL "/proc/tty/driver/serial"
00017 #define PROC_DRIVER_MACSERIAL "/proc/tty/driver/macserial"
00018 #define PROC_PARPORT_22 "/proc/parport/"
00019 #define PROC_PARPORT_24 "/proc/sys/dev/parport/parport"
00020 #define PROC_KCORE "/proc/kcore"
00021 #define PROC_USB_DEVICES "/proc/bus/usb/devices"
00022 #define PROC_DAC960 "/proc/rd"
00023 #define PROC_SMART_22 "/proc/array"
00024 #define PROC_SMART_24 "/proc/driver/array"
00025 #define PROC_SMART_24_NEW "/proc/driver/cpqarray"
00026 #define PROC_PROM "/proc/device-tree"
00027 #define PROC_MEMINFO "/proc/meminfo"
00028 #define PROC_DASD "/proc/dasd"
00029 #define PROC_VERSION "/proc/version"
00030 #define PROC_ISAPNP "/proc/isapnp"
00031 #define PROC_ISERIES "/proc/iSeries"
00032 #define PROC_ISERIES_VETH "/proc/iSeries/veth"
00033 #define PROC_PARTITIONS "/proc/partitions"
00034 #define PROC_APM "/proc/apm"
00035
00036 #define DEV_NVRAM "/dev/nvram"
00037 #define DEV_PSAUX "/dev/psaux"
00038 #define DEV_ADBMOUSE "/dev/adbmouse"
00039 #define DEV_MEM "/dev/mem"
00040 #define DEV_DAC960 "/dev/rd"
00041 #define DEV_SMART "/dev/ida"
00042 #define DEV_KBD "/dev/kbd"
00043 #define DEV_CONSOLE "/dev/console"
00044 #define DEV_OPENPROM "/dev/openprom"
00045 #define DEV_SUNMOUSE "/dev/sunmouse"
00046 #define DEV_MICE "/dev/input/mice"
00047 #define DEV_I2O "/dev/i2o"
00048 #define DEV_CCISS "/dev/cciss"
00049 #define DEV_FB "/dev/fb"
00050
00051 #define PROG_INSMOD "/sbin/insmod"
00052 #define PROG_MODPROBE "/sbin/modprobe"
00053 #define PROG_RMMOD "/sbin/rmmod"
00054 #define PROG_CARDCTL "/sbin/cardctl"
00055
00056 #define KLOG_BOOT "/var/log/boot.msg"
00057 #define ISAPNP_CONF "/etc/isapnp.conf"
00058
00059 #define ID_LIST HARDWARE_DIR "/hd.ids"
00060 #define LIB_CMDLINE HARDWARE_DIR "/cmdline"
00061
00062 #define KERNEL_22 0x020200
00063 #define KERNEL_24 0x020400
00064 #define KERNEL_26 0x020600
00065
00066
#if defined(__s390__) || defined(__s390x__) || defined(__alpha__) || defined(LIBHD_TINY)
00067
#define WITH_ISDN 0
00068
#else
00069 #define WITH_ISDN 1
00070
#endif
00071
00072 #define PROGRESS(a, b, c) progress(hd_data, a, b, c)
00073 #define ADD2LOG(a...) str_printf(&hd_data->log, -2, a)
00074
00075
#undef LIBHD_MEMCHECK
00076
00077
#if defined(__i386__) || defined(__PPC__)
00078
00079
00080
00081
00082
00083
#ifdef __i386__
00084
#define CALLED_FROM(f, a) ((void *) ((unsigned *) &a)[-1] - 5)
00085
#endif
00086
00087
#ifdef __PPC__
00088
00089
static inline void *getr1() {
void *p;
asm(
"mr %0,1" :
"=r" (p) :);
return p; }
00090
#define CALLED_FROM(f, a) ((void *) ((unsigned *) (getr1() - ((short *) f)[1]))[1] - 4)
00091
#endif
00092
#else
00093
#undef LIBHD_MEMCHECK
00094
#endif
00095
00096
#ifdef LIBHD_MEMCHECK
00097
FILE *libhd_log;
00098
#endif
00099
00100
00101
00102
00103
00104
00105
#undef NUMERIC_UNIQUE_ID
00106
00107
00108
00109
00110 enum mod_idx {
00111
mod_none,
mod_memory,
mod_pci,
mod_isapnp,
mod_pnpdump,
mod_cdrom,
00112
mod_net,
mod_floppy,
mod_misc,
mod_bios,
mod_cpu,
mod_monitor,
mod_mouse,
00113
mod_ide,
mod_scsi,
mod_serial,
mod_usb,
mod_adb,
mod_modem,
mod_parallel,
00114
mod_isa,
mod_dac960,
mod_smart,
mod_isdn,
mod_kbd,
mod_prom,
mod_sbus,
00115
mod_int,
mod_braille,
mod_xtra,
mod_sys,
mod_dasd,
mod_i2o,
mod_cciss,
00116
mod_manual,
mod_fb,
mod_veth,
mod_partition,
mod_disk,
mod_ataraid,
mod_pppoe,
00117
mod_pcmcia,
mod_s390
00118 };
00119
00120
void *
new_mem(size_t size);
00121
void *
resize_mem(
void *, size_t);
00122
void *
add_mem(
void *, size_t, size_t);
00123
char *
new_str(
const char *);
00124
void *
free_mem(
void *);
00125
int have_common_res(
hd_res_t *res1,
hd_res_t *res2);
00126
void join_res_io(
hd_res_t **res1,
hd_res_t *res2);
00127
void join_res_irq(
hd_res_t **res1,
hd_res_t *res2);
00128
void join_res_dma(
hd_res_t **res1,
hd_res_t *res2);
00129
hd_res_t *
free_res_list(
hd_res_t *res);
00130
hd_res_t *
add_res_entry(
hd_res_t **res,
hd_res_t *new_res);
00131
hd_smbios_t *
free_smbios_list(
hd_smbios_t *sm);
00132
hd_smbios_t *
add_smbios_entry(
hd_smbios_t **sm,
hd_smbios_t *new_sm);
00133
hd_t *
add_hd_entry(
hd_data_t *hd_data,
unsigned line,
unsigned count);
00134
misc_t *
free_misc(
misc_t *m);
00135
scsi_t *
free_scsi(
scsi_t *scsi,
int free_all);
00136
hd_detail_t *
free_hd_detail(
hd_detail_t *d);
00137
devtree_t *
free_devtree(
hd_data_t *hd_data);
00138
void hd_add_id(
hd_data_t *hd_data,
hd_t *hd);
00139
00140
char *
isa_id2str(
unsigned);
00141
char *
eisa_vendor_str(
unsigned);
00142
unsigned name2eisa_id(
char *);
00143
char *
canon_str(
char *,
int);
00144
00145
int hex(
char *string,
int digits);
00146
00147
void str_printf(
char **buf,
int offset,
char *format, ...) __attribute__ ((format (printf, 3, 4)));
00148
void hexdump(
char **buf,
int with_ascii,
unsigned data_len,
unsigned char *data);
00149
str_list_t *search_str_list(
str_list_t *sl,
char *str);
00150
str_list_t *add_str_list(
str_list_t **sl,
char *str);
00151
str_list_t *free_str_list(
str_list_t *list);
00152
str_list_t *read_file(
char *file_name,
unsigned start_line,
unsigned lines);
00153
str_list_t *read_dir(
char *dir_name,
int type);
00154
char *hd_read_symlink(
char *link_name);
00155
void progress(
hd_data_t *hd_data,
unsigned pos,
unsigned count,
char *msg);
00156
00157
void remove_hd_entries(
hd_data_t *hd_data);
00158
void remove_tagged_hd_entries(
hd_data_t *hd_data);
00159
00160
driver_info_t *free_driver_info(
driver_info_t *di);
00161
00162
int str2float(
char *s,
int n);
00163
char *float2str(
int i,
int n);
00164
00165
00166
char *mod_name_by_idx(
unsigned idx);
00167
00168
int hd_timeout(
void(*func)(
void *),
void *arg,
int timeout);
00169
00170
str_list_t *read_kmods(
hd_data_t *hd_data);
00171
char *get_cmd_param(
hd_data_t *hd_data,
int field);
00172
00173 #ifdef __i386__
00174
00175
int detectSMP(
void);
00176 #endif
00177
00178
void update_irq_usage(
hd_data_t *hd_data);
00179
int run_cmd(
hd_data_t *hd_data,
char *cmd);
00180
int load_module_with_params(
hd_data_t *hd_data,
char *module,
char *params);
00181
int load_module(
hd_data_t *hd_data,
char *module);
00182
int unload_module(
hd_data_t *hd_data,
char *module);
00183
int probe_module(
hd_data_t *hd_data,
char *module);
00184
00185
int cmp_hd(
hd_t *hd1,
hd_t *hd2);
00186
unsigned has_something_attached(
hd_data_t *hd_data,
hd_t *hd);
00187
00188
str_list_t *get_cmdline(
hd_data_t *hd_data,
char *key);
00189
00190 #if defined(__i386__) || defined(__x86_64__) || defined(__PPC__)
00191
int detect_smp(
hd_data_t *hd_data);
00192 #endif
00193
00194
unsigned char *read_block0(
hd_data_t *hd_data,
char *dev,
int *timeout);
00195
00196
void hd_copy(
hd_t *dst,
hd_t *src);
00197
00198
00199 #define W_IO (1 << 0)
00200 #define W_DMA (1 << 1)
00201 #define W_IRQ (1 << 2)
00202
00203
void gather_resources(
misc_t *m,
hd_res_t **r,
char *name,
unsigned which);
00204
00205
char *vend_id2str(
unsigned vend);
00206
00207
void hd_getdisksize(
hd_data_t *hd_data,
char *dev,
int fd,
hd_res_t **geo,
hd_res_t **size);
00208
00209
str_list_t *hd_split(
char del,
char *str);
00210
char *hd_join(
char *del,
str_list_t *str);
00211
00212
void hddb_add_info(
hd_data_t *hd_data,
hd_t *hd);
00213
00214
int is_pnpinfo(
ser_device_t *mi,
int ofs);
00215
00216
int is_pcmcia_ctrl(
hd_data_t *hd_data,
hd_t *hd);
00217
00218
void hd_fork(
hd_data_t *hd_data,
int timeout,
int total_timeout);
00219
void hd_fork_done(
hd_data_t *hd_data);
00220
void hd_shm_init(
hd_data_t *hd_data);
00221
void hd_shm_clean(
hd_data_t *hd_data);
00222
void hd_shm_done(
hd_data_t *hd_data);
00223
void *hd_shm_add(
hd_data_t *hd_data,
void *ptr,
unsigned len);
00224
int hd_is_shm_ptr(
hd_data_t *hd_data,
void *ptr);
00225
void hd_move_to_shm(
hd_data_t *hd_data);
00226
00227 #ifdef __cplusplus
00228 }
00229 #endif
00230