Commit graph

43 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
b7f3ac299d * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Remove
disk_info_msg (conflicts with gettexting into languages with cases).
2010-04-10 20:28:25 +02:00
Grégoire Sutre
2c7031b135 Add grub-probe support for NetBSD.
* util/getroot.c (find_root_device): Convert block device to
	character device on NetBSD.
	* util/probe.c (probe): Require character device on NetBSD.
	* util/hostdisk.c: NetBSD specific headers.
	(configure_device_driver): new function to tune device driver
	parameters (currently only for NetBSD floppy driver).
	(grub_util_biosdisk_open): NetBSD specific code (get disk size
	via disklabel ioctl).
	(open_device): call configure_device_driver on NetBSD.
	(convert_system_partition_to_system_disk): NetBSD specific code.
	(device_is_wholedisk): Likewise.
	(grub_util_biosdisk_get_grub_dev): Likewise.
	(make_device_name): Fixed a typo in bsd_part_str.
	* configure.ac: check for opendisk() and getrawpartition() on
	NetBSD and set LIBUTIL.
	* Makefile.in: add LIBUTIL to LIBS.
2010-04-10 17:07:33 +02:00
Vladimir 'phcoder' Serbinenko
a29e902132 Merge mainline into emu-modload 2010-04-10 01:25:46 +02:00
Vladimir 'phcoder' Serbinenko
c9ea504d25 merge mainline into nestpart 2010-03-26 15:44:13 +01:00
Colin Watson
08e46ededa Speed up consecutive hostdisk operations on the same device.
* util/hostdisk.c (struct grub_util_biosdisk_data): New structure.
(grub_util_biosdisk_open): Initialise disk->data.
(struct linux_partition_cache): New structure.
(linux_find_partition): Cache partition start positions; these are
expensive to compute on every read and write.
(open_device): Cache open file descriptor in disk->data, so that we
don't have to reopen it and flush the buffer cache for consecutive
operations on the same device.
(grub_util_biosdisk_close): New function.
(grub_util_biosdisk_dev): Set `close' member.

* conf/common.rmk (grub_probe_SOURCES): Add kern/list.c.
* conf/i386-efi.rmk (grub_setup_SOURCES): Likewise.
* conf/i386-pc.rmk (grub_setup_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_setup_SOURCES): Likewise.
2010-03-14 15:39:14 +00:00
Colin Watson
c6293875f9 reopen device when the requested access mode changes 2010-03-03 20:03:50 +00:00
Colin Watson
22d7b6137a 2010-03-03 Colin Watson <cjwatson@ubuntu.com>
* util/hostdisk.c (struct grub_util_biosdisk_data): New structure.
	(grub_util_biosdisk_open): Initialise disk->data.
	(struct linux_partition_cache): New structure.
	(linux_find_partition): Cache partition start positions; these are
	expensive to compute on every read and write.
	(open_device): Cache open file descriptor in disk->data, so that we
	don't have to reopen it and flush the buffer cache for consecutive
	operations on the same device.
	(grub_util_biosdisk_close): New function.
	(grub_util_biosdisk_dev): Set `close' member.

	* conf/common.rmk (grub_probe_SOURCES): Add kern/list.c.
	* conf/i386-efi.rmk (grub_setup_SOURCES): Likewise.
	* conf/i386-pc.rmk (grub_setup_SOURCES): Likewise.
	* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Likewise.
	* conf/x86_64-efi.rmk (grub_setup_SOURCES): Likewise.
2010-03-03 10:44:12 +00:00
Vladimir 'phcoder' Serbinenko
b77ab1aaa9 Merge emu-mod into emu-modload 2010-02-07 17:52:11 +01:00
Vladimir 'phcoder' Serbinenko
a1a8d38a58 Use nostdinc 2010-02-07 17:30:16 +01:00
Vladimir 'phcoder' Serbinenko
3dca5319c6 module support in grub-emu 2010-02-07 16:13:59 +01:00
Vladimir 'phcoder' Serbinenko
74e4934e1c 2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Rename one instance
	of disk to dsk to avoid shadowing.
	(find_free_slot): Fix prototype.
	* util/getroot.c (grub_util_is_dmraid): Make static.
	* include/grub/time.h (grub_get_rtc) [GRUB_MACHINE_EMU || GRUB_UTIL]:
	Add missing prototype.
	* util/sdl.c (grub_video_sdl_set_viewport): Remove.
