public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/9886: [3.3/3.4 regression] ICE in final_scan_insn
@ 2003-02-28 13:26 schwab
  0 siblings, 0 replies; only message in thread
From: schwab @ 2003-02-28 13:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9886
>Category:       optimization
>Synopsis:       [3.3/3.4 regression] ICE in final_scan_insn
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 28 13:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     schwab@suse.de
>Release:        3.3 20030227 (prerelease)
>Organization:
>Environment:
System: Linux sykes 2.4.19 #1 Mon Jan 27 18:35:42 UTC 2003 ia64 unknown unknown GNU/Linux
Architecture: ia64

host: ia64-suse-linux-gnu
build: ia64-suse-linux-gnu
target: ia64-suse-linux-gnu
configured with: /cvs/branch/gcc/configure --host=ia64-suse-linux --enable-threads=posix --prefix=/usr --enable-languages=c --with-slibdir=/lib --with-system-zlib --enable-shared --enable-checking=misc,tree,rtl,rtlflag,gc,gcac
>Description:
With 3.3 the ICE happens in output_216, which corresponds to the cmovdi_internal pattern.  With 3.4 the ICE happens in bundling, at config/ia64/ia64.c:6700.  
>How-To-Repeat:
$ /cvs/test/branch/gcc/gcc/xgcc -B /cvs/test/branch/gcc/gcc/ -O2 -S hdp.i
hdp.c: In function `dump_normal':
hdp.c:793: internal compiler error: in output_216, at insn-output.c:297
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
$ /cvs/test/gcc/gcc/xgcc -B /cvs/test/gcc/gcc/ -O2 -S hdp.i
hdp.c: In function `dump_normal':
hdp.c:793: internal compiler error: in bundling, at config/ia64/ia64.c:6700
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="hdp.i"
Content-Disposition: inline; filename="hdp.i"

# 1 "hdp.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "hdp.c"
# 1 "/usr/include/stdio.h" 1 3 4
# 28 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 291 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 292 "/usr/include/features.h" 2 3 4
# 314 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 315 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/stdio.h" 2 3 4





# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 213 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 3 4
typedef long unsigned int size_t;
# 35 "/usr/include/stdio.h" 2 3 4

# 1 "/usr/include/bits/types.h" 1 3 4
# 28 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/bits/types.h" 2 3 4


# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 32 "/usr/include/bits/types.h" 2 3 4


typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;


typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

typedef signed long int __int64_t;
typedef unsigned long int __uint64_t;
# 57 "/usr/include/bits/types.h" 3 4
__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
# 128 "/usr/include/bits/types.h" 3 4
# 1 "/usr/include/bits/typesizes.h" 1 3 4
# 129 "/usr/include/bits/types.h" 2 3 4


typedef unsigned long long int __dev_t;
typedef unsigned int __uid_t;
typedef unsigned int __gid_t;
typedef unsigned long int __ino_t;
typedef unsigned long long int __ino64_t;
typedef unsigned int __mode_t;
typedef unsigned long int __nlink_t;
typedef long int __off_t;
typedef long long int __off64_t;
typedef int __pid_t;
typedef struct { int __val[2]; } __fsid_t;
typedef long int __clock_t;
typedef unsigned long int __rlim_t;
typedef unsigned long long int __rlim64_t;
typedef unsigned int __id_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;

typedef int __daddr_t;
typedef long int __swblk_t;
typedef int __key_t;


typedef int __clockid_t;


typedef int __timer_t;


typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef long long int __blkcnt64_t;


typedef unsigned long int __fsblkcnt_t;
typedef unsigned long long int __fsblkcnt64_t;


typedef unsigned long int __fsfilcnt_t;
typedef unsigned long long int __fsfilcnt64_t;




typedef long int __ssize_t;
typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;


typedef long int __intptr_t;


typedef unsigned int __socklen_t;
# 37 "/usr/include/stdio.h" 2 3 4









typedef struct _IO_FILE FILE;





# 62 "/usr/include/stdio.h" 3 4
typedef struct _IO_FILE __FILE;
# 72 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 32 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 14 "/usr/include/_G_config.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 325 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 3 4
typedef int wchar_t;
# 354 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 3 4
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3 4
# 24 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4

# 1 "/usr/include/bits/wchar.h" 1 3 4
# 51 "/usr/include/wchar.h" 2 3 4
# 71 "/usr/include/wchar.h" 3 4
typedef struct
{
  int __count;
  union
  {
    wint_t __wch;
    char __wchb[4];
  } __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3 4

typedef struct
{
  __off_t __pos;
  __mbstate_t __state;
} _G_fpos_t;
typedef struct
{
  __off64_t __pos;
  __mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3 4
# 1 "/usr/include/gconv.h" 1 3 4
# 28 "/usr/include/gconv.h" 3 4
# 1 "/usr/include/wchar.h" 1 3 4
# 48 "/usr/include/wchar.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 49 "/usr/include/wchar.h" 2 3 4
# 29 "/usr/include/gconv.h" 2 3 4


# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 32 "/usr/include/gconv.h" 2 3 4





enum
{
  __GCONV_OK = 0,
  __GCONV_NOCONV,
  __GCONV_NODB,
  __GCONV_NOMEM,

  __GCONV_EMPTY_INPUT,
  __GCONV_FULL_OUTPUT,
  __GCONV_ILLEGAL_INPUT,
  __GCONV_INCOMPLETE_INPUT,

  __GCONV_ILLEGAL_DESCRIPTOR,
  __GCONV_INTERNAL_ERROR
};



enum
{
  __GCONV_IS_LAST = 0x0001,
  __GCONV_IGNORE_ERRORS = 0x0002
};



struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;



typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
                            __const unsigned char **, __const unsigned char *,
                            unsigned char **, size_t *, int, int);


typedef wint_t (*__gconv_btowc_fct) (struct __gconv_step *, unsigned char);


typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);



typedef int (*__gconv_trans_fct) (struct __gconv_step *,
                                  struct __gconv_step_data *, void *,
                                  __const unsigned char *,
                                  __const unsigned char **,
                                  __const unsigned char *, unsigned char **,
                                  size_t *);


typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
                                          __const unsigned char *,
                                          unsigned char *, unsigned char *);


typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
                                        size_t *);


typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);

struct __gconv_trans_data
{

  __gconv_trans_fct __trans_fct;
  __gconv_trans_context_fct __trans_context_fct;
  __gconv_trans_end_fct __trans_end_fct;
  void *__data;
  struct __gconv_trans_data *__next;
};



struct __gconv_step
{
  struct __gconv_loaded_object *__shlib_handle;
  __const char *__modname;

  int __counter;

  char *__from_name;
  char *__to_name;

  __gconv_fct __fct;
  __gconv_btowc_fct __btowc_fct;
  __gconv_init_fct __init_fct;
  __gconv_end_fct __end_fct;



  int __min_needed_from;
  int __max_needed_from;
  int __min_needed_to;
  int __max_needed_to;


  int __stateful;

  void *__data;
};



struct __gconv_step_data
{
  unsigned char *__outbuf;
  unsigned char *__outbufend;



  int __flags;



  int __invocation_counter;



  int __internal_use;

  __mbstate_t *__statep;
  __mbstate_t __state;



  struct __gconv_trans_data *__trans;
};



typedef struct __gconv_info
{
  size_t __nsteps;
  struct __gconv_step *__steps;
  __extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3 4
typedef union
{
  struct __gconv_info __cd;
  struct
  {
    struct __gconv_info __cd;
    struct __gconv_step_data __data;
  } __combined;
} _G_iconv_t;

typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3 4
# 53 "/usr/include/libio.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stdarg.h" 1 3 4
# 43 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3 4
# 162 "/usr/include/libio.h" 3 4
struct _IO_jump_t; struct _IO_FILE;
# 172 "/usr/include/libio.h" 3 4
typedef void _IO_lock_t;





struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;



  int _pos;
# 195 "/usr/include/libio.h" 3 4
};


enum __codecvt_result
{
  __codecvt_ok,
  __codecvt_partial,
  __codecvt_error,
  __codecvt_noconv
};
# 263 "/usr/include/libio.h" 3 4
struct _IO_FILE {
  int _flags;




  char* _IO_read_ptr;
  char* _IO_read_end;
  char* _IO_read_base;
  char* _IO_write_base;
  char* _IO_write_ptr;
  char* _IO_write_end;
  char* _IO_buf_base;
  char* _IO_buf_end;

  char *_IO_save_base;
  char *_IO_backup_base;
  char *_IO_save_end;

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;



  int _flags2;

  __off_t _old_offset;



  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];



  _IO_lock_t *_lock;
# 311 "/usr/include/libio.h" 3 4
  __off64_t _offset;





  void *__pad1;
  void *__pad2;

  int _mode;

  char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];

};


typedef struct _IO_FILE _IO_FILE;


struct _IO_FILE_plus;

extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 350 "/usr/include/libio.h" 3 4
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);







typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
                                 size_t __n);







typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);


typedef int __io_close_fn (void *__cookie);
# 402 "/usr/include/libio.h" 3 4
extern int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern wint_t __wunderflow (_IO_FILE *) ;
extern wint_t __wuflow (_IO_FILE *) ;
extern wint_t __woverflow (_IO_FILE *, wint_t) ;
# 432 "/usr/include/libio.h" 3 4
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;

extern int _IO_peekc_locked (_IO_FILE *__fp) ;





extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
# 462 "/usr/include/libio.h" 3 4
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
                        __gnuc_va_list, int *__restrict) ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
                         __gnuc_va_list) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) ;

extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) ;

extern void _IO_free_backup_area (_IO_FILE *) ;
# 73 "/usr/include/stdio.h" 2 3 4
# 86 "/usr/include/stdio.h" 3 4


typedef _G_fpos_t fpos_t;




# 138 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/bits/stdio_lim.h" 1 3 4
# 139 "/usr/include/stdio.h" 2 3 4



extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;







extern int remove (__const char *__filename) ;

extern int rename (__const char *__old, __const char *__new) ;






extern FILE *tmpfile (void) ;
# 171 "/usr/include/stdio.h" 3 4
extern char *tmpnam (char *__s) ;

# 181 "/usr/include/stdio.h" 3 4
extern char *tmpnam_r (char *__s) ;
# 193 "/usr/include/stdio.h" 3 4
extern char *tempnam (__const char *__dir, __const char *__pfx)
     __attribute__ ((__malloc__));





extern int fclose (FILE *__stream) ;

extern int fflush (FILE *__stream) ;




extern int fflush_unlocked (FILE *__stream) ;
# 216 "/usr/include/stdio.h" 3 4



extern FILE *fopen (__const char *__restrict __filename,
                    __const char *__restrict __modes) ;

extern FILE *freopen (__const char *__restrict __filename,
                      __const char *__restrict __modes,
                      FILE *__restrict __stream) ;
# 239 "/usr/include/stdio.h" 3 4

# 250 "/usr/include/stdio.h" 3 4
extern FILE *fdopen (int __fd, __const char *__modes) ;
# 271 "/usr/include/stdio.h" 3 4



extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;



extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) ;





extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
                       size_t __size) ;


extern void setlinebuf (FILE *__stream) ;





extern int fprintf (FILE *__restrict __stream,
                    __const char *__restrict __format, ...) ;

extern int printf (__const char *__restrict __format, ...) ;

extern int sprintf (char *__restrict __s,
                    __const char *__restrict __format, ...) ;


extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;

extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
     ;

extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;





extern int snprintf (char *__restrict __s, size_t __maxlen,
                     __const char *__restrict __format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));

extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                      __const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 3, 0)));

# 349 "/usr/include/stdio.h" 3 4


extern int fscanf (FILE *__restrict __stream,
                   __const char *__restrict __format, ...) ;

extern int scanf (__const char *__restrict __format, ...) ;

extern int sscanf (__const char *__restrict __s,
                   __const char *__restrict __format, ...) ;

# 379 "/usr/include/stdio.h" 3 4


extern int fgetc (FILE *__stream) ;
extern int getc (FILE *__stream) ;


extern int getchar (void) ;








extern int getc_unlocked (FILE *__stream) ;
extern int getchar_unlocked (void) ;




extern int fgetc_unlocked (FILE *__stream) ;





extern int fputc (int __c, FILE *__stream) ;
extern int putc (int __c, FILE *__stream) ;


extern int putchar (int __c) ;








extern int fputc_unlocked (int __c, FILE *__stream) ;




extern int putc_unlocked (int __c, FILE *__stream) ;
extern int putchar_unlocked (int __c) ;





extern int getw (FILE *__stream) ;


extern int putw (int __w, FILE *__stream) ;





extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
     ;



extern char *gets (char *__s) ;

# 475 "/usr/include/stdio.h" 3 4


extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
     ;


extern int puts (__const char *__s) ;



extern int ungetc (int __c, FILE *__stream) ;



extern size_t fread (void *__restrict __ptr, size_t __size,
                     size_t __n, FILE *__restrict __stream) ;

extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
                      size_t __n, FILE *__restrict __s) ;

# 504 "/usr/include/stdio.h" 3 4
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
                              size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
                               size_t __n, FILE *__restrict __stream) ;





extern int fseek (FILE *__stream, long int __off, int __whence) ;

extern long int ftell (FILE *__stream) ;

extern void rewind (FILE *__stream) ;

# 544 "/usr/include/stdio.h" 3 4



extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
     ;

extern int fsetpos (FILE *__stream, __const fpos_t *__pos) ;
# 563 "/usr/include/stdio.h" 3 4

# 573 "/usr/include/stdio.h" 3 4


extern void clearerr (FILE *__stream) ;

extern int feof (FILE *__stream) ;

extern int ferror (FILE *__stream) ;




extern void clearerr_unlocked (FILE *__stream) ;
extern int feof_unlocked (FILE *__stream) ;
extern int ferror_unlocked (FILE *__stream) ;





extern void perror (__const char *__s) ;






# 1 "/usr/include/bits/sys_errlist.h" 1 3 4
# 27 "/usr/include/bits/sys_errlist.h" 3 4
extern int sys_nerr;
extern __const char *__const sys_errlist[];
# 600 "/usr/include/stdio.h" 2 3 4




extern int fileno (FILE *__stream) ;




extern int fileno_unlocked (FILE *__stream) ;






extern FILE *popen (__const char *__command, __const char *__modes) ;


extern int pclose (FILE *__stream) ;





extern char *ctermid (char *__s) ;
# 653 "/usr/include/stdio.h" 3 4
extern void flockfile (FILE *__stream) ;



extern int ftrylockfile (FILE *__stream) ;


extern void funlockfile (FILE *__stream) ;
# 677 "/usr/include/stdio.h" 3 4

# 2 "hdp.c" 2
# 1 "/usr/include/stdlib.h" 1 3 4
# 33 "/usr/include/stdlib.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 34 "/usr/include/stdlib.h" 2 3 4


# 93 "/usr/include/stdlib.h" 3 4


typedef struct
  {
    int quot;
    int rem;
  } div_t;



typedef struct
  {
    long int quot;
    long int rem;
  } ldiv_t;



# 137 "/usr/include/stdlib.h" 3 4
extern size_t __ctype_get_mb_cur_max (void) ;




extern double atof (__const char *__nptr) __attribute__ ((__pure__));

extern int atoi (__const char *__nptr) __attribute__ ((__pure__));

extern long int atol (__const char *__nptr) __attribute__ ((__pure__));





__extension__ extern long long int atoll (__const char *__nptr)
     __attribute__ ((__pure__));





extern double strtod (__const char *__restrict __nptr,
                      char **__restrict __endptr) ;

# 174 "/usr/include/stdlib.h" 3 4


extern long int strtol (__const char *__restrict __nptr,
                        char **__restrict __endptr, int __base) ;

extern unsigned long int strtoul (__const char *__restrict __nptr,
                                  char **__restrict __endptr, int __base)
     ;




__extension__
extern long long int strtoq (__const char *__restrict __nptr,
                             char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
                                       char **__restrict __endptr, int __base)
     ;





__extension__
extern long long int strtoll (__const char *__restrict __nptr,
                              char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
                                        char **__restrict __endptr, int __base)
     ;

# 264 "/usr/include/stdlib.h" 3 4
extern double __strtod_internal (__const char *__restrict __nptr,
                                 char **__restrict __endptr, int __group)
     ;
extern float __strtof_internal (__const char *__restrict __nptr,
                                char **__restrict __endptr, int __group)
     ;
extern long double __strtold_internal (__const char *__restrict __nptr,
                                       char **__restrict __endptr,
                                       int __group) ;

extern long int __strtol_internal (__const char *__restrict __nptr,
                                   char **__restrict __endptr,
                                   int __base, int __group) ;



extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
                                             char **__restrict __endptr,
                                             int __base, int __group) ;




__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
                                         char **__restrict __endptr,
                                         int __base, int __group) ;



__extension__
extern unsigned long long int __strtoull_internal (__const char *
                                                   __restrict __nptr,
                                                   char **__restrict __endptr,
                                                   int __base, int __group)
     ;
# 408 "/usr/include/stdlib.h" 3 4
extern char *l64a (long int __n) ;


extern long int a64l (__const char *__s) __attribute__ ((__pure__));


# 1 "/usr/include/sys/types.h" 1 3 4
# 29 "/usr/include/sys/types.h" 3 4






typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;




typedef __loff_t loff_t;



typedef __ino_t ino_t;
# 62 "/usr/include/sys/types.h" 3 4
typedef __dev_t dev_t;




typedef __gid_t gid_t;




typedef __mode_t mode_t;




typedef __nlink_t nlink_t;




typedef __uid_t uid_t;





typedef __off_t off_t;
# 100 "/usr/include/sys/types.h" 3 4
typedef __pid_t pid_t;




typedef __id_t id_t;




typedef __ssize_t ssize_t;





typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;





typedef __key_t key_t;
# 133 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/time.h" 1 3 4
# 74 "/usr/include/time.h" 3 4


typedef __time_t time_t;



# 92 "/usr/include/time.h" 3 4
typedef __clockid_t clockid_t;
# 104 "/usr/include/time.h" 3 4
typedef __timer_t timer_t;
# 134 "/usr/include/sys/types.h" 2 3 4
# 147 "/usr/include/sys/types.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 148 "/usr/include/sys/types.h" 2 3 4



typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 191 "/usr/include/sys/types.h" 3 4
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));


typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

typedef int register_t __attribute__ ((__mode__ (__word__)));
# 213 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/endian.h" 1 3 4
# 37 "/usr/include/endian.h" 3 4
# 1 "/usr/include/bits/endian.h" 1 3 4
# 38 "/usr/include/endian.h" 2 3 4
# 214 "/usr/include/sys/types.h" 2 3 4


# 1 "/usr/include/sys/select.h" 1 3 4
# 31 "/usr/include/sys/select.h" 3 4
# 1 "/usr/include/bits/select.h" 1 3 4
# 32 "/usr/include/sys/select.h" 2 3 4


# 1 "/usr/include/bits/sigset.h" 1 3 4
# 23 "/usr/include/bits/sigset.h" 3 4
typedef int __sig_atomic_t;




typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
  } __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3 4



typedef __sigset_t sigset_t;





# 1 "/usr/include/time.h" 1 3 4
# 118 "/usr/include/time.h" 3 4
struct timespec
  {
    __time_t tv_sec;
    long int tv_nsec;
  };
# 45 "/usr/include/sys/select.h" 2 3 4

# 1 "/usr/include/bits/time.h" 1 3 4
# 67 "/usr/include/bits/time.h" 3 4
struct timeval
  {
    __time_t tv_sec;
    __suseconds_t tv_usec;
  };
# 47 "/usr/include/sys/select.h" 2 3 4


typedef __suseconds_t suseconds_t;





typedef long int __fd_mask;
# 67 "/usr/include/sys/select.h" 3 4
typedef struct
  {






    __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];


  } fd_set;






typedef __fd_mask fd_mask;
# 99 "/usr/include/sys/select.h" 3 4







extern int select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
                   fd_set *__restrict __exceptfds,
                   struct timeval *__restrict __timeout) ;
# 122 "/usr/include/sys/select.h" 3 4

# 217 "/usr/include/sys/types.h" 2 3 4


# 1 "/usr/include/sys/sysmacros.h" 1 3 4
# 220 "/usr/include/sys/types.h" 2 3 4
# 231 "/usr/include/sys/types.h" 3 4
typedef __blkcnt_t blkcnt_t;



typedef __fsblkcnt_t fsblkcnt_t;



typedef __fsfilcnt_t fsfilcnt_t;
# 266 "/usr/include/sys/types.h" 3 4
# 1 "/usr/include/bits/pthreadtypes.h" 1 3 4
# 23 "/usr/include/bits/pthreadtypes.h" 3 4
# 1 "/usr/include/bits/sched.h" 1 3 4
# 83 "/usr/include/bits/sched.h" 3 4
struct __sched_param
  {
    int __sched_priority;
  };
# 24 "/usr/include/bits/pthreadtypes.h" 2 3 4


struct _pthread_fastlock
{
  long int __status;
  int __spinlock;

};



typedef struct _pthread_descr_struct *_pthread_descr;





typedef struct __pthread_attr_s
{
  int __detachstate;
  int __schedpolicy;
  struct __sched_param __schedparam;
  int __inheritsched;
  int __scope;
  size_t __guardsize;
  int __stackaddr_set;
  void *__stackaddr;
  size_t __stacksize;
} pthread_attr_t;





__extension__ typedef long long __pthread_cond_align_t;




typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
  char __padding[48 - sizeof (struct _pthread_fastlock)
                 - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)];
  __pthread_cond_align_t __align;
} pthread_cond_t;



typedef struct
{
  int __dummy;
} pthread_condattr_t;


typedef unsigned int pthread_key_t;





typedef struct
{
  int __m_reserved;
  int __m_count;
  _pthread_descr __m_owner;
  int __m_kind;
  struct _pthread_fastlock __m_lock;
} pthread_mutex_t;



typedef struct
{
  int __mutexkind;
} pthread_mutexattr_t;



typedef int pthread_once_t;
# 150 "/usr/include/bits/pthreadtypes.h" 3 4
typedef unsigned long int pthread_t;
# 267 "/usr/include/sys/types.h" 2 3 4



# 415 "/usr/include/stdlib.h" 2 3 4






extern long int random (void) ;


extern void srandom (unsigned int __seed) ;





extern char *initstate (unsigned int __seed, char *__statebuf,
                        size_t __statelen) ;



extern char *setstate (char *__statebuf) ;







struct random_data
  {
    int32_t *fptr;
    int32_t *rptr;
    int32_t *state;
    int rand_type;
    int rand_deg;
    int rand_sep;
    int32_t *end_ptr;
  };

extern int random_r (struct random_data *__restrict __buf,
                     int32_t *__restrict __result) ;

extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;

extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
                        size_t __statelen,
                        struct random_data *__restrict __buf) ;

extern int setstate_r (char *__restrict __statebuf,
                       struct random_data *__restrict __buf) ;






extern int rand (void) ;

extern void srand (unsigned int __seed) ;




extern int rand_r (unsigned int *__seed) ;







extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;


extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;


extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;


extern void srand48 (long int __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;





struct drand48_data
  {
    unsigned short int __x[3];
    unsigned short int __old_x[3];
    unsigned short int __c;
    unsigned short int __init;
    unsigned long long int __a;
  };


extern int drand48_r (struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;
extern int erand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;


extern int lrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int mrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
     ;

extern int seed48_r (unsigned short int __seed16v[3],
                     struct drand48_data *__buffer) ;

extern int lcong48_r (unsigned short int __param[7],
                      struct drand48_data *__buffer) ;









extern void *malloc (size_t __size) __attribute__ ((__malloc__));

extern void *calloc (size_t __nmemb, size_t __size)
     __attribute__ ((__malloc__));







extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));

extern void free (void *__ptr) ;




extern void cfree (void *__ptr) ;



# 1 "/usr/include/alloca.h" 1 3 4
# 25 "/usr/include/alloca.h" 3 4
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 26 "/usr/include/alloca.h" 2 3 4







extern void *alloca (size_t __size) ;






# 577 "/usr/include/stdlib.h" 2 3 4




extern void *valloc (size_t __size) __attribute__ ((__malloc__));
# 590 "/usr/include/stdlib.h" 3 4


extern void abort (void) __attribute__ ((__noreturn__));



extern int atexit (void (*__func) (void)) ;





extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
     ;






extern void exit (int __status) __attribute__ ((__noreturn__));

# 622 "/usr/include/stdlib.h" 3 4


extern char *getenv (__const char *__name) ;




extern char *__secure_getenv (__const char *__name) ;





extern int putenv (char *__string) ;





extern int setenv (__const char *__name, __const char *__value, int __replace)
     ;


extern int unsetenv (__const char *__name) ;






extern int clearenv (void) ;
# 661 "/usr/include/stdlib.h" 3 4
extern char *mktemp (char *__template) ;







extern int mkstemp (char *__template) ;
# 688 "/usr/include/stdlib.h" 3 4
extern char *mkdtemp (char *__template) ;





extern int system (__const char *__command) ;

# 712 "/usr/include/stdlib.h" 3 4
extern char *realpath (__const char *__restrict __name,
                       char *__restrict __resolved) ;






typedef int (*__compar_fn_t) (__const void *, __const void *);









extern void *bsearch (__const void *__key, __const void *__base,
                      size_t __nmemb, size_t __size, __compar_fn_t __compar);



extern void qsort (void *__base, size_t __nmemb, size_t __size,
                   __compar_fn_t __compar);



extern int abs (int __x) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));












extern div_t div (int __numer, int __denom)
     __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
     __attribute__ ((__const__));

# 776 "/usr/include/stdlib.h" 3 4
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *gcvt (double __value, int __ndigit, char *__buf) ;




extern char *qecvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qfcvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;




extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;

extern int qecvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;







extern int mblen (__const char *__s, size_t __n) ;


extern int mbtowc (wchar_t *__restrict __pwc,
                   __const char *__restrict __s, size_t __n) ;


extern int wctomb (char *__s, wchar_t __wchar) ;



extern size_t mbstowcs (wchar_t *__restrict __pwcs,
                        __const char *__restrict __s, size_t __n) ;

extern size_t wcstombs (char *__restrict __s,
                        __const wchar_t *__restrict __pwcs, size_t __n)
     ;








extern int rpmatch (__const char *__response) ;
# 908 "/usr/include/stdlib.h" 3 4
extern int getloadavg (double __loadavg[], int __nelem) ;






# 3 "hdp.c" 2
# 1 "/usr/include/string.h" 1 3 4
# 28 "/usr/include/string.h" 3 4





# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stddef.h" 1 3 4
# 34 "/usr/include/string.h" 2 3 4




extern void *memcpy (void *__restrict __dest,
                     __const void *__restrict __src, size_t __n) ;


extern void *memmove (void *__dest, __const void *__src, size_t __n)
     ;






extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
                      int __c, size_t __n)
     ;





extern void *memset (void *__s, int __c, size_t __n) ;


extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
     __attribute__ ((__pure__));


extern void *memchr (__const void *__s, int __c, size_t __n)
      __attribute__ ((__pure__));

# 80 "/usr/include/string.h" 3 4


extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
     ;

extern char *strncpy (char *__restrict __dest,
                      __const char *__restrict __src, size_t __n) ;


extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
     ;

extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
                      size_t __n) ;


extern int strcmp (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));

extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
     __attribute__ ((__pure__));


extern int strcoll (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));

extern size_t strxfrm (char *__restrict __dest,
                       __const char *__restrict __src, size_t __n) ;

# 126 "/usr/include/string.h" 3 4
extern char *strdup (__const char *__s) __attribute__ ((__malloc__));
# 160 "/usr/include/string.h" 3 4


extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));

extern char *strrchr (__const char *__s, int __c) __attribute__ ((__pure__));











extern size_t strcspn (__const char *__s, __const char *__reject)
     __attribute__ ((__pure__));


extern size_t strspn (__const char *__s, __const char *__accept)
     __attribute__ ((__pure__));

extern char *strpbrk (__const char *__s, __const char *__accept)
     __attribute__ ((__pure__));

extern char *strstr (__const char *__haystack, __const char *__needle)
     __attribute__ ((__pure__));



extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
     ;




extern char *__strtok_r (char *__restrict __s,
                         __const char *__restrict __delim,
                         char **__restrict __save_ptr) ;

extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
                       char **__restrict __save_ptr) ;
# 228 "/usr/include/string.h" 3 4


extern size_t strlen (__const char *__s) __attribute__ ((__pure__));

# 241 "/usr/include/string.h" 3 4


extern char *strerror (int __errnum) ;




extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ;




extern void __bzero (void *__s, size_t __n) ;



extern void bcopy (__const void *__src, void *__dest, size_t __n) ;


extern void bzero (void *__s, size_t __n) ;


extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
     __attribute__ ((__pure__));


extern char *index (__const char *__s, int __c) __attribute__ ((__pure__));


extern char *rindex (__const char *__s, int __c) __attribute__ ((__pure__));



extern int ffs (int __i) __attribute__ ((__const__));
# 287 "/usr/include/string.h" 3 4
extern int strcasecmp (__const char *__s1, __const char *__s2)
     __attribute__ ((__pure__));


extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
     __attribute__ ((__pure__));
# 309 "/usr/include/string.h" 3 4
extern char *strsep (char **__restrict __stringp,
                     __const char *__restrict __delim) ;
# 379 "/usr/include/string.h" 3 4

# 4 "hdp.c" 2
# 1 "/usr/include/ctype.h" 1 3 4
# 30 "/usr/include/ctype.h" 3 4

# 48 "/usr/include/ctype.h" 3 4
enum
{
  _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
  _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
  _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
  _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
  _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
  _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
  _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
  _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
  _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
  _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
  _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
  _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
};
# 81 "/usr/include/ctype.h" 3 4
extern __const unsigned short int **__ctype_b_loc (void)
     __attribute__ ((__const));
extern __const __int32_t **__ctype_tolower_loc (void)
     __attribute__ ((__const));
extern __const __int32_t **__ctype_toupper_loc (void)
     __attribute__ ((__const));
# 96 "/usr/include/ctype.h" 3 4






extern int isalnum (int) ;
extern int isalpha (int) ;
extern int iscntrl (int) ;
extern int isdigit (int) ;
extern int islower (int) ;
extern int isgraph (int) ;
extern int isprint (int) ;
extern int ispunct (int) ;
extern int isspace (int) ;
extern int isupper (int) ;
extern int isxdigit (int) ;



extern int tolower (int __c) ;


extern int toupper (int __c) ;


# 142 "/usr/include/ctype.h" 3 4
extern int isascii (int __c) ;



extern int toascii (int __c) ;



extern int _toupper (int) ;
extern int _tolower (int) ;
# 323 "/usr/include/ctype.h" 3 4

# 5 "hdp.c" 2
# 1 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stdarg.h" 1 3 4
# 105 "/usr/lib/gcc-lib/ia64-suse-linux/3.3/include/stdarg.h" 3 4
typedef __gnuc_va_list va_list;
# 6 "hdp.c" 2

# 1 "hd.h" 1
# 47 "hd.h"
# 1 "/usr/include/inttypes.h" 1 3 4
# 28 "/usr/include/inttypes.h" 3 4
# 1 "/usr/include/stdint.h" 1 3 4
# 28 "/usr/include/stdint.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 29 "/usr/include/stdint.h" 2 3 4
# 49 "/usr/include/stdint.h" 3 4
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;



typedef unsigned long int uint64_t;
# 66 "/usr/include/stdint.h" 3 4
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;

typedef long int int_least64_t;






typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;

typedef unsigned long int uint_least64_t;
# 91 "/usr/include/stdint.h" 3 4
typedef signed char int_fast8_t;

typedef long int int_fast16_t;
typedef long int int_fast32_t;
typedef long int int_fast64_t;
# 104 "/usr/include/stdint.h" 3 4
typedef unsigned char uint_fast8_t;

typedef unsigned long int uint_fast16_t;
typedef unsigned long int uint_fast32_t;
typedef unsigned long int uint_fast64_t;
# 120 "/usr/include/stdint.h" 3 4
typedef long int intptr_t;


typedef unsigned long int uintptr_t;
# 135 "/usr/include/stdint.h" 3 4
typedef long int intmax_t;
typedef unsigned long int uintmax_t;
# 29 "/usr/include/inttypes.h" 2 3 4






typedef int __gwchar_t;
# 274 "/usr/include/inttypes.h" 3 4





typedef struct
  {
    long int quot;
    long int rem;
  } imaxdiv_t;
# 298 "/usr/include/inttypes.h" 3 4
extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__const__));


extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
      __attribute__ ((__const__));


extern intmax_t strtoimax (__const char *__restrict __nptr,
                           char **__restrict __endptr, int __base) ;


extern uintmax_t strtoumax (__const char *__restrict __nptr,
                            char ** __restrict __endptr, int __base) ;


extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
                           __gwchar_t **__restrict __endptr, int __base)
     ;


extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
                            __gwchar_t ** __restrict __endptr, int __base)
     ;
# 459 "/usr/include/inttypes.h" 3 4

# 48 "hd.h" 2
# 1 "/usr/include/termios.h" 1 3 4
# 36 "/usr/include/termios.h" 3 4




# 1 "/usr/include/bits/termios.h" 1 3 4
# 24 "/usr/include/bits/termios.h" 3 4
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;


struct termios
  {
    tcflag_t c_iflag;
    tcflag_t c_oflag;
    tcflag_t c_cflag;
    tcflag_t c_lflag;
    cc_t c_line;
    cc_t c_cc[32];
    speed_t c_ispeed;
    speed_t c_ospeed;
  };
# 41 "/usr/include/termios.h" 2 3 4
# 49 "/usr/include/termios.h" 3 4
extern speed_t cfgetospeed (__const struct termios *__termios_p) ;


extern speed_t cfgetispeed (__const struct termios *__termios_p) ;


extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) ;


extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) ;



extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) ;




extern int tcgetattr (int __fd, struct termios *__termios_p) ;



extern int tcsetattr (int __fd, int __optional_actions,
                      __const struct termios *__termios_p) ;




extern void cfmakeraw (struct termios *__termios_p) ;



extern int tcsendbreak (int __fd, int __duration) ;


extern int tcdrain (int __fd) ;



extern int tcflush (int __fd, int __queue_selector) ;



extern int tcflow (int __fd, int __action) ;
# 102 "/usr/include/termios.h" 3 4
# 1 "/usr/include/sys/ttydefaults.h" 1 3 4
# 103 "/usr/include/termios.h" 2 3 4



# 49 "hd.h" 2
# 91 "hd.h"
typedef enum probe_feature {
  pr_memory = 1, pr_pci, pr_pci_range, pr_pci_ext, pr_isapnp, pr_cdrom,
  pr_cdrom_info, pr_net, pr_floppy, pr_misc, pr_misc_serial, pr_misc_par,
  pr_misc_floppy, pr_serial, pr_cpu, pr_bios, pr_monitor, pr_mouse, pr_ide,
  pr_scsi, pr_scsi_geo, pr_scsi_cache, pr_usb, pr_usb_mods, pr_adb,
  pr_modem, pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip,
  pr_isa, pr_isa_isdn, pr_dac960, pr_smart, pr_isdn, pr_kbd, pr_prom,
  pr_sbus, pr_int, pr_braille, pr_braille_alva, pr_braille_fhp,
  pr_braille_ht, pr_ignx11, pr_sys, pr_dasd, pr_i2o, pr_cciss, pr_bios_vbe,
  pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum, pr_manual,
  pr_fb, pr_bios_vbe2, pr_veth, pr_partition, pr_disk, pr_ataraid, pr_pppoe,

  pr_max, pr_lxrc, pr_default, pr_all
} hd_probe_feature_t;
# 113 "hd.h"
typedef enum hw_item {
  hw_sys = 1, hw_cpu, hw_keyboard, hw_braille, hw_mouse, hw_joystick,
  hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv, hw_display,
  hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl, hw_network_ctrl,
  hw_isdn, hw_modem, hw_network, hw_disk, hw_partition, hw_cdrom, hw_floppy,
  hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci, hw_isapnp, hw_bridge,
  hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb, hw_pcmcia, hw_pcmcia_ctrl,
  hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug, hw_hotplug_ctrl, hw_zip, hw_pppoe,
  hw_unknown, hw_all
} hd_hw_item_t;







