~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to util/grub-fstest.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <config.h>
21
21
#include <grub/types.h>
 
22
#include <grub/emu/misc.h>
22
23
#include <grub/util/misc.h>
23
24
#include <grub/misc.h>
24
25
#include <grub/device.h>
29
30
#include <grub/term.h>
30
31
#include <grub/mm.h>
31
32
#include <grub/lib/hexdump.h>
32
 
#include <grub/lib/crc.h>
 
33
#include <grub/crypto.h>
33
34
#include <grub/command.h>
34
35
#include <grub/i18n.h>
35
36
 
36
 
#include <grub_fstest_init.h>
37
 
 
38
37
#include <stdio.h>
39
38
#include <unistd.h>
40
39
#include <string.h>
41
40
#include <stdlib.h>
42
 
#include <getopt.h>
43
41
 
44
42
#include "progname.h"
45
 
 
46
 
void
47
 
grub_putchar (int c)
48
 
{
49
 
  putchar (c);
50
 
}
51
 
 
52
 
int
53
 
grub_getkey (void)
54
 
{
55
 
  return -1;
56
 
}
57
 
 
58
 
struct grub_handler_class grub_term_input_class;
59
 
struct grub_handler_class grub_term_output_class;
60
 
 
61
 
void
62
 
grub_refresh (void)
63
 
{
64
 
  fflush (stdout);
65
 
}
 
43
#include "argp.h"
66
44
 
67
45
static grub_err_t
68
46
execute_command (char *name, int n, char **args)
71
49
 
72
50
  cmd = grub_command_find (name);
73
51
  if (! cmd)
74
 
    grub_util_error ("can\'t find command %s", name);
 
52
    grub_util_error (_("can\'t find command %s"), name);
75
53
 
76
54
  return (cmd->func) (cmd, n, args);
77
55
}
100
78
 
101
79
      dev = grub_device_open (0);
102
80
      if ((! dev) || (! dev->disk))
103
 
        grub_util_error ("can\'t open device");
 
81
        grub_util_error (_("can\'t open device"));
104
82
 
105
83
      grub_util_info ("total sectors : %lld",
106
84
                      (unsigned long long) dev->disk->total_sectors);
115
93
          len = (leng > BUF_SIZE) ? BUF_SIZE : leng;
116
94
 
117
95
          if (grub_disk_read (dev->disk, 0, skip, len, buf))
118
 
            grub_util_error ("disk read fails at offset %lld, length %d",
 
96
            grub_util_error (_("disk read fails at offset %lld, length %d"),
119
97
                             skip, len);
120
98
 
121
99
          if (hook (skip, buf, len))
129
107
      return;
130
108
    }
131
109
 
 
110
  grub_file_filter_disable_compression ();
132
111
  file = grub_file_open (pathname);
133
112
  if (!file)
134
113
    {
135
 
      grub_util_error ("cannot open file %s", pathname);
 
114
      grub_util_error (_("cannot open file %s"), pathname);
136
115
      return;
137
116
    }
138
117
 
140
119
 
141
120
  if (skip > file->size)
142
121
    {
143
 
      grub_util_error ("invalid skip value %lld", (unsigned long long) skip);
 
122
      grub_util_error (_("invalid skip value %lld"), (unsigned long long) skip);
144
123
      return;
145
124
    }
146
125
 
158
137
      sz = grub_file_read (file, buf, (len > BUF_SIZE) ? BUF_SIZE : len);
159
138
      if (sz < 0)
160
139
        {
161
 
          grub_util_error ("read error at offset %llu", ofs);
 
140
          grub_util_error (_("read error at offset %llu: %s"), ofs,
 
141
                           grub_errmsg);
162
142
          break;
163
143
        }
164
144
 
184
164
 
185
165
    if ((int) fwrite (buf, 1, len, ff) != len)
186
166
      {
187
 
        grub_util_error ("write error");
 
167
        grub_util_error (_("write error"));
188
168
        return 1;
189
169
      }
190
170
 
194
174
  ff = fopen (dest, "wb");
195
175
  if (ff == NULL)
196
176
    {
197
 
      grub_util_error ("open error");
 
177
      grub_util_error (_("open error"));
198
178
      return;
199
179
    }
200
180
  read_file (src, cp_hook);
212
192
  {
213
193
    if ((int) fread (buf_1, 1, len, ff) != len)
214
194
      {
215
 
        grub_util_error ("read error at offset %llu", ofs);
 
195
        grub_util_error (_("read error at offset %llu: %s"), ofs, grub_errmsg);
216
196
        return 1;
217
197
      }
218
198
 
223
203
        for (i = 0; i < len; i++, ofs++)
224
204
          if (buf_1[i] != buf[i])
225
205
            {
226
 
              grub_util_error ("compare fail at offset %llu", ofs);
 
206
              grub_util_error (_("compare fail at offset %llu"), ofs);
227
207
              return 1;
228
208
            }
229
209
      }
233
213
  ff = fopen (dest, "rb");
234
214
  if (ff == NULL)
235
215
    {
236
 
      grub_util_error ("open error");
 
216
      grub_util_error (_("open error"));
237
217
      return;
238
218
    }
239
219
 
240
220
  if ((skip) && (fseeko (ff, skip, SEEK_SET)))
241
 
    grub_util_error ("seek error");
 
221
    grub_util_error (_("seek error"));
242
222
 
243
223
  read_file (src, cmp_hook);
244
224
  fclose (ff);
260
240
static void
261
241
cmd_crc (char *pathname)
262
242
{
263
 
  grub_uint32_t crc = 0;
 
243
  grub_uint8_t crc32_context[GRUB_MD_CRC32->contextsize];
 
244
  GRUB_MD_CRC32->init(crc32_context);
264
245
 
265
246
  auto int crc_hook (grub_off_t ofs, char *buf, int len);
266
247
  int crc_hook (grub_off_t ofs, char *buf, int len)
267
248
  {
268
249
    (void) ofs;
269
250
 
270
 
    crc = grub_getcrc32 (crc, buf, len);
 
251
    GRUB_MD_CRC32->write(crc32_context, buf, len);
271
252
    return 0;
272
253
  }
273
254
 
274
255
  read_file (pathname, crc_hook);
275
 
  printf ("%08x\n", crc);
 
256
  GRUB_MD_CRC32->final(crc32_context);
 
257
  printf ("%08x\n",
 
258
      grub_be_to_cpu32(*(grub_uint32_t*)GRUB_MD_CRC32->read(crc32_context)));
276
259
}
277
260
 
 
261
static char *root = NULL;
 
262
static int args_count = 0;
 
263
static int nparm = 0;
 
264
static int num_disks = 1;
 
265
static char **images = NULL;
 
266
static int cmd = 0;
 
267
static char *debug_str = NULL;
 
268
static char **args = NULL;
 
269
 
278
270
static void
279
 
fstest (char **images, int num_disks, int cmd, int n, char **args)
 