2010-02-07 02:47:18 +01:00
Vladimir 'phcoder' Serbinenko
f88d801b17 2010-02-07 Vladimir Serbinenko <phcoder@gmail.com>
Fix warnings in grub-emu when compiling with maximum warning options.

	* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Rename one instance
	of disk to dsk to avoid shadowing.
2010-02-07 02:44:47 +01:00
Vladimir 'phcoder' Serbinenko
bc6fcf0931 merge mainline into nestpart 2010-02-06 18:47:17 +01:00
Vladimir 'phcoder' Serbinenko
15cb7d433f Reimport nestpart 2010-02-06 18:43:37 +01:00
Vladimir 'phcoder' Serbinenko
2b4068e992 2010-02-03 Vladimir Serbinenko <phcoder@gmail.com>
* util/hostdisk.c (open_device): Don't use partition device when reading
	before the partition.
	(grub_util_biosdisk_read): Don't read from partition and before the
	partition in single operation.
	(grub_util_biosdisk_write): Don't write to partition and before the
	partition in single operation.
2010-02-03 00:49:35 +01:00
Colin Watson
847effd8bf 2010-01-25 Colin Watson <cjwatson@ubuntu.com>
* util/hostdisk.c (open_device): Add trailing newline to debug
	message.
2010-01-25 17:04:22 +00:00
carles
70a14d3d49 2010-01-16 Carles Pina i Estany <carles@pina.cat>
* util/misc.c (grub_util_warn): Gettextizze, print full stop after
	the message.
	(grub_util_info): Likewise.
	(grub_util_error): Likewise.
	* util/elf/grub-mkimage.c: Fix capitalisation, quotes, full stops
	and/or new lines in `grub_util_warna', `grub_util_info',
	`grub_util_error' calls.
	* util/getroot.c: Likewise.
	* util/grub-editenv.c: Likewise.
	* util/grub-emu.c: Likewise.
	* util/grub-fstest.c: Likewise.
	* util/grub-mkdevicemap.c: Likewise.
	* util/grub-mkfont.c: Likewise.
	* util/grub-mkpasswd-pbkdf2.c: Likewise.
	* util/grub-mkrelpath.c: Likewise.
	* util/grub-pe2elf.c: Likewise.
	* util/grub-probe.c: Likewise.
	* util/hostdisk.c: Likewise.
	* util/i386/efi/grub-mkimage.c: Likewise.
	* util/i386/pc/grub-mkimage.c: Likewise.
	* util/i386/pc/grub-setup.c: Likewise.
	* util/ieee1275/ofpath.c: Likewise.
	* util/mkisofs/eltorito.c: Likewise.
	* util/mkisofs/rock.c: Likewise.
	* util/mkisofs/write.c: Likewise.
	* util/raid.c: Likewise.
	* util/sparc64/ieee1275/grub-mkimage.c: Likewise.
	* util/sparc64/ieee1275/grub-setup.c: Likewise.
2010-01-16 00:26:52 +00:00
Felix Zielcke
0ad46fd771 2009-12-25 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c (open_device): Fix a comment.
2009-12-25 18:29:17 +01:00
Colin Watson
d6ceebf1d9 2009-12-07 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Check for vasprintf.
	* util/misc.c (asprintf): Move allocation from here ...
	(vasprintf): ... to here.  New function.
	(xasprintf): New function.
	* include/grub/util/misc.h (vasprintf, xasprintf): Add
	prototypes.
	* util/getroot.c (grub_util_get_grub_dev): Use xasprintf.
	* util/grub-mkfont.c (write_font): Likewise.
	* util/grub-probe.c (probe): Likewise.
	* util/hostdisk.c (make_device_name): Likewise.
2009-12-07 16:46:24 +00:00
Robert Millan
0fdb256813 2009-11-23 Robert Millan <rmh.grub@aybabtu.com>
* util/hostdisk.c: Include `<grub/i18n.h>'.
        (find_grub_drive): Use ARRAY_SIZE for map size calculation.
        (make_device_name): Rewrite using asprintf.
        (convert_system_partition_to_system_disk): Replace 0 with NULL.
        (find_system_device): If a device is not found, generate one just
        by reusing the OS path name.
        (read_device_map): Make it permissible for device.map not to exist.
2009-11-23 20:30:56 +00:00
robertmh
ff1a9bca3a 2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from
        GNU partition number to get internal GRUB partition number.
2009-11-02 19:14:00 +00:00
fzielcke
5a78865b39 2009-09-21 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c: Fix a comment.
2009-09-21 14:03:11 +00:00
phcoder
2d21e3e8e0 2009-08-24 Vladimir Serbinenko <phcoder@gmail.com>
Rename *_partition_map to part_*

	* partmap/acorn.c (grub_acorn_partition_map): Set name to 'part_acorn'.
	* partmap/amiga.c (grub_amiga_partition_map): Set name to 'part_amiga'.
	* partmap/apple.c (grub_apple_partition_map): Set name to 'part_apple'.
	* partmap/gpt.c (grub_gpt_partition_map): Set name to 'part_gpt'.
	All users updated.
	* partmap/msdos.c (grub_msdos_partition_map): Set name to 'part_msdos'.
	All users updated.
	* partmap/sun.c (grub_sun_partition_map): Set name to 'part_sun'.
	* util/grub-probe.c (probe_partmap): Don't transform partition name
	to get module name.
2009-08-24 13:34:03 +00:00
robertmh
71acf5e54b 2009-08-23 Robert Millan <rmh.grub@aybabtu.com>
* partmap/pc.c: Rename to ...
        * partmap/msdos.c: ... this.  Update all users.
        (grub_pc_partition_map): Rename to ...
        (grub_msdos_partition_map): ... this.  Update all users.

        * parttool/pcpart.c: Rename to ...
        * parttool/msdospart.c: ... this.  Update all users.

        * include/grub/pc_partition.h: Rename to ...
        * include/grub/msdos_partition.h: ... this.  Update all users.
        (grub_pc_partition_bsd_entry): Rename to ...
        (grub_msdos_partition_bsd_entry): ... this.  Update all users.
        (grub_pc_partition_disk_label): Rename to ...
        (grub_msdos_partition_disk_label): ... this.  Update all users.
        (grub_pc_partition_entry): Rename to ...
        (grub_msdos_partition_entry): ... this.  Update all users.
        (grub_pc_partition_mbr): Rename to ...
        (grub_msdos_partition_mbr): ... this.  Update all users.
        (grub_pc_partition): Rename to ...
        (grub_msdos_partition): ... this.  Update all users.
        (grub_pc_partition_is_empty): Rename to ...
        (grub_msdos_partition_is_empty): ... this.  Update all users.
        (grub_pc_partition_is_extended): Rename to ...
        (grub_msdos_partition_is_extended): ... this.  Update all users.
        (grub_pc_partition_is_bsd): Rename to ...
        (grub_msdos_partition_is_bsd): ... this.  Update all users.

        * conf/common.rmk (amiga_mod_SOURCES, amiga_mod_CFLAGS)
        (amiga_mod_LDFLAGS, apple_mod_SOURCES, apple_mod_CFLAGS)
        (apple_mod_LDFLAGS, msdos_mod_SOURCES, msdos_mod_CFLAGS)
        (msdos_mod_LDFLAGS, sun_mod_SOURCES, sun_mod_CFLAGS)
        (sun_mod_LDFLAGS, acorn_mod_SOURCES, acorn_mod_CFLAGS)
        (acorn_mod_LDFLAGS, gpt_mod_SOURCES, gpt_mod_CFLAGS)
        (gpt_mod_LDFLAGS): Rename to ...
        (part_amiga_mod_SOURCES, part_amiga_mod_CFLAGS, part_amiga_mod_LDFLAGS)
        (part_apple_mod_SOURCES, part_apple_mod_CFLAGS, part_apple_mod_LDFLAGS)
        (part_msdos_mod_SOURCES, part_msdos_mod_CFLAGS, part_msdos_mod_LDFLAGS)
        (part_sun_mod_SOURCES, part_sun_mod_CFLAGS, part_sun_mod_LDFLAGS)
        (part_acorn_mod_SOURCES, part_acorn_mod_CFLAGS, part_acorn_mod_LDFLAGS)
        (part_gpt_mod_SOURCES, part_gpt_mod_CFLAGS)
        (part_gpt_mod_LDFLAGS): ... this.
        (pkglib_MODULES): Prefix partition modules with `part_'.  Rename
        `pcpart.mod' to `msdospart.mod'.
        (pcpart_mod_SOURCES, pcpart_mod_CFLAGS, pcpart_mod_LDFLAGS): Rename
        to ...
        (msdospart_mod_SOURCES, msdospart_mod_CFLAGS)
        (msdospart_mod_LDFLAGS): ... this.
2009-08-23 12:00:57 +00:00
fzielcke
67bb323a1c 2009-07-29 Felix Zielcke <fzielcke@z-51.de>
* util/deviceiter.c (get_acceleraid_disk_name): New static
	function.
	(grub_util_iterate_devices): Handle Accelraid devices.
	* util/hostdisk.c (convert_system_partition_to_system_disk): Likewise.
2009-07-29 14:11:50 +00:00
proski
4f253044ec 2009-07-19 Yves BLUSSEAU <yves.grub-devel@zetam.org>
* util/getroot.c (find_root_device): Add support for MacOSX.
	* util/hostdisk.c: Likewise.
2009-07-20 20:03:18 +00:00
proski
d23af54ef4 2009-07-01 Pavel Roskin <proski@gnu.org>
* util/hostdisk.c (open_device): Remove `const' from
	`sysctl_size', as sysctlbyname() can change it (in this case it
	doesn't actually happen).
2009-07-01 23:58:30 +00:00
proski
c6cd3ef022 2009-07-01 Pavel Roskin <proski@gnu.org>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Make `p'
	constant to avoid a warning on FreeBSD.
2009-07-01 23:07:17 +00:00
proski
0df634200a 2009-07-01 Pavel Roskin <proski@gnu.org>
* util/hostdisk.c (device_is_wholedisk): Compile only on systems
	where it's needed.
2009-07-01 22:56:51 +00:00
fzielcke
b39f9d20a9 remove all trailing whitespace 2009-06-10 21:04:23 +00:00
phcoder
4c9ec6b3fc 2009-06-08 Vladimir Serbinenko <phcoder@gmail.com>
Bugfix: install on partitionless device

	* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): check if os_dev
	is a whole disk
2009-06-08 13:04:02 +00:00
davem
ad22a610fe * util/hostdisk.c (device_is_wholedisk): New function.
(grub_util_biosdisk_get_grub_dev): Shortcut when hdg.start is
	zero only if device_is_wholedisk() returns true.
2009-04-30 13:23:48 +00:00
davem
6966215ddb * util/hostdisk.c (convert_system_partition_to_system_disk):
Handle virtual disk devices named /dev/vdiskX as found on sparc
	and powerpc.
2009-04-30 13:21:14 +00:00
proski
41bb0fe9a6 2009-04-15 Pavel Roskin <proski@gnu.org>
* include/grub/types.h: Rename ULONG_MAX to GRUB_ULONG_MAX and
	LONG_MAX to GRUB_LONG_MAX.  Introduce GRUB_LONG_MIN.  Update all
	users of ULONG_MAX, LONG_MAX and LONG_MIN to use the new
	definitions.
2009-04-15 20:45:09 +00:00
davem
5c5bf96ae6 * util/hostdisk.c (make_device_name): Fix buffer length
calculations.
2009-04-14 09:07:25 +00:00
fzielcke
e25b5a8c6c 2009-04-14 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c [__FreeBSD__ || __FreeBSD_kernel__]: Include
	<sys/param.h> and <sys/sysctl.h>.
	(open_device) [__FreeBSD__ || __FreeBSD_kernel_]: Use sysctlgetbyname()
	to add 0x10 to `kern.geom.debugflags' if it's not already set, before
	opening the device and reset them afterwards.
2009-04-14 07:01:34 +00:00
davem
6a4737e5d8 * util/hostdisk.c (make_device_name): Do not make any assumptions
about the length of drive names.
2009-04-13 23:01:54 +00:00
fzielcke
c91e1793bf 2009-04-11 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c [__FreeBSD_kernel__]: Include sys/disk.h.
	(grub_util_biosdisk_open) [__FreeBSD_kernel__]: Add support for
	GNU/kFreeBSD. Check if a device is a character device. Use
	DIOCGMEDIASIZE to get the size.
	(convert_system_partition_to_system_disk) [__FreeBSD_kernel__]: Add
	support for GNU/kFreeBSD.
	(grub_util_biosdisk_get_grub_dev) [__FreeBSD_kernel__]: Check if OS_DEV
	is a character device instead of a block device. Add support for
	FreeBSD device names.

	* util/getroot.c (find_root_device) [__FreeBSD_kernel__]: Check if ENT
	is a character device instead of a block device.

	* util/grub-probe.c (probe) [__FreeBSD_kernel__]: Check if DEVICE_NAME
	is a character device instead of a block device.
2009-04-11 18:46:12 +00:00
okuji
b1ac86445e 2009-04-11 Andrey Shuvikov <mr_hyro@yahoo.com>
* util/hostdisk.c [__FreeBSD__]: Include sys/disk.h.
    (grub_util_biosdisk_open) [__FreeBSD__]: Add support for
    FreeBSD. Check if a device is a character device. Use
    DIOCGMEDIASIZE to get the size.
    (convert_system_partition_to_system_disk) [__FreeBSD__]: Add
    support for FreeBSD.
    (grub_util_biosdisk_get_grub_dev) [__FreeBSD__]: Check if OS_DEV
    is a character device instead of a block device. Add support for
    FreeBSD device names.

    * util/getroot.c (find_root_device) [__FreeBSD__]: Check if ENT is
    a character device instead of a block device.
    (grub_util_check_char_device): New function.

    * util/grub-probe.c (probe) [__FreeBSD__]: Check if DEVICE_NAME is
    a character device instead of a block device.

    * include/grub/util/getroot.h (grub_util_check_char_device): New
    prototype.
2009-04-11 09:40:39 +00:00
bean
1f4147aaf0 2009-03-21 Bean <bean123ch@gmail.com>
* util/hostdisk.c (read_device_map): Use grub_util_get_disk_size
	instead of stat in mingw environment.

	* util/misc.c (grub_millisleep): Use Sleep in mingw environment.

	* aclocal.m4 (grub_CHECK_LINK_DIR): New function.

	* configure.ac: Use grub_CHECK_LINK_DIR to determine whether to use
	AC_CONFIG_LINKS.
2009-03-21 07:48:28 +00:00
fzielcke
7fd75377be 2008-09-09 Felix Zielcke <fzielcke@z-51.de>
* util/hostdisk.c: Change #include <grub/util/biosdisk.h> to
        #include <grub/util/hostdisk.h>.
2008-09-09 07:28:17 +00:00
robertmh
40da438f10 2008-09-08 Robert Millan <rmh@aybabtu.com>
* util/hostdisk.c (open_device): Replace a grub_util_info() call
        with grub_dprintf("hostdisk", ...), as it was so verbose that it
        clobbered useful information.
2008-09-08 14:00:29 +00:00
robertmh
ddbf5556a7 2008-09-08 Robert Millan <rmh@aybabtu.com>
* include/grub/util/biosdisk.h: Move to ...
        * include/grub/util/hostdisk.h: ... here.  Update all users.
        * util/biosdisk.c: Move to ...
        * util/hostdisk.c: ... here.  Update all users.
2008-09-08 13:52:30 +00:00
Renamed from util/biosdisk.c (Browse further)