typedef enum base_classes {

  bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
  bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
  bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,


  bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
  bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
  bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
  bc_framebuffer, bc_dvb, bc_tv
} hd_base_classes_t;


typedef enum sc_monitor {
  sc_mon_other, sc_mon_crt, sc_mon_lcd
} hd_sc_monitor_t;


typedef enum sc_storage {
  sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
  sc_sto_other = 0x80
} hd_sc_storage_t;


typedef enum sc_display {
  sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
} hd_sc_display_t;


typedef enum sc_framebuffer {
  sc_fb_vesa = 1
} hd_sc_framebuffer_t;


typedef enum sc_bridge {
  sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
  sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
  sc_bridge_other = 0x80
} hd_sc_bridge_t;


typedef enum sc_comm {
  sc_com_ser, sc_com_par, sc_com_other = 0x80
} hd_sc_comm_t;


typedef enum sc_system {
  sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
} hd_sc_system_t;


typedef enum sc_input {
  sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
} hd_sc_input_t;


typedef enum sc_serial {
  sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
  sc_ser_smbus, sc_ser_other = 0x80
} hd_sc_serial_t;


typedef enum sc_internal {
  sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
  sc_int_bios, sc_int_prom, sc_int_sys
} hd_sc_internal_t;


typedef enum sc_mouse {
  sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
  sc_mou_other = 0x80
} hd_sc_mouse_t;


typedef enum sc_std {
  sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
  sc_sdev_other = 0x80
} hd_sc_std_t;


typedef enum sc_net_if {
  sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
  sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
  sc_nif_escon, sc_nif_myrinet, sc_nif_other = 0x80, sc_nif_sit
} hd_sc_net_if_t;


typedef enum sc_multimedia {
  sc_multi_video, sc_multi_audio, sc_multi_other
} hd_sc_multimedia_t;


typedef enum sc_keyboard {
  sc_keyboard_kbd, sc_keyboard_console
} hd_sc_keyboard_t;


typedef enum sc_hub {
  sc_hub_other, sc_hub_usb
} hd_sc_hub_t;


typedef enum sc_camera {
  sc_camera_webcam, sc_camera_digital
} hd_sc_camera_t;


typedef enum pif_usb_e {
  pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
  pif_usb_other = 0x80, pif_usb_device = 0xfe
} hd_pif_usb_t;


typedef enum pif_cdrom {
  pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
} hd_pif_cdrom_t ;


typedef enum bus_types {
  bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
  bus_cardbus, bus_other,


  bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
  bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio
} hd_bus_types_t;







typedef struct {



  unsigned invalid:1;
# 278 "hd.h"
  unsigned reconfig:3;






  unsigned configured:3;
# 297 "hd.h"
  unsigned available:3;
# 306 "hd.h"
  unsigned needed:3;







  unsigned available_orig:3;
} hd_status_t;


typedef enum {
  status_no = 1, status_yes, status_unknown, status_new
} hd_status_value_t;




typedef enum {
  hp_none,
  hp_pcmcia,
  hp_cardbus,
  hp_pci,
  hp_usb,
  hp_ieee1394
} hd_hotplug_t;






typedef struct {
  unsigned id;
  char *name;
} hd_id_t;





typedef struct s_str_list_t {
  struct s_str_list_t *next;
  char *str;
} str_list_t;





typedef struct {
  unsigned start, size;
  unsigned char *data;
} memory_range_t;





typedef struct {
  unsigned ok:1;
  unsigned rev;
  unsigned mpfp;
  unsigned mpconfig_ok:1;
  unsigned mpconfig;
  unsigned mpconfig_size;
  unsigned char feature[5];
  char oem_id[9];
  char prod_id[13];
  unsigned cpus, cpus_en;
} smp_info_t;





typedef struct vbe_mode_info_s {
  unsigned number;
  unsigned attributes;
  unsigned width, height;
  unsigned bytes_p_line;
  unsigned pixel_size;
  unsigned fb_start;
  unsigned win_A_start;
  unsigned win_A_attr;
  unsigned win_B_start;
  unsigned win_B_attr;
  unsigned win_size;
  unsigned win_gran;
  unsigned pixel_clock;
} vbe_mode_info_t;


typedef struct {
  unsigned ok:1;
  unsigned version;
  unsigned oem_version;
  unsigned memory;
  unsigned fb_start;
  char *oem_name;
  char *vendor_name;
  char *product_name;
  char *product_revision;
  unsigned modes;
  vbe_mode_info_t *mode;
  unsigned current_mode;
  unsigned char ddc[0x80];
} vbe_info_t;





typedef struct {
    unsigned id;
    unsigned char slot;
    unsigned char bus;
    unsigned char devfn;
    unsigned char misc;
} cpq_ctlorder_t;


typedef struct {
  unsigned ok:1;
  unsigned entry;
  unsigned compaq:1;
  cpq_ctlorder_t cpq_ctrl[32];
} bios32_info_t;





typedef enum {
  sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis,
  sm_processor, sm_memctrl, sm_memmodule, sm_cache,
  sm_connect, sm_slot, sm_onboard, sm_oem,
  sm_config, sm_lang, sm_group, sm_eventlog,
  sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap,
  sm_memdevicemap, sm_mouse, sm_battery, sm_reset,
  sm_secure, sm_power, sm_voltage, sm_cool,
  sm_temperature, sm_current, sm_outofband, sm_bis,
  sm_boot, sm_memerror64, sm_mandev, sm_mandevcomp,
  sm_mdtd, sm_inactive = 126, sm_end = 127
} hd_smbios_type_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
} smbios_any_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *vendor;
  char *version;
  char *date;
  uint64_t features;
  unsigned xfeatures;
} smbios_biosinfo_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *manuf;
  char *product;
  char *version;
  char *serial;
  unsigned wake_up;
} smbios_sysinfo_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *manuf;
  char *product;
  char *version;
  char *serial;
} smbios_boardinfo_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *manuf;
  unsigned ch_type;
} smbios_chassis_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *socket;
  char *manuf;
  char *version;
  unsigned voltage;
  unsigned ext_clock;
  unsigned max_speed;
  unsigned current_speed;
  unsigned status;
  unsigned upgrade;
} smbios_processor_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *descr[8];
  unsigned dtype[8];
} smbios_onboard_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *current;
} smbios_lang_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  unsigned ecc;
  unsigned max_size;
} smbios_memarray_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  char *location;
  char *bank;
  unsigned width;
  unsigned eccbits;
  unsigned size;
  unsigned form;
  unsigned type1;
  unsigned type2;
  unsigned speed;
} smbios_memdevice_t;

typedef struct {
  union u_hd_smbios_t *next;
  hd_smbios_type_t type;
  int data_len;
  unsigned char *data;
  str_list_t *strings;
  int handle;
  unsigned mtype;
  unsigned interface;
  unsigned buttons;
} smbios_mouse_t;

typedef union u_hd_smbios_t {
  union u_hd_smbios_t *next;
  smbios_any_t any;
  smbios_biosinfo_t biosinfo;
  smbios_sysinfo_t sysinfo;
  smbios_boardinfo_t boardinfo;
  smbios_chassis_t chassis;
  smbios_processor_t processor;
  smbios_lang_t lang;
  smbios_memarray_t memarray;
  smbios_memdevice_t memdevice;
  smbios_mouse_t mouse;
  smbios_onboard_t onboard;
} hd_smbios_t;





typedef struct s_pci_t {
  struct s_pci_t *next;
  unsigned data_len;
  unsigned data_ext_len;
  unsigned char data[256];
  char *log;
  unsigned flags,
           cmd,
           hdr_type,
           secondary_bus;
  unsigned bus,
           slot, func;
  unsigned base_class, sub_class, prog_if;
  unsigned dev, vend, sub_dev, sub_vend, rev;
  unsigned irq;
  uint64_t base_addr[6];
  uint64_t base_len[6];
  uint64_t rom_base_addr;
  uint64_t rom_base_len;
} pci_t;




typedef enum pci_flags {
  pci_flag_ok, pci_flag_pm, pci_flag_agp
} hd_pci_flags_t;





typedef struct usb_s {
  struct usb_s *next;
  unsigned hd_idx;
  str_list_t *b, *c, *ci, *d, *e, *i, *p, *s, *t;




  int bus, dev_nr, lev, parent, port, count, conns, used_conns;
  unsigned speed;
  unsigned vendor, device, rev;
  char *manufact, *product, *serial;
  char *driver;
  int d_cls, d_sub, d_prot;
  int i_cls, i_sub, i_prot;
  unsigned country;
} usb_t;




typedef struct {
  int len;
  int type;
  unsigned char *data;
} isapnp_res_t;

typedef struct {
  int csn;
  int log_devs;
  unsigned char *serial;
  unsigned char *card_regs;
  unsigned char (*ldev_regs)[0xd0];
  int res_len;
  unsigned broken:1;
  isapnp_res_t *res;
} isapnp_card_t;

typedef struct {
  int read_port;
  int cards;
  isapnp_card_t *card;
} isapnp_t;

typedef struct {
  isapnp_card_t *card;
  int dev;
  unsigned flags;
  unsigned ref:1;
} isapnp_dev_t;




typedef enum isapnp_flags {
  isapnp_flag_act
} hd_isapnp_flags_t;





typedef struct scsi_s {
  struct scsi_s *next;
  unsigned deleted:1;
  unsigned generic:1;
  unsigned fake:1;
  char *dev_name;
  char *guessed_dev_name;
  int generic_dev;
  unsigned host, channel, id, lun;
  char *vendor, *model, *rev, *type_str, *serial;
  int type;
  unsigned inode_low;
  char *proc_dir, *driver;
  unsigned unique;
  char *info;
  unsigned lgeo_c, lgeo_h, lgeo_s;
  unsigned pgeo_c, pgeo_h, pgeo_s;
  uint64_t size;
  unsigned sec_size;
  unsigned cache;
  str_list_t *host_info;
  char *usb_guid;
  unsigned pci_info;
  unsigned pci_bus;
  unsigned pci_slot;
  unsigned pci_func;
} scsi_t;





typedef struct devtree_s {
  struct devtree_s *next;
  struct devtree_s *parent;
  unsigned idx;
  char *path, *filename;
  unsigned pci:1;
  char *name, *model, *device_type, *compatible;
  int class_code;
  int vendor_id, device_id, subvendor_id, subdevice_id;
  int revision_id, interrupt;
  unsigned char *edid;
} devtree_t;





typedef struct cdrom_info_s {
  struct cdrom_info_s *next;
  char *name;
  unsigned speed;
  unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
  unsigned cdrom:1;
  struct {
    unsigned ok:1;
    char *volume, *publisher, *preparer, *application, *creation_date;
  } iso9660;
  struct {
    unsigned ok:1;
    unsigned platform;
    char *id_string;
    unsigned bootable:1;
    unsigned media_type;
    unsigned load_address;
    unsigned load_count;
    unsigned start;
    unsigned catalog;
    struct {
      unsigned c, h, s;
      unsigned size;
    } geo;
    char *label;
  } el_torito;

} cdrom_info_t;


typedef struct {
  unsigned char block0[512];
} floppy_info_t;




typedef struct {
  unsigned apm_supported:1;
  unsigned apm_enabled:1;
  unsigned apm_ver, apm_subver;
  unsigned apm_bios_flags;

  unsigned vbe_ver;
  unsigned vbe_video_mem;

  unsigned ser_port0, ser_port1, ser_port2, ser_port3;
  unsigned par_port0, par_port1, par_port2;


  unsigned is_pnp_bios:1;
  unsigned pnp_id;
  unsigned lba_support:1;

  unsigned low_mem_size;
  smp_info_t smp;
  vbe_info_t vbe;

  unsigned smbios_ver;

  struct {
    unsigned width;
    unsigned height;
    char *vendor;
    char *name;
  } lcd;

  struct {
    char *vendor;
    char *type;
    unsigned bus;
    unsigned compat_vend;
    unsigned compat_dev;
  } mouse;

  struct {
    unsigned ok:1;
    unsigned scroll_lock:1;
    unsigned num_lock:1;
    unsigned caps_lock:1;
  } led;

  bios32_info_t bios32;

} bios_info_t;





