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

« back to all changes in this revision

Viewing changes to normal/autofs.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:
1
 
/* autofs.c - support auto-loading from fs.lst */
2
 
/*
3
 
 *  GRUB  --  GRand Unified Bootloader
4
 
 *  Copyright (C) 2009  Free Software Foundation, Inc.
5
 
 *
6
 
 *  GRUB is free software: you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation, either version 3 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  GRUB is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License
17
 
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
18
 
 */
19
 
 
20
 
#include <grub/mm.h>
21
 
#include <grub/dl.h>
22
 
#include <grub/env.h>
23
 
#include <grub/misc.h>
24
 
#include <grub/fs.h>
25
 
#include <grub/normal.h>
26
 
 
27
 
/* This is used to store the names of filesystem modules for auto-loading.  */
28
 
static grub_named_list_t fs_module_list;
29
 
 
30
 
/* The auto-loading hook for filesystems.  */
31
 
static int
32
 
autoload_fs_module (void)
33
 
{
34
 
  grub_named_list_t p;
35
 
 
36
 
  while ((p = fs_module_list) != NULL)
37
 
    {
38
 
      if (! grub_dl_get (p->name) && grub_dl_load (p->name))
39
 
        return 1;
40
 
 
41
 
      fs_module_list = p->next;
42
 
      grub_free (p->name);
43
 
      grub_free (p);
44
 
    }
45
 
 
46
 
  return 0;
47
 
}
48
 
 
49
 
/* Read the file fs.lst for auto-loading.  */
50
 
void
51
 
read_fs_list (void)
52
 
{
53
 
  const char *prefix;
54
 
 
55
 
  prefix = grub_env_get ("prefix");
56
 
  if (prefix)
57
 
    {
58
 
      char *filename;
59
 
 
60
 
      filename = grub_xasprintf ("%s/fs.lst", prefix);
61
 
      if (filename)
62
 
        {
63
 
          grub_file_t file;
64
 
          grub_fs_autoload_hook_t tmp_autoload_hook;
65
 
 
66
 
          /* This rules out the possibility that read_fs_list() is invoked
67
 
             recursively when we call grub_file_open() below.  */
68
 
          tmp_autoload_hook = grub_fs_autoload_hook;
69
 
          grub_fs_autoload_hook = NULL;
70
 
 
71
 
          file = grub_file_open (filename);
72
 
          if (file)
73
 
            {
74
 
              /* Override previous fs.lst.  */
75
 
              while (fs_module_list)
76
 
                {
77
 
                  grub_named_list_t tmp;
78
 
                  tmp = fs_module_list->next;
79
 
                  grub_free (fs_module_list);
80
 
                  fs_module_list = tmp;
81
 
                }
82
 
 
83
 
              while (1)
84
 
                {
85
 
                  char *buf;
86
 
                  char *p;
87
 
                  char *q;
88
 
                  grub_named_list_t fs_mod;
89
 
 
90
 
                  buf = grub_file_getline (file);
91
 
                  if (! buf)
92
 
                    break;
93
 
 
94
 
                  p = buf;
95
 
                  q = buf + grub_strlen (buf) - 1;
96
 
 
97
 
                  /* Ignore space.  */
98
 
                  while (grub_isspace (*p))
99
 
                    p++;
100
 
 
101
 
                  while (p < q && grub_isspace (*q))
102
 
                    *q-- = '\0';
103
 
 
104
 
                  /* If the line is empty, skip it.  */
105
 
                  if (p >= q)
106
 
                    continue;
107
 
 
108
 
                  fs_mod = grub_malloc (sizeof (*fs_mod));
109
 
                  if (! fs_mod)
110
 
                    continue;
111
 
 
112
 
                  fs_mod->name = grub_strdup (p);
113
 
                  if (! fs_mod->name)
114
 
                    {
115
 
                      grub_free (fs_mod);
116
 
                      continue;
117
 
                    }
118
 
 
119
 
                  fs_mod->next = fs_module_list;
120
 
                  fs_module_list = fs_mod;
121
 
                }
122
 
 
123
 
              grub_file_close (file);
124
 
              grub_fs_autoload_hook = tmp_autoload_hook;
125
 
            }
126
 
 
127
 
          grub_free (filename);
128
 
        }
129
 
    }
130
 
 
131
 
  /* Ignore errors.  */
132
 
  grub_errno = GRUB_ERR_NONE;
133
 
 
134
 
  /* Set the hook.  */
135
 
  grub_fs_autoload_hook = autoload_fs_module;
136
 
}