~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to util/grub-mkdevicemap.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2007-11-01 13:18:51 UTC
  • mto: (17.3.1 squeeze) (1.9.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20071101131851-63uqsb4dax2h1cbm
Tags: upstream-1.95+20071101
ImportĀ upstreamĀ versionĀ 1.95+20071101

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* grub-mkdevicemap.c - make a device map file automatically */
2
2
/*
3
3
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
 
4
 *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc.
5
5
 *
6
 
 *  GRUB is free software; you can redistribute it and/or modify
 
6
 *  GRUB is free software: you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
 
8
 *  the Free Software Foundation, either version 3 of the License, or
9
9
 *  (at your option) any later version.
10
10
 *
11
 
 *  This program is distributed in the hope that it will be useful,
 
11
 *  GRUB is distributed in the hope that it will be useful,
12
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
14
 *  GNU General Public License for more details.
15
15
 *
16
16
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with GRUB; if not, write to the Free Software
18
 
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
19
18
 */
20
19
 
21
20
#include <config.h>
35
34
#define _GNU_SOURCE     1
36
35
#include <getopt.h>
37
36
 
38
 
#ifdef __NetBSD__
39
 
/* NetBSD uses /boot for its boot block.  */
40
 
# define DEFAULT_DIRECTORY      "/grub"
41
 
#else
42
 
# define DEFAULT_DIRECTORY      "/boot/grub"
43
 
#endif
44
 
 
45
 
#define DEFAULT_DEVICE_MAP      DEFAULT_DIRECTORY "/device.map"
46
 
 
47
37
#ifdef __linux__
48
38
# if !defined(__GLIBC__) || \
49
39
        ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
412
402
          
413
403
          if (realpath (discn, name))
414
404
            {
 
405
              char *p;
415
406
              strcat (name, "/disc");
416
 
              fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
407
              p = grub_util_get_disk_name (num_hd, name);
 
408
              fprintf (fp, "(%s)\t%s\n", p, name);
 
409
              free (p);
417
410
            }
418
411
          
419
412
          num_hd++;
431
424
      get_ide_disk_name (name, i);
432
425
      if (check_device (name))
433
426
        {
434
 
          fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
427
          char *p;
 
428
          p = grub_util_get_disk_name (num_hd, name);
 
429
          fprintf (fp, "(%s)\t%s\n", p, name);
 
430
          free (p);
435
431
          num_hd++;
436
432
        }
437
433
    }
445
441
      get_ataraid_disk_name (name, i);
446
442
      if (check_device (name))
447
443
        {
448
 
          fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
444
          char *p;
 
445
          p = grub_util_get_disk_name (num_hd, name);
 
446
          fprintf (fp, "(%s)\t%s\n", p, name);
 
447
          free (p);
449
448
          num_hd++;
450
449
        }
451
450
    }
459
458
      get_scsi_disk_name (name, i);
460
459
      if (check_device (name))
461
460
        {
462
 
          fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
461
          char *p;
 
462
          p = grub_util_get_disk_name (num_hd, name);
 
463
          fprintf (fp, "(%s)\t%s\n", p, name);
 
464
          free (p);
463
465
          num_hd++;
464
466
        }
465
467
    }
482
484
            get_dac960_disk_name (name, controller, drive);
483
485
            if (check_device (name))
484
486
              {
485
 
                fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
487
                char *p;
 
488
                p = grub_util_get_disk_name (num_hd, name);
 
489
                fprintf (fp, "(%s)\t%s\n", p, name);
 
490
                free (p);
486
491
                num_hd++;
487
492
              }
488
493
          }
500
505
        get_i2o_disk_name (name, unit);
501
506
        if (check_device (name))
502
507
          {
503
 
            fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
 
508
            char *p;
 
509
            p = grub_util_get_disk_name (num_hd, name);
 
510
            fprintf (fp, "(%s)\t%s\n", p, name);
 
511
            free (p);
504
512
            num_hd++;
505
513
          }
506
514
      }