typedef struct {
  unsigned has_color:1;
  unsigned color;
} prom_info_t;





typedef struct {
  char *system_type;
  char *generation;
  char *vendor;
  char *model;
  char *serial;
  char *lang;
} sys_info_t;





typedef struct {
  unsigned manu_year;
  unsigned min_vsync, max_vsync;
  unsigned min_hsync, max_hsync;
  char *vendor;
  char *name;
  char *serial;
} monitor_info_t;


typedef enum cpu_arch {
  arch_unknown = 0,
  arch_intel,
  arch_alpha,
  arch_sparc, arch_sparc64,
  arch_ppc, arch_ppc64,
  arch_68k,
  arch_ia64,
  arch_s390, arch_s390x,
  arch_arm,
  arch_mips,
  arch_x86_64
} hd_cpu_arch_t;


typedef enum boot_arch {
  boot_unknown = 0,
  boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
  boot_mips, boot_grub
} hd_boot_arch_t;


typedef struct {
  enum cpu_arch architecture;
  unsigned family;
  unsigned model;
  unsigned stepping;
  unsigned cache;
  unsigned clock;
  unsigned units;
  char *vend_name;
  char *model_name;
  char *platform;
  str_list_t *features;
} cpu_info_t;





typedef struct {
  unsigned data_len, data_max;
  unsigned *data;
  unsigned names_len, names_max;
  char *names;
} hddb_data_t;

typedef uint32_t hddb_entry_mask_t;

typedef struct hddb_list_s {
  hddb_entry_mask_t key_mask;
  hddb_entry_mask_t value_mask;
  unsigned key;
  unsigned value;
} hddb_list_t;

typedef struct {
  unsigned list_len, list_max;
  hddb_list_t *list;
  unsigned ids_len, ids_max;
  unsigned *ids;
  unsigned strings_len, strings_max;
  char *strings;
} hddb2_data_t;




typedef struct {
  char *module;
  unsigned vendor;
  unsigned device;
  unsigned subvendor;
  unsigned subdevice;
  unsigned pciclass;
  unsigned classmask;
} hddb_pci_t;





typedef enum resource_types {
  res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
  res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
  res_framebuffer
} hd_resource_types_t;





typedef enum size_units {
  size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
  size_unit_kbyte, size_unit_mbyte, size_unit_gbyte
} hd_size_units_t;




typedef enum access_flags {
  acc_unknown, acc_ro, acc_wo, acc_rw
} hd_access_flags_t;

typedef enum yes_no_flag {
  flag_unknown, flag_no, flag_yes
} hd_yes_no_flag_t;





typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
} res_any_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  uint64_t base, range;
  unsigned
    enabled:1,
    access:2,
    prefetch:2;
} res_mem_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  uint64_t range;
} res_phys_mem_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  uint64_t base, range;
  unsigned
    enabled:1,
    access:2;
} res_io_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned base;
  unsigned triggered;
  unsigned enabled:1;
} res_irq_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned base;
  unsigned enabled:1;
} res_dma_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  enum size_units unit;
  unsigned val1, val2;
} res_size_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned speed;
  unsigned bits, stopbits;
  char parity;
  char handshake;
} res_baud_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned size;
} res_cache_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned cyls, heads, sectors;
  unsigned logical:1;
} res_disk_geo_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned width, height;
  unsigned vfreq;
  unsigned interlaced:1;
} res_monitor_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  char *init1;
  char *init2;
} res_init_strings_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  char *option;
} res_pppd_option_t;

typedef struct {
  union u_hd_res_t *next;
  enum resource_types type;
  unsigned width, height;
  unsigned bytes_p_line;
  unsigned colorbits;
  unsigned mode;
} res_framebuffer_t;

typedef union u_hd_res_t {
  union u_hd_res_t *next;
  res_any_t any;
  res_io_t io;
  res_mem_t mem;
  res_phys_mem_t phys_mem;
  res_irq_t irq;
  res_dma_t dma;
  res_size_t size;
  res_cache_t cache;
  res_baud_t baud;
  res_disk_geo_t disk_geo;
  res_monitor_t monitor;
  res_init_strings_t init_strings;
  res_pppd_option_t pppd_option;
  res_framebuffer_t framebuffer;
} hd_res_t;





typedef struct {
  uint64_t addr, size;
  char *dev;
  unsigned tag;
} misc_io_t;

typedef struct {
  unsigned channel;
  char *dev;
  unsigned tag;
} misc_dma_t;

typedef struct {
  unsigned irq, events;
  int devs;
  char **dev;
  unsigned tag;
} misc_irq_t;

typedef struct {
  unsigned io_len, dma_len, irq_len;
  misc_io_t *io;
  misc_dma_t *dma;
  misc_irq_t *irq;
  str_list_t *proc_io, *proc_dma, *proc_irq;
} misc_t;

typedef struct s_serial_t {
  struct s_serial_t *next;
  char *name;
  char *device;
  unsigned line, port, irq, baud;
} serial_t;

typedef struct s_ser_device_t {
  struct s_ser_device_t *next;
  unsigned hd_idx;
  char *dev_name;
  str_list_t *at_resp;
  int fd;
  struct termios tio;
  unsigned max_baud, cur_baud;
  unsigned is_mouse:1;
  unsigned is_modem:1;
  unsigned do_io:1;
  unsigned char buf[0x1000];
  int buf_len;
  int garbage, non_pnp, pnp;
  unsigned char pnp_id[8];
  char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
  unsigned pnp_rev;
  unsigned bits;
} ser_device_t;







typedef struct isdn_parm_s {
  struct isdn_parm_s *next;
  char *name;
  unsigned valid:1;
  unsigned conflict:1;
  uint64_t value;
  unsigned type;
  unsigned flags;
  unsigned def_value;
  int alt_values;
  unsigned *alt_value;
} isdn_parm_t;


typedef enum driver_info_type {
  di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd
} hd_driver_info_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
} driver_info_any_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  unsigned width, height;
  unsigned min_vsync, max_vsync;
  unsigned min_hsync, max_hsync;
  unsigned bandwidth;
} driver_info_display_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  unsigned active:1;
  unsigned modprobe:1;
  str_list_t *names;
  str_list_t *mod_args;
  char *conf;
} driver_info_module_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  char *xf86;
  char *gpm;
  int buttons;
  int wheels;
} driver_info_mouse_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  char *server;
  char *xf86_ver;
  unsigned x3d:1;
  struct {
    unsigned all:5;
    unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
  } colors;
  unsigned dacspeed;
  str_list_t *extensions;
  str_list_t *options;
  str_list_t *raw;
  char *script;
} driver_info_x11_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  int i4l_type, i4l_subtype;
  char *i4l_name;
  isdn_parm_t *params;
} driver_info_isdn_t;


typedef struct {
  union driver_info_u *next;
  enum driver_info_type type;
  str_list_t *hddb0, *hddb1;
  char *XkbRules;
  char *XkbModel;
  char *XkbLayout;
  char *keymap;
} driver_info_kbd_t;




typedef union driver_info_u {
  union driver_info_u *next;
  driver_info_any_t any;
  driver_info_module_t module;
  driver_info_mouse_t mouse;
  driver_info_x11_t x11;
  driver_info_display_t display;
  driver_info_isdn_t isdn;
  driver_info_kbd_t kbd;
} driver_info_t;







typedef enum hd_detail_type {
  hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
  hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
  hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree
} hd_detail_type_t;

typedef struct {
  enum hd_detail_type type;
  pci_t *data;
} hd_detail_pci_t;

typedef struct {
  enum hd_detail_type type;
  usb_t *data;
} hd_detail_usb_t;

typedef struct {
  enum hd_detail_type type;
  isapnp_dev_t *data;
} hd_detail_isapnp_t;

typedef struct {
  enum hd_detail_type type;
  cdrom_info_t *data;
} hd_detail_cdrom_t;

typedef struct {
  enum hd_detail_type type;
  floppy_info_t *data;
} hd_detail_floppy_t;

typedef struct {
  enum hd_detail_type type;
  bios_info_t *data;
} hd_detail_bios_t;

typedef struct {
  enum hd_detail_type type;
  cpu_info_t *data;
} hd_detail_cpu_t;

typedef struct {
  enum hd_detail_type type;
  prom_info_t *data;
} hd_detail_prom_t;

typedef struct {
  enum hd_detail_type type;
  monitor_info_t *data;
} hd_detail_monitor_t;

typedef struct {
  enum hd_detail_type type;
  sys_info_t *data;
} hd_detail_sys_t;

typedef struct {
  enum hd_detail_type type;
  scsi_t *data;
} hd_detail_scsi_t;

typedef struct {
  enum hd_detail_type type;
  devtree_t *data;
} hd_detail_devtree_t;

typedef union {
  enum hd_detail_type type;
  hd_detail_pci_t pci;
  hd_detail_usb_t usb;
  hd_detail_isapnp_t isapnp;
  hd_detail_cdrom_t cdrom;
  hd_detail_floppy_t floppy;
  hd_detail_bios_t bios;
  hd_detail_cpu_t cpu;
  hd_detail_prom_t prom;
  hd_detail_monitor_t monitor;
  hd_detail_sys_t sys;
  hd_detail_scsi_t scsi;
  hd_detail_devtree_t devtree;
} hd_detail_t;



typedef struct hd_manual_s {
  struct hd_manual_s *next;

  char *unique_id;
  char *parent_id;
  unsigned hw_class;
  char *model;

  hd_status_t status;
  char *config_string;




  str_list_t *key;
  str_list_t *value;
} hd_manual_t;







typedef struct s_hd_t {
  struct s_hd_t *next;





  unsigned idx;






  unsigned broken:1;




  hd_id_t bus;





  unsigned slot;




  unsigned func;




  hd_id_t base_class;




  hd_id_t sub_class;




  hd_id_t prog_if;







  hd_id_t vendor;
# 1466 "hd.h"
  hd_id_t device;







  hd_id_t sub_vendor;







  hd_id_t sub_device;






  hd_id_t revision;




  char *serial;





  hd_id_t compat_vendor;





  hd_id_t compat_device;





  hd_hw_item_t hw_class;






  hd_hw_item_t hw_class2;






  hd_hw_item_t hw_class3;







  char *model;






  unsigned attached_to;






  char *unix_dev_name;







  char *rom_id;
# 1568 "hd.h"
  char *unique_id;




  unsigned module;




  unsigned line;




  unsigned count;




  hd_res_t *res;





  hd_detail_t *detail;






  str_list_t *extra_info;






  hd_status_t status;







  char *config_string;





  hd_hotplug_t hotplug;

  struct is_s {
    unsigned agp:1;
    unsigned isapnp:1;
    unsigned cardbus:1;
    unsigned pcmcia:1;
    unsigned notready:1;
    unsigned manual:1;
    unsigned softraiddisk:1;
    unsigned zip:1;
    unsigned cdr:1;
    unsigned cdrw:1;
    unsigned dvd:1;
    unsigned dvdr:1;
    unsigned dvdram:1;
    unsigned pppoe:1;
  } is;

  struct tag_s {
    unsigned remove:1;
    unsigned freeit:1;
    unsigned fixed:1;
    unsigned ser_skip:1;
    unsigned ser_device:2;
  } tag;






  unsigned char *block0;




  char *driver;
# 1668 "hd.h"
  char *old_unique_id;






  char *parent_id;





  char *unique_id1;







  char *usb_guid;

  driver_info_t *driver_info;

  str_list_t *requires;





  unsigned ref_cnt;
  struct s_hd_t *ref;
} hd_t;