271
fstest (int n, char **args)
280
272
{
281
273
  char *host_file;
282
274
  char *loop_name;
283
 
  char *argv[3] = { "-p" };
284
275
  int i;
285
276
 
286
277
  for (i = 0; i < num_disks; i++)
287
278
    {
 
279
      char *argv[2];
288
280
      loop_name = grub_xasprintf ("loop%d", i);
 
281
      if (!loop_name)
 
282
        grub_util_error (grub_errmsg);
 
283
 
289
284
      host_file = grub_xasprintf ("(host)%s", images[i]);
290
 
 
291
 
      if (!loop_name || !host_file)
292
 
        {
293
 
          grub_free (loop_name);
294
 
          grub_free (host_file);
295
 
          grub_util_error (grub_errmsg);
296
 
          return;
297
 
        }
298
 
 
299
 
      argv[1] = loop_name;
300
 
      argv[2] = host_file;
301
 
 
302
 
      if (execute_command ("loopback", 3, argv))
303
 
        grub_util_error ("loopback command fails");
 
285
      if (!host_file)
 
286
        grub_util_error (grub_errmsg);
 
287
 
 
288
      argv[0] = loop_name;
 
289
      argv[1] = host_file;
 
290
 
 
291
      if (execute_command ("loopback", 2, argv))
 
292
        grub_util_error (_("loopback command fails"));
 
293
 
 
294
      grub_free (loop_name);
 
295
      grub_free (host_file);
304
296
    }
305
297
 
306
298
  grub_lvm_fini ();
307
 
  grub_mdraid_fini ();
 
299
  grub_mdraid09_fini ();
 
300
  grub_mdraid1x_fini ();
308
301
  grub_raid_fini ();
309
302
  grub_raid_init ();
310
 
  grub_mdraid_init ();
 
303
  grub_mdraid09_init ();
 
304
  grub_mdraid1x_init ();
311
305
  grub_lvm_init ();
312
306
 
313
307
  switch (cmd)
331
325
      execute_command ("blocklist", n, args);
332
326
      grub_printf ("\n");
333
327
    }
334
 
 
335
 
  argv[0] = "-d";
336
 
 
 
328
    
337
329
  for (i = 0; i < num_disks; i++)
338
330
    {
339
 
      grub_free (loop_name);
 
331
      char *argv[2];
 
332
 
340
333
      loop_name = grub_xasprintf ("loop%d", i);
341
334
      if (!loop_name)
342
 
        {
343
 
          grub_free (host_file);
344
 
          grub_util_error (grub_errmsg);
345
 
          return;
346
 
        }
 
335
        grub_util_error (grub_errmsg);
 
336
 
 
337
      argv[0] = "-d";      
 
338
      argv[1] = loop_name;
 
339
 
347
340
      execute_command ("loopback", 2, argv);
 
341
 
 
342
      grub_free (loop_name);
348
343
    }
349
 
 
350
 
  grub_free (loop_name);
351
 
  grub_free (host_file);
352
344
}
353
345
 
354
 
static struct option options[] = {
355
 
  {"root", required_argument, 0, 'r'},
356
 
  {"skip", required_argument, 0, 's'},
357
 
  {"length", required_argument, 0, 'n'},
358
 
  {"diskcount", required_argument, 0, 'c'},
359
 
  {"debug", required_argument, 0, 'd'},
360
 
  {"help", no_argument, 0, 'h'},
361
 
  {"version", no_argument, 0, 'V'},
362
 
  {"verbose", no_argument, 0, 'v'},
363
 
  {0, 0, 0, 0}
 
346
static struct argp_option options[] = {
 
347
  {0,          0, 0      , OPTION_DOC, N_("Commands:"), 1},
 
348
  {N_("ls PATH"),  0, 0      , OPTION_DOC, N_("List files in PATH."), 1},
 
349
  {N_("cp FILE LOCAL"),  0, 0, OPTION_DOC, N_("Copy FILE to local file LOCAL."), 1},
 
350
  {N_("cmp FILE LOCAL"), 0, 0, OPTION_DOC, N_("Compare FILE with local file LOCAL."), 1},
 
351
  {N_("hex FILE"), 0, 0      , OPTION_DOC, N_("Hex dump FILE."), 1},
 
352
  {N_("crc FILE"), 0, 0     , OPTION_DOC, N_("Get crc32 checksum of FILE."), 1},
 
353
  {N_("blocklist FILE"), 0, 0, OPTION_DOC, N_("Display blocklist of FILE."), 1},
 
354
  
 
355
  {"root",      'r', N_("DEVICE_NAME"), 0, N_("Set root device."),                 2},
 
356
  {"skip",      's', "N",           0, N_("Skip N bytes from output file."),   2},
 
357
  {"length",    'n', "N",           0, N_("Handle N bytes in output file."),   2},
 
358
  {"diskcount", 'c', "N",           0, N_("N input files."),                   2},
 
359
  {"debug",     'd', "S",           0, N_("Set debug environment variable."),  2},
 
360
  {"verbose",   'v', NULL, OPTION_ARG_OPTIONAL, N_("Print verbose messages."), 2},
 
361
  {0, 0, 0, 0, 0, 0}
364
362
};
365
363
 
 
364
/* Print the version information.  */
366
365
static void
367
 
usage (int status)
 
366
print_version (FILE *stream, struct argp_state *state)
368
367
{
369
 
  if (status)
370
 
    fprintf (stderr, "Try `%s --help' for more information.\n", program_name);
371
 
  else
372
 
    printf ("\
373
 
Usage: %s [OPTION]... IMAGE_PATH COMMANDS\n\
374
 
\n\
375
 
Debug tool for filesystem driver.\n\
376
 
\nCommands:\n\
377
 
  ls PATH                   list files in PATH\n\
378
 
  cp FILE LOCAL             copy FILE to local file LOCAL\n\
379
 
  cmp FILE LOCAL            compare FILE with local file LOCAL\n\
380
 
  hex FILE                  Hex dump FILE\n\
381
 
  crc FILE                  Get crc32 checksum of FILE\n\
382
 
  blocklist FILE            display blocklist of FILE\n\
383
 
\nOptions:\n\
384
 
  -r, --root=DEVICE_NAME    set root device\n\
385
 
  -s, --skip=N              skip N bytes from output file\n\
386
 
  -n, --length=N            handle N bytes in output file\n\
387
 
  -c, --diskcount=N         N input files\n\
388
 
  -d, --debug=S             Set debug environment variable\n\
389
 
  -h, --help                display this message and exit\n\
390
 
  -V, --version             print version information and exit\n\
391
 
  -v, --verbose             print verbose messages\n\
392
 
\n\
393
 
Report bugs to <%s>.\n", program_name, PACKAGE_BUGREPORT);
394
 
 
395
 
  exit (status);
 
368
  fprintf (stream, "%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
396
369
}
 
370
void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
397
371
 
398
 
int
399
 
main (int argc, char *argv[])
 
372
error_t 
 
373
argp_parser (int key, char *arg, struct argp_state *state)
400
374
{
401
 
  char *debug_str = NULL, *root = NULL, *default_root, *alloc_root;
402
 
  int i, cmd, num_opts, image_index, num_disks = 1;
403
 
 
404
 
  set_program_name (argv[0]);
405
 
 
406
 
  grub_util_init_nls ();
407
 
 
408
 
  /* Find the first non option entry.  */
409
 
  for (num_opts = 1; num_opts < argc; num_opts++)
410
 
    if (argv[num_opts][0] == '-')
411
 
      {
412
 
        if ((argv[num_opts][2] == 0) && (num_opts < argc - 1) &&
413
 
            ((argv[num_opts][1] == 'r') ||
414
 
             (argv[num_opts][1] == 's') ||
415
 
             (argv[num_opts][1] == 'n') ||
416
 
             (argv[num_opts][1] == 'c') ||
417
 
             (argv[num_opts][1] == 'd')))
418
 
            num_opts++;
419
 
      }
420
 
    else
 
375
  char *p;
 
376
 
 
377
  switch (key)
 
378
    {
 
379
    case 'r':
 
380
      root = arg;
 
381
      return 0;
 
382
 
 
383
    case 's':
 
384
      skip = grub_strtoul (arg, &p, 0);
 
385
      if (*p == 's')
 
386
        skip <<= GRUB_DISK_SECTOR_BITS;
 
387
      return 0;
 
388
 
 
389
    case 'n':
 
390
      leng = grub_strtoul (arg, &p, 0);
 
391
      if (*p == 's')
 
392
        leng <<= GRUB_DISK_SECTOR_BITS;
 
393
      return 0;
 
394
 
 
395
    case 'c':
 
396
      num_disks = grub_strtoul (arg, NULL, 0);
 
397
      if (num_disks < 1)
 
398
        {
 
399
          fprintf (stderr, "%s", _("Invalid disk count.\n"));
 
400
          argp_usage (state);
 
401
        }
 
402
      if (args_count != 0)
 
403
        {
 
404
          fprintf (stderr, "%s", _("Disk count must precede disks list.\n"));
 
405
          argp_usage (state);
 
406
        }
 
407
      return 0;
 
408
 
 
409
    case 'd':
 
410
      debug_str = arg;
 
411
      return 0;
 
412
 
 
413
    case 'v':
 
414
      verbosity++;
 
415
      return 0;
 
416
 
 
417
    case ARGP_KEY_END:
 
418
      if (args_count < num_disks)
 
419
        {
 
420
          fprintf (stderr, "%s", _("No command is specified.\n"));
 
421
          argp_usage (state);
 
422
        }
 
423
      if (args_count - 1 - num_disks < nparm)
 
424
        {
 
425
          fprintf (stderr, "%s", _("Not enough parameters to command.\n"));
 
426
          argp_usage (state);
 
427
        }
 
428
      return 0;
 
429
 
 
430
    case ARGP_KEY_ARG:
421
431
      break;
422
432
 
423
 
  /* Check for options.  */
424
 
  while (1)
425
 
    {
426
 
      int c = getopt_long (num_opts, argv, "r:s:n:c:d:hVv", options, 0);
427
 
      char *p;
428
 
 
429
 
      if (c == -1)
430
 
        break;
431
 
      else
432
 
        switch (c)
433
 
          {
434
 
          case 'r':
435
 
            root = optarg;
436
 
            break;
437
 
 
438
 
          case 's':
439
 
            skip = grub_strtoul (optarg, &p, 0);
440
 
            if (*p == 's')
441
 
              skip <<= GRUB_DISK_SECTOR_BITS;
442
 
            break;
443
 
 
444
 
          case 'n':
445
 
            leng = grub_strtoul (optarg, &p, 0);
446
 
            if (*p == 's')
447
 
              leng <<= GRUB_DISK_SECTOR_BITS;
448
 
            break;
449
 
 
450
 
          case 'c':
451
 
            num_disks = grub_strtoul (optarg, NULL, 0);
452
 
            if (num_disks < 1)
453
 
              {
454
 
                fprintf (stderr, "Invalid disk count.\n");
455
 
                usage (1);
456
 
              }
457
 
            break;
458
 
 
459
 
          case 'd':
460
 
            debug_str = optarg;
461
 
            break;
462
 
 
463
 
          case 'h':
464
 
            usage (0);
465
 
            break;
466
 
 
467
 
          case 'V':
468
 
            printf ("%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
469
 
            return 0;
470
 
 
471
 
          case 'v':
472
 
            verbosity++;
473
 
            break;
474
 
 
475
 
          default:
476
 
            usage (1);
477
 
            break;
478
 
          }
479
 
    }
480
 
 
481
 
  /* Obtain PATH.  */
482
 
  if (optind + num_disks - 1 >= argc)
483
 
    {
484
 
      fprintf (stderr, "Not enough pathname.\n");
485
 
      usage (1);
486
 
    }
487
 
 
488
 
  image_index = optind;
489
 
  for (i = 0; i < num_disks; i++, optind++)
490
 
    if (argv[optind][0] != '/')
491
 
      {
492
 
        fprintf (stderr, "Must use absolute path.\n");
493
 
        usage (1);
494
 
      }
495
 
 
496
 
  cmd = 0;
497
 
  if (optind < argc)
498
 
    {
499
 
      int nparm = 0;
500
 
 
501
 
      if (!grub_strcmp (argv[optind], "ls"))
 
433
    default:
 
434
      return ARGP_ERR_UNKNOWN;
 
435
    }
 
436
 
 
437
  if (args_count < num_disks)
 
438
    {
 
439
      if (arg[0] != '/')
 
440
        {
 
441
          fprintf (stderr, "%s", _("Must use absolute path.\n"));
 
442
          argp_usage (state);
 
443
        }
 
444
      if (args_count == 0)
 
445
        images = xmalloc (num_disks * sizeof (images[0]));
 
446
      images[args_count] = xstrdup (arg);
 
447
      args_count++;
 
448
      return 0;
 
449
    }
 
450
 
 
451
  if (args_count == num_disks)
 
452
    {
 
453
      if (!grub_strcmp (arg, "ls"))
502
454
        {
503
455
          cmd = CMD_LS;
504
456
        }
505
 
      else if (!grub_strcmp (argv[optind], "cp"))
 
457
      else if (!grub_strcmp (arg, "cp"))
506
458
        {
507
459
          cmd = CMD_CP;
508
460
          nparm = 2;
509
461
        }
510
 
      else if (!grub_strcmp (argv[optind], "cmp"))
 
462
      else if (!grub_strcmp (arg, "cmp"))
511
463
        {
512
464
          cmd = CMD_CMP;
513
465
          nparm = 2;
514
466
        }
515
 
      else if (!grub_strcmp (argv[optind], "hex"))
 
467
      else if (!grub_strcmp (arg, "hex"))
516
468
        {
517
469
          cmd = CMD_HEX;
518
470
          nparm = 1;
519
471
        }
520
 
      else if (!grub_strcmp (argv[optind], "crc"))
 
472
      else if (!grub_strcmp (arg, "crc"))
521
473
        {
522
474
          cmd = CMD_CRC;
523
475
          nparm = 1;
524
476
        }
525
 
      else if (!grub_strcmp (argv[optind], "blocklist"))
 
477
      else if (!grub_strcmp (arg, "blocklist"))
526
478
        {
527
479
          cmd = CMD_BLOCKLIST;
528
480
          nparm = 1;
529
481
        }
530
482
      else
531
483
        {
532
 
          fprintf (stderr, "Invalid command %s.\n", argv[optind]);
533
 
          usage (1);
534
 
        }
535
 
 
536
 
      if (optind + 1 + nparm > argc)
537
 
        {
538
 
          fprintf (stderr, "Invalid parameter for command %s.\n",
539
 
                   argv[optind]);
540
 
          usage (1);
541
 
        }
542
 
 
543
 
      optind++;
544
 
    }
545
 
  else
546
 
    {
547
 
      fprintf (stderr, "No command is specified.\n");
548
 
      usage (1);
549
 
    }
 
484
          fprintf (stderr, _("Invalid command %s.\n"), arg);
 
485
          argp_usage (state);
 
486
        }
 
487
      args_count++;
 
488
      return 0;
 
489
    }
 
490
 
 
491
  args[args_count - 1 - num_disks] = xstrdup (arg);
 
492
  args_count++;
 
493
  return 0;
 
494
}
 
495
 
 
496
struct argp argp = {
 
497
  options, argp_parser, N_("IMAGE_PATH COMMANDS"),
 
498
  N_("Debug tool for filesystem driver."), 
 
499
  NULL, NULL, NULL
 
500
};
 
501
 
 
502
int
 
503
main (int argc, char *argv[])
 
504
{
 
505
  char *default_root, *alloc_root;
 
506
 
 
507
  set_program_name (argv[0]);
 
508
 
 
509
  grub_util_init_nls ();
 
510
 
 
511
  args = xmalloc (argc * sizeof (args[0]));
 
512
 
 
513
  argp_parse (&argp, argc, argv, 0, 0, 0);
550
514
 
551
515
  /* Initialize all modules. */
552
516
  grub_init_all ();
575
539
    free (alloc_root);
576
540
 
577
541
  /* Do it.  */
578
 
  fstest (argv + image_index, num_disks, cmd, argc - optind, argv + optind);
 
542
  fstest (args_count - 1 - num_disks, args);
579
543
 
580
544
  /* Free resources.  */
581
545
  grub_fini_all ();