diff --git a/ChangeLog b/ChangeLog index 70ff1c0f4..deaba664e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-08 Vladimir Serbinenko + + Move OS-dependent files to grub-core/osdep and document it. + 2013-10-08 Vladimir Serbinenko * grub-core/kern/emu/misc.c (canonicalize_file_name): Move to ... diff --git a/Makefile.util.def b/Makefile.util.def index 710be2f28..813110832 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -10,13 +10,13 @@ library = { common = grub-core/kern/device.c; common = grub-core/kern/disk.c; common = util/getroot.c; - common = util/getroot_unix.c; - common = util/getroot_os.c; - common = util/getroot_devmapper.c; + common = grub-core/osdep/unix/getroot.c; + common = grub-core/osdep/getroot.c; + common = grub-core/osdep/devmapper/getroot.c; common = grub-core/kern/emu/hostdisk.c; - common = grub-core/kern/emu/hostdisk_devmapper.c; - common = grub-core/kern/emu/hostdisk_os.c; - common = grub-core/kern/emu/hostdisk_unix.c; + common = grub-core/osdep/devmapper/hostdisk.c; + common = grub-core/osdep/hostdisk.c; + common = grub-core/osdep/unix/hostdisk.c; common = grub-core/kern/emu/misc.c; common = grub-core/kern/emu/mm.c; common = grub-core/kern/env.c; @@ -221,7 +221,7 @@ program = { common = util/grub-mkpasswd-pbkdf2.c; common = grub-core/kern/emu/argp_common.c; - common = util/random.c; + common = grub-core/osdep/random.c; ldadd = libgrubmods.a; ldadd = libgrubgcry.a; diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi index 53f70108b..9499f8bc4 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -286,14 +286,19 @@ live under @file{grub-core/term/}. @item The @samp{efiemu_*} commands live under @file{grub-core/efiemu/}. + +@item +OS-dependent code should be under @file{grub-core/osdep/} + +@item +Utility programs meant to be run from a full operating system +(except OS-dependent code mentioned previously) are in @file{util/}. + @end itemize There are a few other special-purpose exceptions; grep for them if they matter to you. -Utility programs meant to be run from a full operating system are in -@file{util/}. - @node Contributing Changes @chapter Contributing changes @c By YoshinoriOkuji, VesaJääskeläinen, ColinWatson diff --git a/util/getroot_apple.c b/grub-core/osdep/apple/getroot.c similarity index 100% rename from util/getroot_apple.c rename to grub-core/osdep/apple/getroot.c diff --git a/grub-core/kern/emu/hostdisk_apple.c b/grub-core/osdep/apple/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_apple.c rename to grub-core/osdep/apple/hostdisk.c diff --git a/util/getroot_aros.c b/grub-core/osdep/aros/getroot.c similarity index 100% rename from util/getroot_aros.c rename to grub-core/osdep/aros/getroot.c diff --git a/grub-core/kern/emu/hostdisk_aros.c b/grub-core/osdep/aros/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_aros.c rename to grub-core/osdep/aros/hostdisk.c diff --git a/util/getroot_basic.c b/grub-core/osdep/basic/getroot.c similarity index 100% rename from util/getroot_basic.c rename to grub-core/osdep/basic/getroot.c diff --git a/grub-core/kern/emu/hostdisk_basic.c b/grub-core/osdep/basic/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_basic.c rename to grub-core/osdep/basic/hostdisk.c diff --git a/util/getroot_bsd.c b/grub-core/osdep/bsd/getroot.c similarity index 100% rename from util/getroot_bsd.c rename to grub-core/osdep/bsd/getroot.c diff --git a/grub-core/kern/emu/hostdisk_bsd.c b/grub-core/osdep/bsd/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_bsd.c rename to grub-core/osdep/bsd/hostdisk.c diff --git a/util/getroot_devmapper.c b/grub-core/osdep/devmapper/getroot.c similarity index 100% rename from util/getroot_devmapper.c rename to grub-core/osdep/devmapper/getroot.c diff --git a/grub-core/kern/emu/hostdisk_devmapper.c b/grub-core/osdep/devmapper/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_devmapper.c rename to grub-core/osdep/devmapper/hostdisk.c diff --git a/util/getroot_freebsd.c b/grub-core/osdep/freebsd/getroot.c similarity index 100% rename from util/getroot_freebsd.c rename to grub-core/osdep/freebsd/getroot.c diff --git a/grub-core/kern/emu/hostdisk_freebsd.c b/grub-core/osdep/freebsd/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_freebsd.c rename to grub-core/osdep/freebsd/hostdisk.c diff --git a/util/getroot_os.c b/grub-core/osdep/getroot.c similarity index 62% rename from util/getroot_os.c rename to grub-core/osdep/getroot.c index ed20e5f31..6392a29d1 100644 --- a/util/getroot_os.c +++ b/grub-core/osdep/getroot.c @@ -1,20 +1,20 @@ #ifdef __linux__ -#include "getroot_linux.c" +#include "linux/getroot.c" #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include "getroot_freebsd.c" +#include "freebsd/getroot.c" #elif defined(__NetBSD__) || defined(__OpenBSD__) -#include "getroot_bsd.c" +#include "bsd/getroot.c" #elif defined(__APPLE__) -#include "getroot_apple.c" +#include "apple/getroot.c" #elif defined(__sun__) -#include "getroot_sun.c" +#include "sun/getroot.c" #elif defined(__GNU__) -#include "getroot_hurd.c" +#include "hurd/getroot.c" #elif defined(__CYGWIN__) || defined (__MINGW32__) -#include "getroot_windows.c" +#include "windows/getroot.c" #elif defined(__AROS__) -#include "getroot_aros.c" +#include "aros/getroot.c" #else # warning "No getroot OS-specific functions is available for your system. Device detection may not work properly." -#include "getroot_basic.c" +#include "basic/getroot.c" #endif diff --git a/grub-core/kern/emu/hostdisk_os.c b/grub-core/osdep/hostdisk.c similarity index 61% rename from grub-core/kern/emu/hostdisk_os.c rename to grub-core/osdep/hostdisk.c index 904ab0d38..ae491b5bf 100644 --- a/grub-core/kern/emu/hostdisk_os.c +++ b/grub-core/osdep/hostdisk.c @@ -1,20 +1,20 @@ #ifdef __linux__ -#include "hostdisk_linux.c" +#include "linux/hostdisk.c" #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include "hostdisk_freebsd.c" +#include "freebsd/hostdisk.c" #elif defined(__NetBSD__) || defined(__OpenBSD__) -#include "hostdisk_bsd.c" +#include "bsd/hostdisk.c" #elif defined(__APPLE__) -#include "hostdisk_apple.c" +#include "apple/hostdisk.c" #elif defined(__sun__) -#include "hostdisk_sun.c" +#include "sun/hostdisk.c" #elif defined(__GNU__) -#include "hostdisk_hurd.c" +#include "hurd/hostdisk.c" #elif defined(__CYGWIN__) || defined(__MINGW32__) -#include "hostdisk_windows.c" +#include "windows/hostdisk.c" #elif defined(__AROS__) -#include "hostdisk_aros.c" +#include "aros/hostdisk.c" #else # warning "No hostdisk OS-specific functions is available for your system. Device detection may not work properly." -#include "hostdisk_basic.c" +#include "basic/hostdisk.c" #endif diff --git a/util/getroot_hurd.c b/grub-core/osdep/hurd/getroot.c similarity index 100% rename from util/getroot_hurd.c rename to grub-core/osdep/hurd/getroot.c diff --git a/grub-core/kern/emu/hostdisk_hurd.c b/grub-core/osdep/hurd/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_hurd.c rename to grub-core/osdep/hurd/hostdisk.c diff --git a/util/getroot_linux.c b/grub-core/osdep/linux/getroot.c similarity index 100% rename from util/getroot_linux.c rename to grub-core/osdep/linux/getroot.c diff --git a/grub-core/kern/emu/hostdisk_linux.c b/grub-core/osdep/linux/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_linux.c rename to grub-core/osdep/linux/hostdisk.c diff --git a/util/random.c b/grub-core/osdep/random.c similarity index 52% rename from util/random.c rename to grub-core/osdep/random.c index 8ace0e402..355c11254 100644 --- a/util/random.c +++ b/grub-core/osdep/random.c @@ -1,5 +1,5 @@ #if defined (_WIN32) || defined (__CYGWIN__) -#include "random_windows.c" +#include "windows/random.c" #else -#include "random_unix.c" +#include "unix/random.c" #endif diff --git a/util/getroot_sun.c b/grub-core/osdep/sun/getroot.c similarity index 100% rename from util/getroot_sun.c rename to grub-core/osdep/sun/getroot.c diff --git a/grub-core/kern/emu/hostdisk_sun.c b/grub-core/osdep/sun/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_sun.c rename to grub-core/osdep/sun/hostdisk.c diff --git a/util/getroot_unix.c b/grub-core/osdep/unix/getroot.c similarity index 100% rename from util/getroot_unix.c rename to grub-core/osdep/unix/getroot.c diff --git a/grub-core/kern/emu/hostdisk_unix.c b/grub-core/osdep/unix/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_unix.c rename to grub-core/osdep/unix/hostdisk.c diff --git a/util/random_unix.c b/grub-core/osdep/unix/random.c similarity index 100% rename from util/random_unix.c rename to grub-core/osdep/unix/random.c diff --git a/util/getroot_windows.c b/grub-core/osdep/windows/getroot.c similarity index 100% rename from util/getroot_windows.c rename to grub-core/osdep/windows/getroot.c diff --git a/grub-core/kern/emu/hostdisk_windows.c b/grub-core/osdep/windows/hostdisk.c similarity index 100% rename from grub-core/kern/emu/hostdisk_windows.c rename to grub-core/osdep/windows/hostdisk.c diff --git a/util/random_windows.c b/grub-core/osdep/windows/random.c similarity index 100% rename from util/random_windows.c rename to grub-core/osdep/windows/random.c