typedef struct {





  hd_t *hd;
# 1723 "hd.h"
  void (*progress)(char *pos, char *msg);




  char *log;






  unsigned debug;






  struct flag_struct {
    unsigned internal:1;
    unsigned dformat:2;
    unsigned no_parport:1;
    unsigned iseries:1;
    unsigned list_all:1;
    unsigned fast:1;
    unsigned list_md:1;
  } flags;






  unsigned char probe[(pr_all + 7) / 8];
  unsigned char probe_set[(pr_all + 7) / 8];
  unsigned char probe_clr[(pr_all + 7) / 8];
  unsigned last_idx;
  unsigned module;
  enum boot_arch boot;
  hd_t *old_hd;
  pci_t *pci;
  isapnp_t *isapnp;
  cdrom_info_t *cdrom;
  str_list_t *net;
  str_list_t *floppy;
  misc_t *misc;
  serial_t *serial;
  scsi_t *scsi;
  ser_device_t *ser_mouse;
  ser_device_t *ser_modem;
  str_list_t *cpu;
  str_list_t *klog;
  str_list_t *proc_usb;
  usb_t *usb;
  hddb_pci_t *hddb_pci;
  hddb2_data_t *hddb2[2];
  str_list_t *kmods;
  uint64_t used_irqs;
  uint64_t assigned_irqs;
  memory_range_t bios_rom;
  memory_range_t bios_ram;
  memory_range_t bios_ebda;
  unsigned display;
  unsigned color_code;
  char *cmd_line;
  str_list_t *xtra_hd;
  devtree_t *devtree;
  unsigned kernel_version;
  int in_vmware;
  hd_manual_t *manual;
  str_list_t *disks;
  str_list_t *partitions;
  hd_smbios_t *smbios;
} hd_data_t;
# 1810 "hd.h"
void hd_scan(hd_data_t *hd_data);


hd_data_t *hd_free_hd_data(hd_data_t *hd_data);


hd_t *hd_free_hd_list(hd_t *hd);

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);

enum probe_feature hd_probe_feature_by_name(char *name);
char *hd_probe_feature_by_value(enum probe_feature feature);

int hd_module_is_active(hd_data_t *hd_data, char *mod);

hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);

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_mac_color(hd_data_t *hd_data);
int hd_color(hd_data_t *hd_data);
unsigned hd_display_adapter(hd_data_t *hd_data);
unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
enum boot_arch hd_boot_arch(hd_data_t *hd_data);

hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);



str_list_t *get_hddb_packages(hd_data_t *hd_data);

void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
void hddb_dump(hddb2_data_t *hddb, FILE *f);



void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);




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


hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
hd_manual_t *hd_free_manual(hd_manual_t *manual);
hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
int hd_write_config(hd_data_t *hd_data, hd_t *hd);
char *hd_hw_item_name(hd_hw_item_t item);
char *hd_status_value_name(hd_status_value_t status);
int hd_change_status(const char *id, hd_status_t status, const char *config_string);
# 1948 "hd.h"
typedef struct {
        int handle;
        const char *name;
        int Class;
        int vendor;
        int device;
        int subvendor;

        int subdevice;

        unsigned int features;
        int line_cnt;
        int driver;
        int paracnt;
        int para;
} ihw_card_info;

typedef struct {
        int handle;
        int next_drv;
        int drvid;
        int typ;
        int subtyp;
        const char *mod_name;
        const char *para_str;
        const char *mod_preload;
        const char *cfg_prog;
        const char *firmware;
        const char *description;
        const char *need_pkg;
        unsigned int arch;
        unsigned int features;
        int card_ref;
        const char *name;
} ihw_driver_info;


typedef struct {
        const char *name;
        unsigned int type;
        unsigned int flags;

        unsigned long def_value;
        unsigned long bytecnt;
        const unsigned long *list;


} ihw_para_info;




extern ihw_card_info *hd_ihw_get_card(int handle);




extern ihw_card_info *hd_ihw_get_card_from_type(int typ, int subtyp);





extern ihw_card_info *hd_ihw_get_card_from_id(int vendor, int device,
                                        int subvendor, int subdevice);





extern ihw_para_info *hd_ihw_get_parameter(int card_handle, int pnr);




extern ihw_driver_info *hd_ihw_get_driver(int handle);




extern ihw_driver_info *hd_ihw_get_driver_from_type(int typ, int subtyp);


extern int hd_ihw_get_version(void);


extern int hd_ihw_get_db_version(void);


extern char *hd_ihw_get_db_date(void);
# 8 "hdp.c" 2
# 1 "hd_int.h" 1
# 107 "hd_int.h"
enum mod_idx {
  mod_none, mod_memory, mod_pci, mod_isapnp, mod_pnpdump, mod_cdrom,
  mod_net, mod_floppy, mod_misc, mod_bios, mod_cpu, mod_monitor, mod_mouse,
  mod_ide, mod_scsi, mod_serial, mod_usb, mod_adb, mod_modem, mod_parallel,
  mod_isa, mod_dac960, mod_smart, mod_isdn, mod_kbd, mod_prom, mod_sbus,
  mod_int, mod_braille, mod_xtra, mod_sys, mod_dasd, mod_i2o, mod_cciss,
  mod_manual, mod_fb, mod_veth, mod_partition, mod_disk, mod_ataraid, mod_pppoe
};

void *new_mem(size_t size);
void *resize_mem(void *, size_t);
void *add_mem(void *, size_t, size_t);
char *new_str(const char *);
void *free_mem(void *);
int have_common_res(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);
void join_res_dma(hd_res_t **res1, hd_res_t *res2);
hd_res_t *free_res_list(hd_res_t *res);
hd_res_t *add_res_entry(hd_res_t **res, hd_res_t *new_res);
hd_smbios_t *free_smbios_list(hd_smbios_t *sm);
hd_smbios_t *add_smbios_entry(hd_smbios_t **sm, hd_smbios_t *new_sm);
hd_t *add_hd_entry(hd_data_t *hd_data, unsigned line, unsigned count);
misc_t *free_misc(misc_t *m);
scsi_t *free_scsi(scsi_t *scsi, int free_all);
hd_detail_t *free_hd_detail(hd_detail_t *d);
devtree_t *free_devtree(hd_data_t *hd_data);
void hd_add_id(hd_data_t *hd_data, hd_t *hd);

char *isa_id2str(unsigned);
char *eisa_vendor_str(unsigned);
unsigned name2eisa_id(char *);
char *canon_str(char *, int);

int hex(char *string, int digits);

void str_printf(char **buf, int offset, char *format, ...) __attribute__ ((format (printf, 3, 4)));
void hexdump(char **buf, int with_ascii, unsigned data_len, unsigned char *data);
str_list_t *search_str_list(str_list_t *sl, char *str);
str_list_t *add_str_list(str_list_t **sl, char *str);
str_list_t *free_str_list(str_list_t *list);
str_list_t *read_file(char *file_name, unsigned start_line, unsigned lines);
str_list_t *read_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);

void remove_hd_entries(hd_data_t *hd_data);
void remove_tagged_hd_entries(hd_data_t *hd_data);

driver_info_t *free_driver_info(driver_info_t *di);

int str2float(char *s, int n);
char *float2str(int i, int n);


char *mod_name_by_idx(unsigned idx);

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

str_list_t *read_kmods(hd_data_t *hd_data);
char *get_cmd_param(hd_data_t *hd_data, int field);






void update_irq_usage(hd_data_t *hd_data);
int run_cmd(hd_data_t *hd_data, char *cmd);
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 probe_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);

char *get_cmdline(hd_data_t *hd_data, char *key);





unsigned char *read_block0(hd_data_t *hd_data, char *dev, int *timeout);

void hd_copy(hd_t *dst, hd_t *src);






void gather_resources(misc_t *m, hd_res_t **r, char *name, unsigned which);

char *vend_id2str(unsigned vend);

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

str_list_t *hd_split(char del, char *str);
char *hd_join(char del, str_list_t *str);

void hddb_add_info(hd_data_t *hd_data, hd_t *hd);

int is_pnpinfo(ser_device_t *mi, int ofs);
# 9 "hdp.c" 2
# 1 "hdp.h" 1
# 10 "hdp.c" 2
# 1 "hddb.h" 1
void hddb_init(hd_data_t *hd_data);

unsigned device_class(hd_data_t *hd_data, unsigned vendor, unsigned device);
unsigned sub_device_class(hd_data_t *hd_data, unsigned vendor, unsigned device, unsigned sub_vendor, unsigned sub_device);

char *hid_tag_name(int tag);
char *hid_tag_name2(int tag);
# 11 "hdp.c" 2
# 26 "hdp.c"
static int ind = 0;

static void dump_normal(hd_data_t *, hd_t *, FILE *);
static void dump_cpu(hd_data_t *, hd_t *, FILE *);
static void dump_bios(hd_data_t *, hd_t *, FILE *);
static void dump_smbios(hd_data_t *hd_data, FILE *f);
static void dump_prom(hd_data_t *, hd_t *, FILE *);
static void dump_sys(hd_data_t *, hd_t *, FILE *);

static char *dump_hid(hd_data_t *hd_data, hd_id_t *hid, int format, char *buf, int buf_size);
static char *dump_hid2(hd_data_t *hd_data, hd_id_t *hid1, hd_id_t *hid2, char *buf, int buf_size);




void hd_dump_entry(hd_data_t *hd_data, hd_t *h, FILE *f)
{
  char *s, *a0, *a1, *a2, *s1, *s2;
  char buf1[32], buf2[32];
  hd_t *hd_tmp;
  int i;
  str_list_t *sl;
# 56 "hdp.c"
  if(!h) return;

  s = "";
  if(h->is.agp) s = "(AGP)";

  if(h->is.isapnp) s = "(PnP)";

  a0 = h->bus.name;
  a2 = ((void *)0);
  a1 = h->sub_class.name ?: h->base_class.name;
  if(a1 && h->prog_if.name) {
    str_printf(&a2, 0, "%s (%s)", a1, h->prog_if.name);
  }
  else {
    a2 = new_str(a1 ?: "?");
  }
  fprintf(f, "%*s" "%02d: %s%s %02x.%x: %02x%02x %s\n", ind, "", h->idx, a0 ? a0 : "?", s, h->slot, h->func, h->base_class.id, h->sub_class.id, a2);





  ind += 2;

  if((hd_data->debug & (1 << 2))) {
    s = mod_name_by_idx(h->module);
    if(!s) sprintf(s = buf1, "%u", h->module);
    if(h->count)
      sprintf(buf2, ".%u", h->count);
    else
      *buf2 = 0;
    fprintf(f, "%*s" "[Created at %s.%u%s]\n", ind, "", s, h->line, buf2);
  }

  if(hd_data->flags.dformat == 1) {
    fprintf(f, "%*s" "ClassName: \"%s\"\n", ind, "", a2);
    fprintf(f, "%*s" "Bus: %d\n", ind, "", h->slot >> 8);
    fprintf(f, "%*s" "Slot: %d\n", ind, "", h->slot & 0xff);
    fprintf(f, "%*s" "Function: %d\n", ind, "", h->func);
  }

  a2 = free_mem(a2);

  if((hd_data->debug & (1 << 2)) && h->unique_id) {
    fprintf(f, "%*s" "Unique ID: %s\n", ind, "", h->unique_id);
  }

  if((hd_data->debug == -1u) && h->old_unique_id) {
    fprintf(f, "%*s" "Old Unique ID: %s\n", ind, "", h->old_unique_id);
  }

  if(h->hw_class && (s = hd_hw_item_name(h->hw_class))) {
    fprintf(f, "%*s" "Hardware Class: %s\n", ind, "", s);
  }

  if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_cpu)
    dump_cpu(hd_data, h, f);
  else if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_bios)
    dump_bios(hd_data, h, f);
  else if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_prom)
    dump_prom(hd_data, h, f);
  else if(h->base_class.id == bc_internal && h->sub_class.id == sc_int_sys)
    dump_sys(hd_data, h, f);
  else
    dump_normal(hd_data, h, f);

  s1 = s2 = ((void *)0);
  if(h->is.notready) {
    if(h->base_class.id == bc_storage_device) {
      s1 = "no medium";
    }
    else {
      s1 = "not configured";
    }
  }
  if(h->is.softraiddisk) s2 = "soft raid";
  if(!s1) { s1 = s2; s2 = ((void *)0); }

  if(s1) {
    fprintf(f, "%*s" "Drive status: %s%s%s\n", ind, "", s1, s2 ? ", " : "", s2 ?: "");
  }

  if(h->extra_info) {
    fprintf(f, "%*s%s", ind, "", "Extra Info: ");
    for(i = 0, sl = h->extra_info; sl; sl = sl->next) {
      fprintf(f, "%s%s", i ? ", " : "", sl->str);
      i = 1;
    }
    fprintf(f, "\n");
  }

  if(
    hd_data->debug && (
      h->status.configured ||
      h->status.available ||
      h->status.needed ||
      h->status.invalid ||
      h->is.manual
    )
  ) {
    fprintf(f, "%*s%s", ind, "", "Config Status: ");
    i = 0;

    if(h->status.invalid) {
      fprintf(f, "invalid");
      i++;
    }

    if(h->is.manual) {
      fprintf(f, "%smanual", i ? ", " : "");
      i++;
    }

    if(h->status.configured && (s = hd_status_value_name(h->status.configured))) {
      fprintf(f, "%scfg=%s", i ? ", " : "", s);
      i++;
    }

    if(h->status.available && (s = hd_status_value_name(h->status.available))) {
      fprintf(f, "%savail=%s", i ? ", " : "", s);
      i++;
    }

    if(h->status.needed && (s = hd_status_value_name(h->status.needed))) {
      fprintf(f, "%sneed=%s", i ? ", " : "", s);
      i++;
    }

    fprintf(f, "\n");
  }

  if(hd_data->debug == -1u && h->config_string) {
    fprintf(f, "%*s" "Configured as: \"%s\"\n", ind, "", h->config_string);
  }

  if(
    h->attached_to &&
    (hd_tmp = hd_get_device_by_idx(hd_data, h->attached_to))
  ) {
    s = hd_tmp->sub_class.name ?: hd_tmp->base_class.name;
    fprintf(f, "%*s" "Attached to: #%u (%s)\n", ind, "", h->attached_to, s ?: "?");
  }

  if(
    h->base_class.id == bc_storage_device &&
    h->sub_class.id == sc_sdev_cdrom &&
    h->detail &&
    h->detail->type == hd_detail_cdrom
  ) {
    cdrom_info_t *ci = h->detail->cdrom.data;

    if(ci->speed) {
      fprintf(f, "%*s" "Drive Speed: %u\n", ind, "", ci->speed);
    }

    if(ci->iso9660.ok) {
      if(ci->iso9660.volume) fprintf(f, "%*s" "Volume ID: \"%s\"\n", ind, "", ci->iso9660.volume);
      if(ci->iso9660.application) fprintf(f, "%*s" "Application: \"%s\"\n", ind, "", ci->iso9660.application);
      if(ci->iso9660.publisher) fprintf(f, "%*s" "Publisher: \"%s\"\n", ind, "", ci->iso9660.publisher);
      if(ci->iso9660.preparer) fprintf(f, "%*s" "Preparer: \"%s\"\n", ind, "", ci->iso9660.preparer);
      if(ci->iso9660.creation_date) fprintf(f, "%*s" "Creation date: \"%s\"\n", ind, "", ci->iso9660.creation_date);
    }
# 228 "hdp.c"
    if(ci->el_torito.ok) {
      fprintf(f, "%*s" "El Torito info: platform %u, %sbootable\n", ind, "", ci->el_torito.platform, ci->el_torito.bootable ? "" : "not ");




      fprintf(f, "%*s" "  Boot Catalog: at sector 0x%04x\n", ind, "", ci->el_torito.catalog);
      if(ci->el_torito.id_string) fprintf(f, "%*s" "  Id String: \"%s\"\n", ind, "", ci->el_torito.id_string);
      if(ci->el_torito.label) fprintf(f, "%*s" "  Volume Label: \"%s\"\n", ind, "", ci->el_torito.label);
      {
        static char *media[] = {
          "none", "1.2MB Floppy", "1.44MB Floppy", "2.88MB Floppy", "Hard Disk"
        };
        fprintf(f, "%*s" "  Media: %s starting at sector 0x%04x\n", ind, "", media[ci->el_torito.media_type < sizeof media / sizeof *media ? ci->el_torito.media_type : 0], ci->el_torito.start);




      }
      if(ci->el_torito.geo.size) fprintf(f, "%*s" "  Geometry (CHS): %u/%u/%u (%u blocks)\n", ind, "", ci->el_torito.geo.c, ci->el_torito.geo.h, ci->el_torito.geo.s, ci->el_torito.geo.size);



      fprintf(f, "%*s" "  Load: %u bytes", ind, "", ci->el_torito.load_count * 0x200);
      if(ci->el_torito.load_address) {
        fprintf(f, " at 0x%04x\n", ci->el_torito.load_address);
      }
      else {
        fprintf(f, "\n");
      }
    }
  }
# 279 "hdp.c"
  ind -= 2;

  if(h->next) fprintf(f, "%*s%s", ind, "", "\n");
}





