Indentation fix, cleanup.
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / disk / host.c
blob76ef1afb8569dd4e7b79a99dff59bb9e5f3ac524
1 /* host.c - Dummy disk driver to provide access to the hosts filesystem */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2007 Free Software Foundation, Inc.
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.
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.
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/>.
20 /* When using the disk, make a reference to this module. Otherwise
21 the user will end up with a useless module :-). */
23 #include <config.h>
24 #include <config-util.h>
26 #include <grub/dl.h>
27 #include <grub/disk.h>
28 #include <grub/misc.h>
29 #include <grub/emu/hostdisk.h>
31 int grub_disk_host_i_want_a_reference;
33 static int
34 grub_host_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
35 grub_disk_pull_t pull)
37 if (pull != GRUB_DISK_PULL_NONE)
38 return 0;
40 if (hook ("host", hook_data))
41 return 1;
42 return 0;
45 static grub_err_t
46 grub_host_open (const char *name, grub_disk_t disk)
48 if (grub_strcmp (name, "host"))
49 return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a host disk");
51 disk->total_sectors = 0;
52 disk->id = 0;
54 disk->data = 0;
56 return GRUB_ERR_NONE;
59 static void
60 grub_host_close (grub_disk_t disk __attribute((unused)))
64 static grub_err_t
65 grub_host_read (grub_disk_t disk __attribute((unused)),
66 grub_disk_addr_t sector __attribute((unused)),
67 grub_size_t size __attribute((unused)),
68 char *buf __attribute((unused)))
70 return GRUB_ERR_OUT_OF_RANGE;
73 static grub_err_t
74 grub_host_write (grub_disk_t disk __attribute ((unused)),
75 grub_disk_addr_t sector __attribute ((unused)),
76 grub_size_t size __attribute ((unused)),
77 const char *buf __attribute ((unused)))
79 return GRUB_ERR_OUT_OF_RANGE;
82 static struct grub_disk_dev grub_host_dev =
84 /* The only important line in this file :-) */
85 .name = "host",
86 .id = GRUB_DISK_DEVICE_HOST_ID,
87 .iterate = grub_host_iterate,
88 .open = grub_host_open,
89 .close = grub_host_close,
90 .read = grub_host_read,
91 .write = grub_host_write,
92 .next = 0
95 GRUB_MOD_INIT(host)
97 grub_disk_dev_register (&grub_host_dev);
100 GRUB_MOD_FINI(host)
102 grub_disk_dev_unregister (&grub_host_dev);