Print this page
3027 installgrub can segfault when encountering bogus data on disk


  35 enum ib_fs_types {
  36         TARGET_IS_UFS = 0,
  37         TARGET_IS_HSFS,
  38         TARGET_IS_ZFS
  39 };
  40 
  41 typedef struct _ib_device {
  42         char    *path;
  43         int     fd;
  44         uint8_t type;
  45 } ib_device_t;
  46 
  47 typedef struct _ib_bootblock {
  48         char                    *buf;
  49         char                    *file;
  50         char                    *extra;
  51         multiboot_header_t      *mboot;
  52         uint32_t                mboot_off;
  53         uint32_t                buf_size;
  54         uint32_t                file_size;

  55 } ib_bootblock_t;
  56 
  57 typedef struct _ib_data {
  58         ib_device_t     device;
  59         ib_bootblock_t  bootblock;
  60 } ib_data_t;
  61 
  62 #define is_zfs(type)    (type == TARGET_IS_ZFS)
  63 
  64 #define BBLK_DATA_RSVD_SIZE     (15 * SECTOR_SIZE)
  65 #define BBLK_ZFS_EXTRA_OFF      (SECTOR_SIZE * 1024)
  66 
  67 #ifdef  __cplusplus
  68 }
  69 #endif
  70 
  71 #endif /* _INSTALLBOOT_H */


  35 enum ib_fs_types {
  36         TARGET_IS_UFS = 0,
  37         TARGET_IS_HSFS,
  38         TARGET_IS_ZFS
  39 };
  40 
  41 typedef struct _ib_device {
  42         char    *path;
  43         int     fd;
  44         uint8_t type;
  45 } ib_device_t;
  46 
  47 typedef struct _ib_bootblock {
  48         char                    *buf;
  49         char                    *file;
  50         char                    *extra;
  51         multiboot_header_t      *mboot;
  52         uint32_t                mboot_off;
  53         uint32_t                buf_size;
  54         uint32_t                file_size;
  55         uint32_t                extra_size;
  56 } ib_bootblock_t;
  57 
  58 typedef struct _ib_data {
  59         ib_device_t     device;
  60         ib_bootblock_t  bootblock;
  61 } ib_data_t;
  62 
  63 #define is_zfs(type)    (type == TARGET_IS_ZFS)
  64 
  65 #define BBLK_DATA_RSVD_SIZE     (15 * SECTOR_SIZE)
  66 #define BBLK_ZFS_EXTRA_OFF      (SECTOR_SIZE * 1024)
  67 
  68 #ifdef  __cplusplus
  69 }
  70 #endif
  71 
  72 #endif /* _INSTALLBOOT_H */