void dump_normal(hd_data_t *hd_data, hd_t *h, FILE *f)
{
  int i, j;
  char *s;
  uint64_t u64;
  hd_res_t *res;
  char buf[256], c0, c1;
  driver_info_t *di;
  str_list_t *sl, *sl1, *sl2;
  isdn_parm_t *ip;

  if(h->model) fprintf(f, "%*s" "Model: \"%s\"\n", ind, "", h->model);

  s = ((void *)0);
  switch(h->hotplug) {
    case hp_none:
      break;
    case hp_pcmcia:
      s = "PCMCIA";
      break;
    case hp_cardbus:
      s = "CardBus";
      break;
    case hp_pci:
      s = "PCI";
      break;
    case hp_usb:
      s = "USB";
      break;
    case hp_ieee1394:
      s = "IEEE1394 (FireWire)";
      break;
  }

  if(s) {
    fprintf(f, "%*s" "Hotplug: %s\n", ind, "", s);
  }

  if(h->vendor.id || h->vendor.name || h->device.id || h->device.name) {
    if(h->vendor.id || h->vendor.name) {
      fprintf(f, "%*s" "Vendor: %s\n", ind, "", dump_hid(hd_data, &h->vendor, 1, buf, sizeof buf));
    }
    fprintf(f, "%*s" "Device: %s\n", ind, "", dump_hid(hd_data, &h->device, 0, buf, sizeof buf));
  }

  if(h->sub_vendor.id || h->sub_device.id || h->sub_device.name || h->sub_vendor.name) {
    if(h->sub_vendor.id || h->sub_vendor.name || h->sub_device.id) {
      fprintf(f, "%*s" "SubVendor: %s\n", ind, "", dump_hid(hd_data, &h->sub_vendor, 1, buf, sizeof buf));
    }
    fprintf(f, "%*s" "SubDevice: %s\n", ind, "", dump_hid(hd_data, &h->sub_device, 0, buf, sizeof buf));
  }

  if(h->revision.name) {
    fprintf(f, "%*s" "Revision: \"%s\"\n", ind, "", h->revision.name);
  }
  else if(h->revision.id) {
    fprintf(f, "%*s" "Revision: 0x%02x\n", ind, "", h->revision.id);
  }

  if(h->serial) {
    fprintf(f, "%*s" "Serial ID: \"%s\"\n", ind, "", h->serial);
  }

  if(h->usb_guid) {
    fprintf(f, "%*s" "USB GUID: %s\n", ind, "", h->usb_guid);
  }

  if(h->compat_vendor.id || h->compat_device.id) {
    fprintf(f, "%*s" "Comaptible to: %s\n", ind, "", dump_hid2(hd_data, &h->compat_vendor, &h->compat_device, buf, sizeof buf));



  }

  if(h->driver) {
    fprintf(f, "%*s" "Driver: \"%s\"\n", ind, "", h->driver);
  }

  if(
    h->bus.id == bus_usb &&
    h->detail &&
    h->detail->type == hd_detail_usb
  ) {
    usb_t *usb = h->detail->usb.data;

    if(usb && usb->driver)
      fprintf(f, "%*s" "USB Device status: driver active (\"%s\")\n", ind, "", usb->driver);
    else
      fprintf(f, "%*s%s", ind, "", "USB Device status: no driver loaded\n");
  }

  if(h->broken) {
    fprintf(f, "%*s%s", ind, "", "Warning: might be broken\n");
  }

  if(h->unix_dev_name) {
    fprintf(f, "%*s" "Device File: %s\n", ind, "", h->unix_dev_name);
  }

  if(h->rom_id) {
# 397 "hdp.c"
  }

  if(h->tag.ser_skip) {
    fprintf(f, "%*s%s", ind, "", "Tags: ser_skip\n");
  }

  if(h->is.cdr || h->is.cdrw || h->is.dvd || h->is.dvdr || h->is.dvdram | h->is.pppoe) {
    fprintf(f, "%*s%s", ind, "", "Features:");
    i = 0;
    if(h->is.cdr) fprintf(f, "%s CD-R", i++ ? "," : "");
    if(h->is.cdrw) fprintf(f, "%s CD-RW", i++ ? "," : "");
    if(h->is.dvd) fprintf(f, "%s DVD", i++ ? "," : "");
    if(h->is.dvdr) fprintf(f, "%s DVD-R", i++ ? "," : "");
    if(h->is.dvdram) fprintf(f, "%s DVDRAM", i++ ? "," : "");
    if(h->is.pppoe) fprintf(f, "%s PPPOE", i++ ? "," : "");
    fprintf(f, "\n");
  }

  for(res = h->res; res; res = res->next) {
    switch(res->any.type) {
      case res_phys_mem:
        u64 = res->phys_mem.range >> 10;
        c0 = 'M'; c1 = 'k';
        if(u64 >> 20) {
          u64 >>= 10;
          c0 = 'G'; c1 = 'M';
        }
        if((u64 & 0x3ff)) {
          fprintf(f, "%*s" "Memory Size: %""l" "d"" %cB + %""l" "d"" %cB\n", ind, "", u64 >> 10, c0, u64 & 0x3ff, c1);
        }
        else {
          fprintf(f, "%*s" "Memory Size: %""l" "d"" %cB\n", ind, "", u64 >> 10, c0);
        }
        break;

      case res_mem:
        *(s = buf) = 0;
        strcat(buf, res->mem.access == acc_rw ? "rw" : res->mem.access == acc_ro ? "ro" : "wo");
        strcat(buf, res->mem.prefetch == flag_yes ? ",prefetchable" : res->mem.prefetch == flag_no ? ",non-prefetchable" : "");
        if(!res->mem.enabled) strcat(buf, ",disabled");
        if(*s == ',') s++;
        if(res->mem.range) {
          fprintf(f, "%*s" "Memory Range: 0x%08""l" "x""-0x%08""l" "x"" (%s)\n", ind, "", res->mem.base, res->mem.base + res->mem.range - 1, s);



        }
        else {
          fprintf(f, "%*s" "Memory Range: 0x%08""l" "x""-??? (%s)\n", ind, "", res->mem.base, s);
        }
        break;

      case res_io:
        *(s = buf) = 0;
        strcat(buf, res->io.access == acc_rw ? "rw" : res->io.access == acc_ro ? "ro" : "wo");
        if(!res->io.enabled) strcat(buf, ",disabled");
        if(*s == ',') s++;
        if(res->io.range == 0) {
          fprintf(f, "%*s" "I/O Ports: 0x%02""l" "x""-??? (%s)\n", ind, "", res->io.base, s);
        }
        else if(res->io.range == 1) {
          fprintf(f, "%*s" "I/O Port: 0x%02""l" "x"" (%s)\n", ind, "", res->io.base, s);
        }
        else {
          fprintf(f, "%*s" "I/O Ports: 0x%02""l" "x""-0x%02""l" "x"" (%s)\n", ind, "", res->io.base, res->io.base + res->io.range -1, s);
        }
        break;

      case res_irq:
        *(s = buf) = 0;
        switch(res->irq.triggered) {
          case 0:
            strcpy(s, "no events");
            break;

          case 1:
            strcpy(s, "1 event");
            break;

          default:
            sprintf(s, "%u events", res->irq.triggered);
        }
        if(!res->irq.enabled) {
          if(res->irq.triggered)
            strcat(s, ",");
          else
            *s = 0;
          strcat(s, "disabled");
        }
        fprintf(f, "%*s" "IRQ: %u (%s)\n", ind, "", res->irq.base, s);
        break;

      case res_dma:
        *(s = buf) = 0;
        if(!res->dma.enabled) strcpy(buf, " (disabled)");
        fprintf(f, "%*s" "DMA: %u%s\n", ind, "", res->dma.base, s);
        break;

      case res_monitor:
        fprintf(f, "%*s" "Resolution: %ux%u@%uHz%s\n", ind, "", res->monitor.width, res->monitor.height, res->monitor.vfreq, res->monitor.interlaced ? " (interlaced)" : "");




        break;

      case res_size:
        {
          char *s, b0[32], b1[32];

          switch(res->size.unit) {
            case size_unit_cinch:
              s = "''";
              snprintf(b0, sizeof b0 - 1, "%s", float2str(res->size.val1, 2));
              snprintf(b1, sizeof b1 - 1, "%s", float2str(res->size.val2, 2));
              break;

            default:
              switch(res->size.unit) {
                case size_unit_cm:
                  s = "cm";
                  break;
                case size_unit_sectors:
                  s = "sectors";
                  break;
                case size_unit_kbyte:
                  s = "kByte";
                  break;
                default:
                  s = "some unit";
              }
              snprintf(b0, sizeof b0 - 1, "%u", res->size.val1);
              snprintf(b1, sizeof b1 - 1, "%u", res->size.val2);
          }
          if(!res->size.val2)
            fprintf(f, "%*s" "Size: %s %s\n", ind, "", b0, s);
          else if(res->size.unit == size_unit_sectors)
            fprintf(f, "%*s" "Size: %s %s a %s bytes\n", ind, "", b0, s, b1);
          else
            fprintf(f, "%*s" "Size: %sx%s %s\n", ind, "", b0, b1, s);
        }
        break;

      case res_disk_geo:
        s = res->disk_geo.logical ? "Logical" : "Physical";
        fprintf(f, "%*s" "Geometry (%s): CHS %u/%u/%u\n", ind, "", s, res->disk_geo.cyls, res->disk_geo.heads, res->disk_geo.sectors);



        break;

      case res_cache:
        fprintf(f, "%*s" "Cache: %u kb\n", ind, "", res->cache.size);
        break;

      case res_baud:
        if(res->baud.speed == 0 || res->baud.speed % 100) {
          fprintf(f, "%*s" "Speed: %u bps\n", ind, "", res->baud.speed);
        }
        else if(res->baud.speed % 100000) {
          fprintf(f, "%*s" "Speed: %s kbps\n", ind, "", float2str(res->baud.speed, 3));
        }
        else {
          fprintf(f, "%*s" "Speed: %s Mbps\n", ind, "", float2str(res->baud.speed, 6));
        }
        if(res->baud.bits || res->baud.stopbits || res->baud.parity || res->baud.handshake) {
          int i = 0;

          fprintf(f, "%*s%s", ind, "", "Config: ");
          if(res->baud.bits) {
            fprintf(f, "%u bits", res->baud.bits);
            i++;
          }
          if(res->baud.parity) {
            fprintf(f, "%sparity %c", i++ ? ", " : "", res->baud.parity);
          }
          if(res->baud.stopbits) {
            fprintf(f, "%s%u stopbits", i++ ? ", " : "", res->baud.stopbits);
          }
          if(res->baud.handshake) {
            fprintf(f, "%shandshake %c", i++ ? ", " : "", res->baud.handshake);
          }
          fprintf(f, "\n");
        }
        break;

      case res_init_strings:
        if(res->init_strings.init1) fprintf(f, "%*s" "Init1: %s\n", ind, "", res->init_strings.init1);
        if(res->init_strings.init2) fprintf(f, "%*s" "Init2: %s\n", ind, "", res->init_strings.init2);
        break;

      case res_pppd_option:
        fprintf(f, "%*s" "PPPD Option: %s\n", ind, "", res->pppd_option.option);
        break;

      case res_framebuffer:
        fprintf(f, "%*s" "Mode 0x%04x: %ux%u (+%u), %u bits\n", ind, "", res->framebuffer.mode, res->framebuffer.width, res->framebuffer.height, res->framebuffer.bytes_p_line, res->framebuffer.colorbits);






        break;

      default:
        fprintf(f, "%*s" "Unkown resource type %d\n", ind, "", res->any.type);
    }
  }

  if((sl = h->requires)) {
    fprintf(f, "%*s" "Requires: %s", ind, "", sl->str);
    for(sl = sl->next; sl; sl = sl->next) {
      fprintf(f, ", %s", sl->str);
    }
    fprintf(f, "\n");
  }

  for(di = h->driver_info, i = 0; di; di = di->next, i++) {
    fprintf(f, "%*s" "Driver Info #%d:\n", ind, "", i);
    ind += 2;
    switch(di->any.type) {
      case di_any:
        fprintf(f, "%*s%s", ind, "", "Driver Info:");
        for(sl = di->any.hddb0, j = 0; sl; sl = sl->next, j++) {
          fprintf(f, "%c%s", j ? ',' : ' ', sl->str);
        }
        fprintf(f, "\n");
        break;

      case di_display:
        if(di->display.width)
          fprintf(f, "%*s" "Max. Resolution: %ux%u\n", ind, "", di->display.width, di->display.height);
        if(di->display.min_vsync)
           fprintf(f, "%*s" "Vert. Sync Range: %u-%u Hz\n", ind, "", di->display.min_vsync, di->display.max_vsync);
        if(di->display.min_hsync)
           fprintf(f, "%*s" "Hor. Sync Range: %u-%u kHz\n", ind, "", di->display.min_hsync, di->display.max_hsync);
        if(di->display.bandwidth)
           fprintf(f, "%*s" "Bandwidth: %u MHz\n", ind, "", di->display.bandwidth);
        break;

      case di_module:
        fprintf(f, "%*s%s", ind, "", "Driver Status: ");
        for(sl1 = di->module.names; sl1; sl1 = sl1->next) {
          fprintf(f, "%s%c", sl1->str, sl1->next ? ',' : ' ');
        }
        fprintf(f, "%s %sactive\n", di->module.names->next ? "are" : "is", di->module.active ? "" : "not ");




        fprintf(f, "%*s%s", ind, "", "Driver Activation Cmd: \"");
        for(sl1 = di->module.names, sl2 = di->module.mod_args; sl1 && sl2; sl1 = sl1->next, sl2 = sl2->next) {
          fprintf(f, "%s %s%s%s%s", di->module.modprobe ? "modprobe" : "insmod", sl1->str, sl2->str ? " " : "", sl2->str ? sl2->str : "", (sl1->next && sl2->next) ? "; " : "");






        }

        fprintf(f, "\"\n");

        if(di->module.conf) {
          char *s = di->module.conf;

          fprintf(f, "%*s%s", ind, "", "Driver \"modules.conf\" Entry: \"");
          for(; *s; s++) {
            if(((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISprint)) {
              fprintf(f, "%c", *s);
            }
            else {
              switch(*s) {
                case '\n': fprintf(f, "\\n"); break;
                case '\r': fprintf(f, "\\r"); break;
                case '\t': fprintf(f, "\t"); break;
                default: fprintf(f, "\\%03o", *s);
              }
            }
          }
          fprintf(f, "\"\n");
        }
      break;

      case di_mouse:
        if(di->mouse.buttons >= 0) fprintf(f, "%*s" "Buttons: %d\n", ind, "", di->mouse.buttons);
        if(di->mouse.wheels >= 0) fprintf(f, "%*s" "Wheels: %d\n", ind, "", di->mouse.wheels);
        if(di->mouse.xf86) fprintf(f, "%*s" "XFree86 Protocol: %s\n", ind, "", di->mouse.xf86);
        if(di->mouse.gpm) fprintf(f, "%*s" "GPM Protocol: %s\n", ind, "", di->mouse.gpm);
        break;

      case di_x11:
        if(di->x11.server) {
          fprintf(f, "%*s" "XFree86 v%s Server%s: %s\n", ind, "", di->x11.xf86_ver, strcmp(di->x11.xf86_ver, "4") ? "" : " Module", di->x11.server);



        }
        if(di->x11.x3d) fprintf(f, "%*s%s", ind, "", "3D Support: yes\n");
        if(di->x11.script) fprintf(f, "%*s" "3D Script: %s\n", ind, "", di->x11.script);
        if(di->x11.colors.all) {
          fprintf(f, "%*s%s", ind, "", "Color Depths: ");
          j = 0;
          if(di->x11.colors.c8) { fprintf(f, "8"); j++; }
          if(di->x11.colors.c15) { if(j) fprintf(f, ", "); fprintf(f, "15"); j++; }
          if(di->x11.colors.c16) { if(j) fprintf(f, ", "); fprintf(f, "16"); j++; }
          if(di->x11.colors.c24) { if(j) fprintf(f, ", "); fprintf(f, "24"); j++; }
          if(di->x11.colors.c32) { if(j) fprintf(f, ", "); fprintf(f, "32"); j++; }
          fprintf(f, "\n");
        }
        if(di->x11.dacspeed) fprintf(f, "%*s" "Max. DAC Clock: %u MHz\n", ind, "", di->x11.dacspeed);
        if(di->x11.extensions) {
          fprintf(f, "%*s" "Extensions: %s", ind, "", di->x11.extensions->str);
          for(sl = di->x11.extensions->next; sl; sl = sl->next) {
            fprintf(f, ", %s", sl->str);
          }
          fprintf(f, "\n");
        }
        if(di->x11.options) {
          fprintf(f, "%*s" "Options: %s", ind, "", di->x11.options->str);
          for(sl = di->x11.options->next; sl; sl = sl->next) {
            fprintf(f, ", %s", sl->str);
          }
          fprintf(f, "\n");
        }
        if(di->x11.raw) {
          fprintf(f, "%*s" "XF86Config Entry: %s", ind, "", di->x11.raw->str);
          for(sl = di->x11.raw->next; sl; sl = sl->next) {
            fprintf(f, "\\n%s", sl->str);
          }
          fprintf(f, "\n");
        }
        break;

      case di_isdn:
        fprintf(f, "%*s" "I4L Type: %d/%d [%s]\n", ind, "", di->isdn.i4l_type, di->isdn.i4l_subtype, di->isdn.i4l_name);



        if((ip = di->isdn.params)) {
          int k, l;

          fprintf(f, "%*s%s", ind, "", "Parameter:\n");
          for(k = 0; ip; ip = ip->next, k++) {
            fprintf(f, "%*s" "  %d%s: (0x%x/%02x): %s = 0x%""l" "x", ind, "", k, ip->conflict ? "(conflict)" : ip->valid ? "" : "(invalid)", ip->type, ip->flags >> 8, ip->name, ip->value);




            if(ip->alt_values) {
              for(l = 0; l < ip->alt_values; l++) {
                fprintf(f, "%s%s0x%x", l ? "," : " [", ip->alt_value[l] == ip->def_value ? "*" : "", ip->alt_value[l]);




              }
              fprintf(f, "]");
            }
            fprintf(f, "\n");
          }
        }
        break;

      case di_kbd:
        if(di->kbd.XkbRules) fprintf(f, "%*s" "XkbRules: %s\n", ind, "", di->kbd.XkbRules);
        if(di->kbd.XkbModel) fprintf(f, "%*s" "XkbModel: %s\n", ind, "", di->kbd.XkbModel);
        if(di->kbd.XkbLayout) fprintf(f, "%*s" "XkbLayout: %s\n", ind, "", di->kbd.XkbLayout);
        if(di->kbd.keymap) fprintf(f, "%*s" "keymap: %s\n", ind, "", di->kbd.keymap);
        break;

      default:
        fprintf(f, "%*s%s", ind, "", "Driver Status: unknown driver info format\n");
    }

    if((hd_data->debug & (1 << 3))) {
      for(sl = di->any.hddb0, j = 0; sl; sl = sl->next, j++) {
        if(j) {
          fprintf(f, "|%s", sl->str);
        }
        else {
          fprintf(f, "%*s" "Driver DB0: %d, %s", ind, "", di->any.type, sl->str);
        }
      }
      if(di->any.hddb0) fprintf(f, "\n");

      for(sl = di->any.hddb1, j = 0; sl; sl = sl->next, j++) {
        if(!j) fprintf(f, "%*s%s", ind, "", "Driver DB1: \"");
        fprintf(f, "%s\\n", sl->str);
      }
      if(di->any.hddb1) fprintf(f, "\"\n");
    }

    ind -= 2;
  }
}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-28 13:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-28 13:26 optimization/9886: [3.3/3.4 regression] ICE in final_scan_insn schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).