Add new 'proc' filesystem framework and put luks_script into it.
This commit is contained in:
parent
d975e8d59c
commit
ce50dbd746
10 changed files with 350 additions and 5 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-03-24 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Add new 'proc' filesystem framework and put luks_script into it.
|
||||||
|
|
||||||
2013-03-23 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-03-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/term/at_keyboard.c: Increase robustness on coreboot
|
* grub-core/term/at_keyboard.c: Increase robustness on coreboot
|
||||||
|
|
|
@ -33,6 +33,7 @@ library = {
|
||||||
common = grub-core/disk/diskfilter.c;
|
common = grub-core/disk/diskfilter.c;
|
||||||
common = grub-core/partmap/gpt.c;
|
common = grub-core/partmap/gpt.c;
|
||||||
common = grub-core/partmap/msdos.c;
|
common = grub-core/partmap/msdos.c;
|
||||||
|
common = grub-core/fs/proc.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
library = {
|
library = {
|
||||||
|
|
|
@ -1067,6 +1067,11 @@ module = {
|
||||||
enable = videomodules;
|
enable = videomodules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module = {
|
||||||
|
name = procfs;
|
||||||
|
common = fs/proc.c;
|
||||||
|
};
|
||||||
|
|
||||||
module = {
|
module = {
|
||||||
name = affs;
|
name = affs;
|
||||||
common = fs/affs.c;
|
common = fs/affs.c;
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/fs.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
#include <grub/procfs.h>
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -403,6 +406,8 @@ grub_cryptodisk_setkey (grub_cryptodisk_t dev, grub_uint8_t *key, grub_size_t ke
|
||||||
err = grub_crypto_cipher_set_key (dev->cipher, key, real_keysize);
|
err = grub_crypto_cipher_set_key (dev->cipher, key, real_keysize);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
grub_memcpy (dev->key, key, keysize);
|
||||||
|
dev->keysize = keysize;
|
||||||
|
|
||||||
/* Configure ESSIV if necessary. */
|
/* Configure ESSIV if necessary. */
|
||||||
if (dev->mode_iv == GRUB_CRYPTODISK_MODE_IV_ESSIV)
|
if (dev->mode_iv == GRUB_CRYPTODISK_MODE_IV_ESSIV)
|
||||||
|
@ -979,6 +984,112 @@ static struct grub_disk_dev grub_cryptodisk_dev = {
|
||||||
.next = 0
|
.next = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char
|
||||||
|
hex (grub_uint8_t val)
|
||||||
|
{
|
||||||
|
if (val < 10)
|
||||||
|
return '0' + val;
|
||||||
|
return 'a' + val - 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open a file named NAME and initialize FILE. */
|
||||||
|
static char *
|
||||||
|
luks_script_get (void)
|
||||||
|
{
|
||||||
|
grub_cryptodisk_t i;
|
||||||
|
grub_size_t size = 0;
|
||||||
|
char *ptr, *ret;
|
||||||
|
|
||||||
|
for (i = cryptodisk_list; i != NULL; i = i->next)
|
||||||
|
if (grub_strcmp (i->modname, "luks") == 0)
|
||||||
|
{
|
||||||
|
size += sizeof ("luks_mount ");
|
||||||
|
size += grub_strlen (i->uuid);
|
||||||
|
size += grub_strlen (i->cipher->cipher->name);
|
||||||
|
size += 54;
|
||||||
|
if (i->essiv_hash)
|
||||||
|
size += grub_strlen (i->essiv_hash->name);
|
||||||
|
size += i->keysize * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = grub_malloc (size + 1);
|
||||||
|
if (!ret)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ptr = ret;
|
||||||
|
|
||||||
|
for (i = cryptodisk_list; i != NULL; i = i->next)
|
||||||
|
if (grub_strcmp (i->modname, "luks") == 0)
|
||||||
|
{
|
||||||
|
unsigned j;
|
||||||
|
const char *iptr;
|
||||||
|
ptr = grub_stpcpy (ptr, "luks_mount ");
|
||||||
|
ptr = grub_stpcpy (ptr, i->uuid);
|
||||||
|
*ptr++ = ' ';
|
||||||
|
grub_snprintf (ptr, 21, "%" PRIuGRUB_UINT64_T " ", i->offset);
|
||||||
|
while (*ptr)
|
||||||
|
ptr++;
|
||||||
|
for (iptr = i->cipher->cipher->name; *iptr; iptr++)
|
||||||
|
*ptr++ = grub_tolower (*iptr);
|
||||||
|
switch (i->mode)
|
||||||
|
{
|
||||||
|
case GRUB_CRYPTODISK_MODE_ECB:
|
||||||
|
ptr = grub_stpcpy (ptr, "-ecb");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_CBC:
|
||||||
|
ptr = grub_stpcpy (ptr, "-cbc");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_PCBC:
|
||||||
|
ptr = grub_stpcpy (ptr, "-pcbc");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_XTS:
|
||||||
|
ptr = grub_stpcpy (ptr, "-xts");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_LRW:
|
||||||
|
ptr = grub_stpcpy (ptr, "-lrw");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (i->mode_iv)
|
||||||
|
{
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_NULL:
|
||||||
|
ptr = grub_stpcpy (ptr, "-null");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_PLAIN:
|
||||||
|
ptr = grub_stpcpy (ptr, "-plain");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_PLAIN64:
|
||||||
|
ptr = grub_stpcpy (ptr, "-plain64");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_BENBI:
|
||||||
|
ptr = grub_stpcpy (ptr, "-benbi");
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_ESSIV:
|
||||||
|
ptr = grub_stpcpy (ptr, "-essiv:");
|
||||||
|
ptr = grub_stpcpy (ptr, i->essiv_hash->name);
|
||||||
|
break;
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64:
|
||||||
|
case GRUB_CRYPTODISK_MODE_IV_BYTECOUNT64_HASH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*ptr++ = ' ';
|
||||||
|
for (j = 0; j < i->keysize; j++)
|
||||||
|
{
|
||||||
|
*ptr++ = hex (i->key[j] >> 4);
|
||||||
|
*ptr++ = hex (i->key[j] & 0xf);
|
||||||
|
}
|
||||||
|
*ptr++ = '\n';
|
||||||
|
}
|
||||||
|
*ptr = '\0';
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct grub_procfs_entry luks_script =
|
||||||
|
{
|
||||||
|
.name = "luks_script",
|
||||||
|
.get_contents = luks_script_get
|
||||||
|
};
|
||||||
|
|
||||||
static grub_extcmd_t cmd;
|
static grub_extcmd_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT (cryptodisk)
|
GRUB_MOD_INIT (cryptodisk)
|
||||||
|
@ -987,10 +1098,12 @@ GRUB_MOD_INIT (cryptodisk)
|
||||||
cmd = grub_register_extcmd ("cryptomount", grub_cmd_cryptomount, 0,
|
cmd = grub_register_extcmd ("cryptomount", grub_cmd_cryptomount, 0,
|
||||||
N_("SOURCE|-u UUID|-a|-b"),
|
N_("SOURCE|-u UUID|-a|-b"),
|
||||||
N_("Mount a crypto device."), options);
|
N_("Mount a crypto device."), options);
|
||||||
|
grub_procfs_register ("luks_script", &luks_script);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI (cryptodisk)
|
GRUB_MOD_FINI (cryptodisk)
|
||||||
{
|
{
|
||||||
grub_disk_dev_unregister (&grub_cryptodisk_dev);
|
grub_disk_dev_unregister (&grub_cryptodisk_dev);
|
||||||
cryptodisk_cleanup ();
|
cryptodisk_cleanup ();
|
||||||
|
grub_procfs_unregister (&luks_script);
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,9 +381,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||||
newdev->rekey_shift = 20;
|
newdev->rekey_shift = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
|
||||||
newdev->modname = "geli";
|
newdev->modname = "geli";
|
||||||
#endif
|
|
||||||
|
|
||||||
newdev->total_length = grub_disk_get_size (disk) - 1;
|
newdev->total_length = grub_disk_get_size (disk) - 1;
|
||||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||||
|
|
|
@ -290,9 +290,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||||
newdev->log_sector_size = 9;
|
newdev->log_sector_size = 9;
|
||||||
newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
|
newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
|
||||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||||
#ifdef GRUB_UTIL
|
|
||||||
newdev->modname = "luks";
|
newdev->modname = "luks";
|
||||||
#endif
|
|
||||||
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= sizeof (uuid));
|
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= sizeof (uuid));
|
||||||
return newdev;
|
return newdev;
|
||||||
}
|
}
|
||||||
|
|
172
grub-core/fs/proc.c
Normal file
172
grub-core/fs/proc.c
Normal file
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/procfs.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
#include <grub/fs.h>
|
||||||
|
#include <grub/file.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
struct grub_procfs_entry *grub_procfs_entries;
|
||||||
|
|
||||||
|
static int
|
||||||
|
grub_procdev_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
|
||||||
|
grub_disk_pull_t pull)
|
||||||
|
{
|
||||||
|
if (pull != GRUB_DISK_PULL_NONE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return hook ("proc", hook_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procdev_open (const char *name, grub_disk_t disk)
|
||||||
|
{
|
||||||
|
if (grub_strcmp (name, "proc"))
|
||||||
|
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a procfs disk");
|
||||||
|
|
||||||
|
disk->total_sectors = 0;
|
||||||
|
disk->id = (unsigned long) "proc";
|
||||||
|
|
||||||
|
disk->data = 0;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_procdev_close (grub_disk_t disk __attribute((unused)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procdev_read (grub_disk_t disk __attribute((unused)),
|
||||||
|
grub_disk_addr_t sector __attribute((unused)),
|
||||||
|
grub_size_t size __attribute((unused)),
|
||||||
|
char *buf __attribute((unused)))
|
||||||
|
{
|
||||||
|
return GRUB_ERR_OUT_OF_RANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procdev_write (grub_disk_t disk __attribute ((unused)),
|
||||||
|
grub_disk_addr_t sector __attribute ((unused)),
|
||||||
|
grub_size_t size __attribute ((unused)),
|
||||||
|
const char *buf __attribute ((unused)))
|
||||||
|
{
|
||||||
|
return GRUB_ERR_OUT_OF_RANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_ssize_t
|
||||||
|
grub_procfs_read (grub_file_t file, char *buf, grub_size_t len)
|
||||||
|
{
|
||||||
|
char *data = file->data;
|
||||||
|
|
||||||
|
grub_memcpy (buf, data + file->offset, len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procfs_close (grub_file_t file)
|
||||||
|
{
|
||||||
|
char *data;
|
||||||
|
|
||||||
|
data = file->data;
|
||||||
|
grub_free (data);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procfs_dir (grub_device_t device, const char *path,
|
||||||
|
grub_fs_dir_hook_t hook, void *hook_data)
|
||||||
|
{
|
||||||
|
const char *ptr;
|
||||||
|
struct grub_dirhook_info info;
|
||||||
|
struct grub_procfs_entry *entry;
|
||||||
|
|
||||||
|
grub_memset (&info, 0, sizeof (info));
|
||||||
|
|
||||||
|
/* Check if the disk is our dummy disk. */
|
||||||
|
if (grub_strcmp (device->disk->name, "proc"))
|
||||||
|
return grub_error (GRUB_ERR_BAD_FS, "not a procfs");
|
||||||
|
for (ptr = path; *ptr == '/'; ptr++);
|
||||||
|
if (*ptr)
|
||||||
|
return 0;
|
||||||
|
FOR_LIST_ELEMENTS((entry), (grub_procfs_entries))
|
||||||
|
if (hook (entry->name, &info, hook_data))
|
||||||
|
return 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_procfs_open (struct grub_file *file, const char *path)
|
||||||
|
{
|
||||||
|
const char *pathptr;
|
||||||
|
struct grub_procfs_entry *entry;
|
||||||
|
|
||||||
|
for (pathptr = path; *pathptr == '/'; pathptr++);
|
||||||
|
|
||||||
|
FOR_LIST_ELEMENTS((entry), (grub_procfs_entries))
|
||||||
|
if (grub_strcmp (pathptr, entry->name) == 0)
|
||||||
|
{
|
||||||
|
file->data = entry->get_contents ();
|
||||||
|
if (!file->data)
|
||||||
|
return grub_errno;
|
||||||
|
file->size = grub_strlen (file->data);
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct grub_disk_dev grub_procfs_dev = {
|
||||||
|
.name = "proc",
|
||||||
|
.id = GRUB_DISK_DEVICE_PROCFS_ID,
|
||||||
|
.iterate = grub_procdev_iterate,
|
||||||
|
.open = grub_procdev_open,
|
||||||
|
.close = grub_procdev_close,
|
||||||
|
.read = grub_procdev_read,
|
||||||
|
.write = grub_procdev_write,
|
||||||
|
.next = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct grub_fs grub_procfs_fs =
|
||||||
|
{
|
||||||
|
.name = "procfs",
|
||||||
|
.dir = grub_procfs_dir,
|
||||||
|
.open = grub_procfs_open,
|
||||||
|
.read = grub_procfs_read,
|
||||||
|
.close = grub_procfs_close,
|
||||||
|
.next = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
GRUB_MOD_INIT (procfs)
|
||||||
|
{
|
||||||
|
grub_disk_dev_register (&grub_procfs_dev);
|
||||||
|
grub_fs_register (&grub_procfs_fs);
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI (procfs)
|
||||||
|
{
|
||||||
|
grub_disk_dev_unregister (&grub_procfs_dev);
|
||||||
|
grub_fs_unregister (&grub_procfs_fs);
|
||||||
|
}
|
|
@ -49,6 +49,7 @@ typedef enum
|
||||||
#define GRUB_CRYPTODISK_GF_SIZE (1U << GRUB_CRYPTODISK_GF_LOG_SIZE)
|
#define GRUB_CRYPTODISK_GF_SIZE (1U << GRUB_CRYPTODISK_GF_LOG_SIZE)
|
||||||
#define GRUB_CRYPTODISK_GF_LOG_BYTES (GRUB_CRYPTODISK_GF_LOG_SIZE - 3)
|
#define GRUB_CRYPTODISK_GF_LOG_BYTES (GRUB_CRYPTODISK_GF_LOG_SIZE - 3)
|
||||||
#define GRUB_CRYPTODISK_GF_BYTES (1U << GRUB_CRYPTODISK_GF_LOG_BYTES)
|
#define GRUB_CRYPTODISK_GF_BYTES (1U << GRUB_CRYPTODISK_GF_LOG_BYTES)
|
||||||
|
#define GRUB_CRYPTODISK_MAX_KEYLEN 128
|
||||||
|
|
||||||
struct grub_cryptodisk;
|
struct grub_cryptodisk;
|
||||||
|
|
||||||
|
@ -80,11 +81,13 @@ struct grub_cryptodisk
|
||||||
grub_uint8_t *lrw_precalc;
|
grub_uint8_t *lrw_precalc;
|
||||||
grub_uint8_t iv_prefix[64];
|
grub_uint8_t iv_prefix[64];
|
||||||
grub_size_t iv_prefix_len;
|
grub_size_t iv_prefix_len;
|
||||||
|
grub_uint8_t key[GRUB_CRYPTODISK_MAX_KEYLEN];
|
||||||
|
grub_size_t keysize;
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
char *cheat;
|
char *cheat;
|
||||||
const char *modname;
|
|
||||||
int cheat_fd;
|
int cheat_fd;
|
||||||
#endif
|
#endif
|
||||||
|
const char *modname;
|
||||||
int log_sector_size;
|
int log_sector_size;
|
||||||
grub_cryptodisk_rekey_func_t rekey;
|
grub_cryptodisk_rekey_func_t rekey;
|
||||||
int rekey_shift;
|
int rekey_shift;
|
||||||
|
|
|
@ -43,6 +43,7 @@ enum grub_disk_dev_id
|
||||||
GRUB_DISK_DEVICE_CRYPTODISK_ID,
|
GRUB_DISK_DEVICE_CRYPTODISK_ID,
|
||||||
GRUB_DISK_DEVICE_ARCDISK_ID,
|
GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||||
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
GRUB_DISK_DEVICE_HOSTDISK_ID,
|
||||||
|
GRUB_DISK_DEVICE_PROCFS_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_disk;
|
struct grub_disk;
|
||||||
|
|
50
include/grub/procfs.h
Normal file
50
include/grub/procfs.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2013 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRUB_PROCFS_HEADER
|
||||||
|
#define GRUB_PROCFS_HEADER 1
|
||||||
|
|
||||||
|
#include <grub/list.h>
|
||||||
|
|
||||||
|
struct grub_procfs_entry
|
||||||
|
{
|
||||||
|
struct grub_procfs_entry *next;
|
||||||
|
struct grub_procfs_entry **prev;
|
||||||
|
|
||||||
|
const char *name;
|
||||||
|
char * (*get_contents) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct grub_procfs_entry *grub_procfs_entries;
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_procfs_register (const char *name __attribute__ ((unused)),
|
||||||
|
struct grub_procfs_entry *entry)
|
||||||
|
{
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_procfs_entries),
|
||||||
|
GRUB_AS_LIST (entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_procfs_unregister (struct grub_procfs_entry *entry)
|
||||||
|
{
|
||||||
|
grub_list_remove (GRUB_AS_LIST (entry));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue