Print this page
fixes + mirror

Split Close
Expand all
Collapse all
          --- old/grub/grub-core/commands/search_wrap.c
          +++ new/grub/grub-core/commands/search_wrap.c
↓ open down ↓ 55 lines elided ↑ open up ↑
  56   56          "If HINT ends in comma, also try subpartitions"),
  57   57       N_("HINT"), ARG_TYPE_STRING},
  58   58      {"hint-efi",   0, GRUB_ARG_OPTION_REPEATABLE,
  59   59       N_("First try the device HINT if currently running on EFI. "
  60   60          "If HINT ends in comma, also try subpartitions"),
  61   61       N_("HINT"), ARG_TYPE_STRING},
  62   62      {"hint-arc",   0, GRUB_ARG_OPTION_REPEATABLE,
  63   63       N_("First try the device HINT if currently running on ARC."
  64   64          " If HINT ends in comma, also try subpartitions"),
  65   65       N_("HINT"), ARG_TYPE_STRING},
       66 +    {"zfs-mirror", 'z', 0, N_("Handle zfs-mirror disk"), 0, 0},
  66   67      {0, 0, 0, 0, 0, 0}
  67   68    };
  68   69  
  69   70  enum options
  70   71    {
  71   72      SEARCH_FILE,
  72   73      SEARCH_LABEL,
  73   74      SEARCH_FS_UUID,
  74   75      SEARCH_SET,
  75   76      SEARCH_NO_FLOPPY,
  76   77      SEARCH_HINT,
  77   78      SEARCH_HINT_IEEE1275,
  78   79      SEARCH_HINT_BIOS,
  79   80      SEARCH_HINT_BAREMETAL,
  80   81      SEARCH_HINT_EFI,
  81   82      SEARCH_HINT_ARC,
       83 +    SEARCH_ZFS_MIRROR,
  82   84   };
  83   85  
  84   86  static grub_err_t
  85   87  grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
  86   88  {
  87   89    struct grub_arg_list *state = ctxt->state;
  88   90    const char *var = 0;
  89   91    const char *id = 0;
  90   92    int i = 0, j = 0, nhints = 0;
  91   93    char **hints = NULL;
       94 +  int mirror_mode = 0;
  92   95  
  93   96    if (state[SEARCH_HINT].set)
  94   97      for (i = 0; state[SEARCH_HINT].args[i]; i++)
  95   98        nhints++;
  96   99  
  97  100  #ifdef GRUB_MACHINE_IEEE1275
  98  101    if (state[SEARCH_HINT_IEEE1275].set)
  99  102      for (i = 0; state[SEARCH_HINT_IEEE1275].args[i]; i++)
 100  103        nhints++;
 101  104  #endif
↓ open down ↓ 68 lines elided ↑ open up ↑
 170  173    if (argc != j)
 171  174      id = args[j];
 172  175    else if (state[SEARCH_SET].set && state[SEARCH_SET].arg)
 173  176      {
 174  177        id = state[SEARCH_SET].arg;
 175  178        var = "root";
 176  179      }
 177  180    else
 178  181      return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
 179  182  
      183 +  if (state[SEARCH_ZFS_MIRROR].set)
      184 +    mirror_mode = 1;
      185 +
 180  186    if (state[SEARCH_LABEL].set)
 181  187      grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set, 
 182      -                       hints, nhints);
      188 +                       hints, nhints, mirror_mode);
 183  189    else if (state[SEARCH_FS_UUID].set)
 184  190      grub_search_fs_uuid (id, var, state[SEARCH_NO_FLOPPY].set,
 185      -                         hints, nhints);
      191 +                         hints, nhints, mirror_mode);
 186  192    else if (state[SEARCH_FILE].set)
 187  193      grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set, 
 188      -                         hints, nhints);
      194 +                         hints, nhints, mirror_mode);
 189  195    else
 190  196      return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
 191  197  
 192  198    return grub_errno;
 193  199  }
 194  200  
 195  201  static grub_extcmd_t cmd;
 196  202  
 197  203  GRUB_MOD_INIT(search)
 198  204  {
↓ open down ↓ 17 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX