Andrei Borzenkov
f826d914e2
grub-probe: fix memory leak
...
Found by: Coverity scan.
CID: 73783
2016-01-16 21:47:28 +03:00
Andrei Borzenkov
d5cc487d39
grub-probe: fix memory leak
...
Found by: Coverity scan.
CID: 73783
2016-01-09 13:55:28 +03:00
Andrei Borzenkov
4358e0c81e
grub-probe: fix memory leak in probe (ofpath)
...
Found by: Coverity scan.
CID: 73772
2015-06-19 20:47:44 +03:00
Andrei Borzenkov
03f1f24e37
grub-probe: restructure code to make static analysis easier
...
Current code in probe() could not be verified to not contain memory leaks.
Restructure code and ensure grub_device_close is always called at the end of
loop.
Calms down Coverity scan.
CID: 73739
2015-06-19 20:47:43 +03:00
Vladimir Serbinenko
27d1a67f8a
Fix canonicalize_file_name clash.
...
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Andrei Borzenkov
018f79da6f
grub-probe: free temporary variable
2015-02-28 20:19:57 +03:00
Vladimir Serbinenko
afd6b6bbae
grub-probe: Mark a "[default=]" for translation.
2015-02-28 16:22:46 +01:00
Andrei Borzenkov
11aae26cc3
util/grub-probe: fix memory leaks.
...
Found by: Coverity scan.
2015-01-27 22:11:52 +03:00
Colin Watson
24024dac7f
Fix partmap, cryptodisk, and abstraction handling in grub-mkconfig.
...
Commit 588744d0dc
caused grub-mkconfig
no longer to be forgiving of trailing spaces on grub-probe output
lines, which among other things means that util/grub.d/10_linux.in
no longer detects LVM. To fix this, make grub-probe's output
delimiting more consistent. As a bonus, this improves the coverage
of the -0 option.
Fixes Debian bug #735935 .
* grub-core/disk/cryptodisk.c
(grub_util_cryptodisk_get_abstraction): Add a user-data argument.
* grub-core/disk/diskfilter.c (grub_diskfilter_get_partmap):
Likewise.
* include/grub/cryptodisk.h (grub_util_cryptodisk_get_abstraction):
Update prototype.
* include/grub/diskfilter.h (grub_diskfilter_get_partmap): Likewise.
* util/grub-install.c (push_partmap_module, push_cryptodisk_module,
probe_mods): Adjust for extra user-data arguments.
* util/grub-probe.c (do_print, probe_partmap, probe_cryptodisk_uuid,
probe_abstraction): Use configured delimiter. Update callers.
2014-03-31 14:48:46 +01:00
Colin Watson
9b35fe819f
Fix grub-probe -0 option
...
* util/grub-probe,c (options): Make -0 work again (broken by
conversion to argp).
(main): Simplify logic.
2014-03-31 13:51:17 +01:00
Andrey Borzenkov
46f8d358ef
* util/grub-probe.c: Improve help message and simplify list handling.
2013-12-24 20:30:16 +01:00
Vladimir Serbinenko
ca3e20886e
Build fixes for argp.h with older gcc.
2013-12-21 18:08:25 +01:00
Vladimir Serbinenko
ae558c2ccf
Enable -Wformat=2 if it's supported.
2013-12-21 15:28:28 +01:00
Vladimir Serbinenko
cd46aa6cef
Rewrite grub-install, grub-mkrescue, grub-mkstandalone and grub-mknetdir
...
the function of these files exceeds what can be sanely handled in shell
in posix-comaptible way. Also writing it in C extends the functionality
to non-UNIX-like OS and minimal environments.
2013-11-16 20:21:16 +01:00
Vladimir 'phcoder' Serbinenko
f4e0adc0f9
Remove leftover references to some of the system headers.
2013-10-15 17:59:54 +02:00
Vladimir 'phcoder' Serbinenko
588744d0dc
* util/grub-probe.c (probe): Separate different drives in hint-str
...
by spaces and not newlines.
* util/grub-mkconfig_lib.in: Handle multidevice filesystem.
2013-10-14 18:27:29 +02:00
Vladimir 'phcoder' Serbinenko
ae5540d3d4
Move set_program_name and init_nls to host_init. On windows
...
fix in this fuction console and argument charset as well.
2013-10-13 20:03:42 +02:00
Vladimir 'phcoder' Serbinenko
bf25f87931
Make cryptodisk and diskfilter probe data retrievable programmatically
...
and not just printable.
2013-10-04 01:43:47 +02:00
Paulo Flabiano Smorigo
39cfdaa9a2
* util/grub-install.in: Add GPT PReP support.
...
* util/grub-probe.c (probe): Support GPT partition type.
(main): Support -t gpt_parttype.
2013-09-23 17:42:32 -03:00
Andrey Borzenkov
775b284dd6
* docs/grub.texi (Device syntax): Document new LVM UUID based device
...
names; fix LVM driver name (lvm, not lv).
* util/grub-probe.c (probe_abstraction): Support lvmid/xxx device
names.
2013-09-22 21:35:13 +04:00
Vladimir 'phcoder' Serbinenko
ba44ca6d1a
Replace stpcpy with grub_stpcpy in tools.
2013-04-12 22:37:59 +02:00
Vladimir 'phcoder' Serbinenko
22099030ad
* grub-core/kern/emu/hostdisk.c (read_device_map): Explicitly
...
delimit path in strings using quotes.
* util/getroot.c (grub_guess_root_devices): Likewise.
(grub_make_system_path_relative_to_its_root): Likewise.
* util/grub-probe.c (probe): Likewise.
* util/ieee1275/ofpath.c (find_obppath): Likewise.
(xrealpath): Likewise.
2013-01-13 22:45:16 +01:00
Vladimir 'phcoder' Serbinenko
592fd0e4d6
* grub-core/disk/diskfilter.c (free_array) [GRUB_UTIL]: Fix memory leak.
...
* util/getroot.c (grub_find_device): Likewise.
(get_mdadm_uuid): Likewise.
(grub_util_is_imsm): Likewise.
(grub_util_pull_device): Likewise.
* util/grub-probe.c (probe): Likewise.
2012-09-11 07:53:26 +02:00
Vladimir 'phcoder' Serbinenko
944f752dbb
* util/grub-probe.c (escape_of_path): Fix double free.
2012-06-05 17:16:14 +02:00
Vladimir 'phcoder' Serbinenko
1c715b5afd
* util/grub-probe.c (escape_of_path): Don't add ieee1275/.
...
(probe): Add ieee1275 to OFW devices.
2012-06-05 11:31:10 +02:00
Vladimir 'phcoder' Serbinenko
fe8c2f1117
Use grub-probe and not cmp to check that disk is empty.
...
* util/grub-install.in: Use grub-probe for zero-check.
* util/grub-probe.c (PRINT_ZERO_CHECK): New enum value.
(probe): Handle PRINT_ZERO_CHECK.
(argp_parser): Handle -t zero_check.
2012-05-11 21:07:39 +02:00
Vladimir 'phcoder' Serbinenko
67093bc0ed
Another round of string clarification and adding TRANSLATORS comments.
2012-02-26 17:28:05 +01:00
Vladimir 'phcoder' Serbinenko
4786a90fee
* grub-core/disk/diskfilter.c (grub_diskfilter_print_partmap)
...
[GRUB_UTIL]: New function.
(insert_array) [GRUB_UTIL]: Store partmaps.
* include/grub/diskfilter.h (grub_diskfilter_pv) [GRUB_UTIL]: New member
partmaps.
(grub_diskfilter_print_partmap) [GRUB_UTIL]: New proto.
* util/grub-probe.c (probe_partmap): Call grub_diskfilter_print_partmap.
(probe_abstraction): Print diskfilter and not raid.
Reported by: Lennart Sorensen
2012-02-11 11:57:47 +01:00
Vladimir 'phcoder' Serbinenko
36eb7379b3
* util/grub-probe.c (probe): Don't call gettext on already translated
...
grub_errmsg.
Remove unused variables.
(argp_parser): Remove unused variable.
2012-02-10 12:57:00 +01:00
Vladimir 'phcoder' Serbinenko
0a1e473c9b
* util/grub-probe.c (main): Fix trailing space in compatibility hint.
2012-02-08 20:23:53 +01:00
Vladimir 'phcoder' Serbinenko
9c4b5c13e6
Improve gettext support. Stylistic fixes and error handling fixes while
...
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko
b525fd834d
Clarify and unify messages.
...
* grub-core/commands/hashsum.c (options): Unify messages.
* grub-core/commands/keystatus.c (GRUB_MOD_INIT): Don't mark a
literal-only message as translatable.
* grub-core/commands/lsacpi.c (GRUB_MOD_INIT): Likewise.
* grub-core/loader/ia64/efi/linux.c (GRUB_MOD_INIT): Likewise.
* grub-core/commands/legacycfg.c (GRUB_MOD_INIT): Add quoting around
commands.
* grub-core/commands/menuentry.c (options): Clarify that it's a keyboard
key, not the key used to unlock. Clarify what it's used for.
* grub-core/kern/emu/hostdisk.c (read_device_map): Unify error message.
* grub-core/loader/xnu.c (grub_xnu_load_driver): Remove erroneous colon.
* grub-core/script/main.c (GRUB_MOD_INIT): Clarify [n] to be [NUM].
* util/grub-editenv.c (options): Unify "verbose" message.
* util/grub-fstest.c (read_file): Unify error message.
(fstest): Add quotes around commands.
(options): Unify "verbose" message.
* util/grub-install.in: Add quotes around variable name.
* util/grub-kbdcomp.in: Unify error message.
* util/grub-mkfont.c (main): Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mklayout.c (options): Unify "verbose" message.
* util/grub-mkstandalone.in: Unify help and verbose messages.
* util/grub-mount.c (options): Unify "verbose" message.
* util/grub-probe.c (options): Likewise.
* util/grub-script-check.c (options): Likewise.
* util/grub-setup.c (setup): Unify no-terminator message.
(options): Use DEVICE and not DEV.
Unify "verbose" message.
* util/ieee1275/ofpath.c (xrealpath): Unify error message.
2012-02-05 11:23:47 +01:00
Vladimir 'phcoder' Serbinenko
8be63f2ef6
* Makefile.util.def (grub-mkdevicemap): Removed.
...
* include/grub/emu/hostdisk.h (grub_util_get_os_disk): New proto.
* include/grub/util/deviceiter.h: Removed.
* util/deviceiter.c: Likewise.
* util/getroot.c (grub_util_get_os_disk): New function.
* util/grub-install.in: Remove grub-mkdevicemap. Use -t disk as
replacement for EFI.
* util/grub-mkdevicemap.c: Removed.
* util/grub-probe.c (probe): Handle PRINT_DISK.
(argp_parser): Handle -t disk.
2012-02-03 22:36:51 +01:00
Vladimir 'phcoder' Serbinenko
8e1e4e3903
* util/grub-mkfont.c: Migrate to argp.
...
* util/grub-mklayout.c: Likewise.
* util/grub-mkpasswd-pbkdf2.c: Likewise.
* util/grub-mkrelpath.c: Likewise.
* util/grub-probe.c: Likewise.
* util/grub-script-check.c: Likewise.
2012-02-03 21:45:43 +01:00
Richard Laager
69edd81ab7
* util/grub-mkimage.c (main): Fix format-security warning.
...
* util/grub-mkrelpath.c (main): Likewise.
* util/grub-probe.c (main): Likewise.
2012-02-03 11:07:18 +01:00
Richard Laager
65f08dbfe0
* util/grub-probe.c (probe): Don't crash on canonicalize_file_name
...
failure.
Put back lost PRINT_DRIVE.
2012-02-03 11:02:06 +01:00
Vladimir 'phcoder' Serbinenko
cf5f7ee788
Support install on multi-device filesystems.
...
* include/grub/emu/getroot.h (grub_guess_root_device): Renamed to ...
(grub_guess_root_devices): ...this. Return char **. All users updated.
* include/grub/emu/misc.h (grub_find_root_device_from_mountinfo):
Removed.
* util/getroot.c (find_root_device_from_libzfs): Moved pool logic to ...
(find_root_devices_from_poolname): ... here.
(grub_find_root_devices_from_mountinfo): Return char **. Make static.
Support zfs-fuse.
(grub_guess_root_device): Rename to ...
(grub_guess_root_devices): ... this. Return char **. All users updated.
* util/grub-install.in: Handle multi-device filesystems.
* util/grub-probe.c (probe). Make device_names a char **. Add delim
argument. All users updated.
Handle multi-device filesystems.
Use 'delim' as separator.
Remove device check to allow filesystems on file.
(main): Support -0 argument. Handle multi-device.
* util/grub-setup.c (setup): Remove root argument. Handle multi-device.
Fix a cross-device check while on it.
(arguments): Remove root_dev.
(argp_parser): Remove -r.
(main): Remove root_dev.
2012-02-03 10:35:28 +01:00
Vladimir 'phcoder' Serbinenko
63fe43f3c3
* util/getroot.c (grub_util_get_dm_node_linear_info): Fix memory leak.
...
* grub-core/disk/cryptodisk.c (cryptodisk_cleanup): Disable for
now to avoid double free.
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_dev): Rename to
hostdisk.
* include/grub/disk.h (grub_disk_dev_id): New id HOSTDISK.
* util/grub-probe.c (escape_of_path): Always return a new copy.
(print_full_name): Escape path.
(probe): Don't call grub_util_devname_to_ofpath on NULL.
Fix hints on abstractions.
2012-01-29 21:49:44 +01:00
Vladimir 'phcoder' Serbinenko
076e7c0fda
Merge common RAID and LVM logic to an abstract diskfilter.
...
Add LDM support using the same framework.
* Makefile.util.def (libgrubkern): Add grub-core/disk/ldm.c,
grub-core/disk/diskfilter.c and grub-core/partmap/gpt.c.
(libgrubmods): Remove grub-core/disk/raid.c and
grub-core/partmap/gpt.c.
* grub-core/Makefile.core.def (ldm): New module.
(raid): Renamed to diskfilter. All users updated.
* grub-core/disk/raid.c: Moved to ...
* grub-core/disk/diskfilter.c: ... here.
* grub-core/disk/diskfilter.c: Rename grub_raid_ to grub_diskfilter_.
(lv_num): New var.
(find_array): Renamed to ...
(find_lv): ... this. Support multi-LV. Skip nameless LVs
(grub_is_array_readable): Renamed to ...
(grub_is_lv_readable): ... this. Support multinode hierarchy.
(insert_array): New argument id.
(is_node_readable): New function.
(scan_device): Rename to ...
(scan_disk): .. this. Restrict to one disk.
(scan_devices): New function.
(grub_diskfilter_iterate): Support multi-LV.
Skip invisible and nameless LVs.
(grub_diskfilter_memberlist): Support multi-LV.
(grub_diskfilter_read_node): New function.
(grub_raid_read): Most of logic moved to ...
(read_segment): ... here
(read_lv): New function.
(grub_diskfilter_get_vg_by_uuid): New function.
(grub_diskfilter_make_raid): Likewise.
* grub-core/disk/ldm.c: New file.
* grub-core/disk/lvm.c (vg_list): Removed.
(lv_count): Likewise.
(scan_depth): Likewise.
(is_lv_readable): Likewise.
(grub_lvm_getvalue): Advance pointer past the number.
(find_lv): Removed.
(do_lvm_scan): Refactored into ...
(grub_lvm_detect): ... this. Support raid.
(grub_lvm_iterate): Removed.
(grub_lvm_memberlist): Likewise.
(grub_lvm_open): Likewise.
(grub_lvm_close): Likewise.
(read_lv): Likewise.
(read_node): Likewise.
(is_node_readable): Likewise.
(is_lv_readable): Likewise.
(grub_lvm_read): Likewise.
(grub_lvm_write): Likewise.
(grub_lvm_dev): Use diskfilter
(GRUB_MOD_INIT): Likewise.
(GRUB_MOD_FINI): Likewise.
* grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Use
new interface.
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Likewise.
* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Likewise.
* grub-core/disk/raid5_recover.c (grub_raid5_recover): Use
grub_diskfilter_read_node.
Fix a bug with xor.
* grub-core/disk/raid6_recover.c (grub_raid6_recover): Use
grub_diskfilter_read_node.
Support GRUB_RAID_LAYOUT_MUL_FROM_POS.
* grub-core/kern/disk.c (grub_disk_dev_list): Make global.
(grub_disk_dev_iterate): Move from here...
* include/grub/disk.h (grub_disk_dev_iterate): ... to here. Inlined.
* grub-core/kern/emu/hostdisk.c (grub_hostdisk_find_partition_start):
Make global.
(grub_hostdisk_find_partition_start): Likewise.
(grub_hostdisk_os_dev_to_grub_drive): New function.
(grub_util_biosdisk_get_osdev): Check that disk is biosdisk.
* grub-core/kern/emu/hostdisk.c (make_device_name): Move to ...
* util/getroot.c (make_device_name): ... here.
* grub-core/kern/emu/hostdisk.c (grub_util_get_dm_node_linear_info):
Move to ...
* util/getroot.c (grub_util_get_dm_node_linear_info): ...here.
* grub-core/kern/emu/hostdisk.c
(convert_system_partition_to_system_disk): Move to ...
* util/getroot.c (convert_system_partition_to_system_disk): ...here.
* grub-core/kern/emu/hostdisk.c (device_is_wholedisk): Move to ...
* util/getroot.c (device_is_wholedisk): ... here.
* grub-core/kern/emu/hostdisk.c (find_system_device): Move to ...
* util/getroot.c (find_system_device): ... here.
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_present):
Move to ...
* util/getroot.c (grub_util_biosdisk_is_present): ...here.
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev):
Move to ...
* util/getroot.c (grub_util_biosdisk_get_grub_dev): ... here.
Handle LDM.
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy):
Move to ...
* util/getroot.c (grub_util_biosdisk_is_floppy): ... here.
* grub-core/partmap/gpt.c (grub_gpt_partition_map_iterate): Made global.
* include/grub/disk.h (grub_disk_dev_id): Replaced RAID and LVM with
DISKFILTER.
* include/grub/raid.h: Renamed to ...
* include/grub/diskfilter.h: ... this.
* include/grub/diskfilter.h: Rename grub_raid_* to grub_diskfilter_*
(GRUB_RAID_LAYOUT_*): Make into array.
(GRUB_RAID_LAYOUT_MUL_FROM_POS): New value.
(grub_diskfilter_vg): New struct.
(grub_diskfilter_pv_id): Likewise.
(grub_raid_member): Removed.
(grub_raid_array): Likewise.
(grub_diskfilter_pv): New struct.
(grub_diskfilter_lv): Likewise.
(grub_diskfilter_segment): Likewise.
(grub_diskfilter_node): Likewise.
(grub_diskfilter_get_vg_by_uuid): New proto.
(grub_raid_register): Inline.
(grub_diskfilter_unregister): Likewise.
(grub_diskfilter_make_raid): New proto.
(grub_diskfilter_vg_register): Likewise.
(grub_diskfilter_read_node): Likewise.
(grub_diskfilter_get_pv_from_disk) [GRUB_UTIL]: Likewise.
* include/grub/emu/hostdisk.h (grub_util_get_ldm): New proto.
(grub_util_is_ldm): Likewise.
(grub_util_ldm_embed) [GRUB_UTIL]: Likewise.
(grub_hostdisk_find_partition_start): Likewise.
(grub_hostdisk_os_dev_to_grub_drive): Likewise.
* include/grub/gpt_partition.h (GRUB_GPT_PARTITION_TYPE_LDM):
New definition.
(grub_gpt_partition_map_iterate): New proto.
* include/grub/lvm.h (grub_lvm_vg): Removed.
(grub_lvm_pv): Likewise.
(grub_lvm_lv): Likewise.
(grub_lvm_segment): Likewise.
(grub_lvm_node): Likewise.
* util/getroot.c [...]
* util/grub-probe.c (probe_raid_level): Handle diskfilter.
(probe_abstraction): Likewise.
* util/grub-setup.c (setup): Remove must_embed. Support LDM.
(main): Remove dead logic.
2012-01-29 14:28:01 +01:00
Paulo de Rezende Pinatti
668327923f
* util/grub-install.in: Support dd'in into PreP partition.
...
* util/grub-probe.c (probe): Support discovering partition type.
(main): Support -t msdos_parttype.
Also-By: Vladimir Serbinenko <phcoder@gmail.com>
Also-By: pfsmorigo <>
2012-01-23 19:33:40 +01:00
Vladimir 'phcoder' Serbinenko
93d0a00116
Fix IEEE1275 bugs in grub-probe
2011-12-24 02:54:28 +01:00
Vladimir 'phcoder' Serbinenko
2980502850
Fix few bugs and memory leaks
2011-12-23 19:25:24 +01:00
Vladimir 'phcoder' Serbinenko
17785932df
merge mainline into hints
2011-12-23 18:49:00 +01:00
Vladimir 'phcoder' Serbinenko
6babad5e59
Initial integration of hints
2011-12-23 18:19:16 +01:00
Vladimir 'phcoder' Serbinenko
10f0117bf9
* grub-core/commands/efi/fixvideo.c: Gettextize.
...
* grub-core/commands/hashsum.c: Likewise.
* grub-core/commands/i386/cmostest.c: Likewise.
* grub-core/commands/i386/pc/drivemap.c: Likewise.
* grub-core/commands/i386/pc/lsapm.c: Likewise.
* grub-core/commands/i386/pc/sendkey.c: Likewise.
* grub-core/commands/lsmmap.c: Likewise.
* grub-core/commands/menuentry.c: Likewise.
* grub-core/commands/mips/loongson/lsspd.c: Likewise.
* grub-core/commands/setpci.c: Likewise.
* grub-core/loader/i386/bsd.c: Likewise.
* grub-core/loader/i386/linux.c: Likewise.
* util/getroot.c: Likewise.
* util/grub-editenv.c: Likewise.
* util/grub-fstest.c: Likewise.
* util/grub-mkfont.c: Likewise.
* util/grub-mkimage.c: Likewise.
* util/grub-mkpasswd-pbkdf2.c: Likewise.
* util/grub-pe2elf.c: Likewise.
* util/grub-probe.c: Likewise.
* util/grub-setup.c: Likewise.
* util/ieee1275/ofpath.c: Likewise.
* util/misc.c: Likewise.
* util/raid.c: Likewise.
2011-11-12 00:34:14 +01:00
Vladimir 'phcoder' Serbinenko
958ee22168
Illumos support.
...
* Makefile.util.def (10_illumos): New script.
* configure.ac: Set COND_HOST_ILLUMOS.
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors) [__sun__]:
Support Illumos calls.
(find_partition_start) [__sun__]: Likewise.
(convert_system_partition_to_system_disk) [__sun__]: Likewise.
(device_is_wholedisk) [__sun__]: Handle Illumos naming scheme.
(grub_util_biosdisk_get_grub_dev) [__sun__]: Handle Illumos.
* util/getroot.c (find_root_device_from_libzfs) [__sun__]: Return raw
device.
* util/grub-probe.c (probe) [__sun__]: Do character check.
* util/grub.d/10_illumos.in: New file.
2011-11-08 12:38:30 +01:00
Mario Limonciello
828bc390d8
* util/grub-probe.c (probe): Canonicalise the path argument, fixing
...
use of "/path/.." as in grub-install for EFI as well as handling
symlinks correctly.
Fixes Debian bug #637768 .
2011-08-15 23:30:11 +01:00
Colin Watson
5f60ccac6f
* util/grub-probe.c: Remove duplicate #include.
2011-08-15 23:21:29 +01:00
Vladimir 'phcoder' Serbinenko
20a409405b
Integrate geli into autoconfiguration system
2011-04-25 14:52:07 +02:00
Vladimir 'phcoder' Serbinenko
8585e54bec
factor cryptodisk part out
2011-04-23 18:00:42 +02:00