Commit Graph

25 Commits

Author SHA1 Message Date
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir 'phcoder' Serbinenko 5027af38cf Support for cbfs. Also factor out the part which is common
for all archives to a separate module. This splits tar from cpio
	as they are very different but keeps cpio, cpio_be, odc and newc
	together since they're very similar.
2013-06-16 00:06:13 +02:00
Vladimir 'phcoder' Serbinenko 3d84cb1793 Move flavour-specific parts out of common cpio.c file and
rename remaining to cpio_common.c
2013-06-14 20:44:59 +02:00
Colin Watson fc524edf65 Remove nested functions from filesystem directory iterators.
* include/grub/fs.h (grub_fs_dir_hook_t): New type.
(struct grub_fs.dir): Add hook_data argument.

Update all implementations and callers.
2013-01-21 01:33:46 +00:00
Vladimir 'phcoder' Serbinenko fc977f485f * grub-core/fs/cpio.c (canonicalize): Handle "..".
(grub_cpio_find_file) [MODE_USTAR]: Handle hardlinks.
2012-05-27 00:54:41 +02:00
Vladimir 'phcoder' Serbinenko 690434e81d * grub-core/fs/cpio.c (grub_cpio_find_file): Handle prefix.
(handle_symlink): Fix off-by-one error.
	Canonicalize the target.
	(grub_cpio_dir): Canonicalize the name.
	Fix memory leak.
	Set directory.
	(grub_cpio_open): Canonicalize the name.
2012-05-10 23:38:01 +02:00
Vladimir 'phcoder' Serbinenko e1e49678b9 * util/grub-install.in: Clarify strings.
Fix source dir check.
2012-02-27 21:36:58 +01:00
Vladimir 'phcoder' Serbinenko e1ea3ade95 * grub-core/fs/cpio.c (grub_cpio_dir): Fix a bug with multiple listing.
Explicitly init restart while on it.
2012-02-09 14:27:05 +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 df71143ea1 * grub-core/fs/cpio.c (handle_symlink): Fix a bug. 2012-01-29 15:36:06 +01:00
Vladimir 'phcoder' Serbinenko d3c13cbd62 Integrate hints into autogeneration scripts.
* docs/grub.texi (Filesystems): Add a hostdisk example.
	* Makefile.util.def (grub-mkdevicemap): Remove ofpath.
	(grub-probe): Add ofpath.
	* gentpl.py: Remove group nosparc64.
	* grub-core/commands/search.c (cache_entry): New struct.
	(cache): New var.
	(FUNC_NAME): Use and save cache. Fix handling of trailing comma.
	* grub-core/commands/search_wrap.c (options): Add platform-specific
	hint options.
	(grub_cmd_search): Handle platform-specific hints.
	(GRUB_MOD_INIT): Declare grub_cmd_search as accept_dash.
	* grub-core/kern/emu/hostdisk.c (map): New field device_map.
	(grub_util_biosdisk_data): Likewise.
	(grub_util_biosdisk_open): Set device_map.
	(read_device_map): Handle "" as indication of no map.
	Set device_map.
	(find_system_device): Add hostdisk/ prefix for autogenerated entries.
	(grub_util_biosdisk_get_compatibility_hint): New function.
	* grub-core/normal/main.c (features): Add feature_platform_search_hint.
	* include/grub/emu/hostdisk.h
	(grub_util_biosdisk_get_compatibility_hint): New proto.
	* util/grub-install.in: Don't call grub-mkdevicemap.
	Add platform-specific hint to load.cfg.
	* util/grub-mkconfig.in: Don't call grub-mkdevicemap.
	* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Add
	hints. Set root preliminary to compatibility hint, not to OS name.
	* util/grub-probe.c (PRINT_*): Add hints.
	(print): Make static.
	(escape_of_path): New function.
	(guess_bios_drive): Likewise.
	(guess_efi_drive): Likewise.
	(guess_baremetal_drive): Likewise.
	(print_full_name): Likewise.
	(probe): Handle hints.
	(main): Likewise.
	* util/ieee1275/devicemap.c: Removed.
	* util/ieee1275/ofpath.c (find_obppath): Allow to fail. All users
	updated.
	(grub_util_devname_to_ofpath): Return NULL on failure.

	* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Fix
	resource leak.
	* util/getroot.c (grub_util_pull_device): Fix memory leak.

	* po/POTFILES.in: Regenerated.

	Allow purely long options

	* grub-core/lib/arg.c (SHORT_ARG_HELP): Removed.
	(SHORT_ARG_USAGE): Likewise.
	(grub_arg_show_help): Compare opt with help_options.
	(parse_option): Receive opt as argument. If makes big simplificatons.
	All users updated
2011-12-24 15:09:26 +01:00
Vladimir 'phcoder' Serbinenko a1a8b1b90a Support odc, newc and bigendian cpio formats.
* Makefile.util.def (libgrubmods): Add odc.c, newc.c and cpio_be.c.
	* grub-core/Makefile.core.def (newc): New module.
	(odc): Likewise.
	(cpio_be): Likewise.
	* grub-core/fs/cpio.c (ALIGN_CPIO): New macro.
	(MAGIC): Likewise.
	(MAGIC2): Likewise.
	(head) [MODE_ODC]: Adapt for the format.
	(head) [MODE_NEWC]: Likewise.
	(head) [!MODE_*]: Write fields of interest as arrays.
	(MAGIC_USTAR): Removed.
	(read_number) [MODE_NEWC]: Change to hex.
	(read_number) [!MODE_*]: Parse binary arrays.
	(grub_cpio_find_file): Factor out the code for better structure and
	always use read_number.
	(grub_cpio_mount): Use MAGIC and MAGIC2.
	(grub_cpio_dir): Exit on first hook non-0 return.
	(grub_cpio_fs) [MODE_ODC]: Set name to odc.
	(grub_cpio_fs) [MODE_NEWC]: Set name to newc.
	(GRUB_MOD_INIT) [MODE_ODC]: Set name to odc.
	(GRUB_MOD_INIT) [MODE_NEWC]: Set name to newc.
	(GRUB_MOD_FINI) [MODE_ODC]: Set name to odc.
	(GRUB_MOD_FINI) [MODE_NEWC]: Set name to newc.
	* grub-core/fs/newc.c: New file.
	* grub-core/fs/odc.c: Likewise.
	* grub-core/fs/cpio_be.c: Likewise.
2011-12-23 16:15:18 +01:00
Vladimir 'phcoder' Serbinenko 58eba9eec7 Fix handling of tar numbers occupying the whole field.
* grub-core/fs/cpio.c (read_number): New function.
	(grub_cpio_find_file): Use read_number instead of strtoull.
2011-12-23 14:11:31 +01:00
Vladimir 'phcoder' Serbinenko a54a0e1270 * grub-core/fs/cpio.c (grub_cpio_find_file): Fix handling of names
occupying the whole field size.
2011-12-23 13:38:21 +01:00
Vladimir 'phcoder' Serbinenko adac52113d * grub-core/fs/cpio.c (grub_cpio_dir): Handle subdirs correctly. 2011-11-25 14:12:05 +01:00
Vladimir 'phcoder' Serbinenko 8a5a3a5b5a Fix several memory leaks.
* grub-core/fs/btrfs.c (grub_btrfs_dir): Fix memory leak.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Likewise.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/fat.c (grub_fat_label): Likewise.
	* grub-core/fs/jfs.c (grub_jfs_label): Likewise.
	* grub-core/fs/romfs.c (grub_romfs_close): Likewise.
	(grub_romfs_label): Likewise.
	* grub-core/fs/squash4.c (squash_mount): Use zalloc for safety.
	(squash_unmount): New function.
	(grub_squash_dir): Fix memory leak.
	(grub_squash_open): Likewise.
	(grub_squash_read): Likewise.
	(grub_squash_mtime): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_open): Likewise.
	* grub-core/fs/zfs/zfs.c (check_pool_label): Likewise.
	* util/grub-fstest.c (fstest): Likewise.
2011-11-09 15:01:58 +01:00
Vladimir 'phcoder' Serbinenko 19ee298767 Handle symlinks and long names on tar and cpio.
* grub-core/fs/cpio.c (ATTR_TYPE): New definition.
	(ATTR_FILE): Likewise.
	(ATTR_DIR): Likewise.
	(ATTR_LNK): Likewise.
	(grub_cpio_data) [MODE_USTAR]: New fields linkname and linkname_alloc.
	(grub_cpio_find_file): Fill mode, handle linkname field as well as
	L and K entries.
	(grub_cpio_mount): Zero-fill data.
	(handle_symlink): New function.
2011-10-30 23:06:25 +01:00
Vladimir 'phcoder' Serbinenko d4888031f2 Fix tar 4G limit and handle paths containing dot.
* grub-core/fs/cpio.c (grub_cpio_data): Use grub_off_t for offsets.
	(canonicalize): New function.
	(grub_cpio_find_file): Use canonicalize. Store offs in
	grub_disk_addr_t.
	(grub_cpio_dir): Use grub_disk_addr_t.
	(grub_cpio_open): Likewise.
2011-10-25 18:12:36 +02:00
Szymon Janc cbf597afb1 * grub-core/commands/cmp.c (grub_cmd_cmp): Remove unnecessary NULL
pointer checks before calling grub_free().
	* grub-core/commands/wildcard.c (match_devices): Likewise.
	* grub-core/commands/wildcard.c (match_files): Likewise.
	* grub-core/fs/cpio.c (grub_cpio_dir): Likewise.
	* grub-core/fs/cpio.c (grub_cpio_open): Likewise.
	* grub-core/fs/udf.c (grub_udf_read_block): Likewise.
	* grub-core/fs/xfs.c (grub_xfs_read_block): Likewise.
	* grub-core/loader/efi/chainloader.c (grub_cmd_chainloader): Likewise.
	* grub-core/normal/cmdline.c (grub_cmdline_get): Likewise.
	* grub-core/script/yylex.l (grub_lexer_unput): Likewise.
	* grub-core/video/readers/jpeg.c (grub_video_reader_jpeg): Likewise.
	* grub-core/video/readers/png.c (grub_png_output_byte): Likewise.
2011-06-26 17:17:41 +02:00
Vladimir 'phcoder' Serbinenko b756f75f07 Several FS mtime support.
* grub-core/fs/affs.c (grub_affs_time): New struct.
	(grub_affs_file): New field mtime.
	(grub_fshelp_node): Changed 'block' and 'parent' to more appropriate
	type. Removed 'size'. New field 'di'. All users updated.
	(grub_affs_mount): Simplify checsum checking.
	(grub_affs_iterate_dir): New helper grub_affs_create_node.
	(grub_affs_dir): Handle mtime.
	* grub-core/fs/cpio.c (grub_cpio_find_file): Handle mtime.
	(grub_cpio_dir): Likewise.
	* grub-core/fs/hfs.c (grub_hfs_dirrec): New fields 'ctime' and 'mtime'.
	(grub_hfs_filerec): New field mtime.
	(grub_hfs_dir): Handle mtime.
	(grub_hfs_mtime): New function.
	(grub_hfs_fs): Register grub_hfs_mtime.
	* grub-core/fs/iso9660.c (grub_iso9660_date2): New struct.
	(grub_iso9660_dir): New field mtime.
	(grub_fshelp_node): New field dirent.
	(iso9660_to_unixtime): New function.
	(iso9660_to_unixtime2): Likewise.
	(grub_iso9660_read_symlink): Use node->dirent.
	(grub_iso9660_iterate_dir): Likewise.
	(grub_iso9660_dir): Set mtime.
	(grub_iso9660_mtime): New function.
	(grub_iso9660_fs): Register grub_iso9660_mtime.
	* grub-core/fs/jfs.c (grub_jfs_time): New struct.
	(grub_jfs_inode): New fields atime, ctime and mtime.
	(grub_jfs_dir): Set mtime.
	* grub-core/fs/minix.c (grub_minix_dir): Likewise.
	* grub-core/fs/ntfs.c (list_file): Set mtime.
	(grub_ntfs_dir): Likewise.
	* grub-core/fs/reiserfs.c (grub_fshelp_node): New field 'mtime'.
	(grub_reiserfs_iterate_dir): Set mtime.
	(grub_reiserfs_dir): Likewise.
	* grub-core/fs/sfs.c (grub_sfs_obj): New field mtime.
	(grub_fshelp_node): Likewise.
	(grub_sfs_iterate_dir): Set mtime.
	(grub_sfs_dir): Likewise.
	* grub-core/fs/udf.c (grub_udf_dir): Set mtime.
	* grub-core/fs/xfs.c (grub_xfs_time): New struct.
	(grub_xfs_inode): New fields atime, mtime, ctime.
	(grub_xfs_dir): Set mtime.
	* include/grub/datetime.h (grub_datetime2unixtime): New function.
	* include/grub/hfs.h (grub_hfs_sblock): New fields ctime and mtime.
	* include/grub/ntfs.h (grub_fshelp_node): New field mtime.

	Support UDF symlinks.

	* grub-core/fs/udf.c (grub_udf_iterate_dir): Handle symlinks.
	(grub_ufs_read_symlink): New function. All users updated.

	Check amiga partmap checksum.

	* grub-core/partmap/amiga.c (grub_amiga_rdsk): Pad to 128 bytes.
	(grub_amiga_partition): Likewise.
	(amiga_partition_map_checksum): New function.
	(amiga_partition_map_iterate): Check checksum.
2011-05-15 12:23:54 +02:00
Vladimir 'phcoder' Serbinenko e745cf0ca6 Implement automatic module license checking according to new GNU
guidelines.

	* grub-core/kern/dl.c (grub_dl_check_license): New function.
	(grub_dl_load_core): Use grub_dl_check_license.
	* include/grub/dl.h (GRUB_MOD_SECTION): New macro.
	(GRUB_MOD_LICENSE): Likewise.
	(GRUB_MOD_DUAL_LICENSE): Likewise.
	All modules updated.
2011-04-11 23:01:51 +02:00
Vladimir 'phcoder' Serbinenko a2a08a35bf * grub-core/fs/affs.c (grub_affs_fs) [GRUB_UTIL]: Explicitly set
reserved_first_sector to 0.
	* grub-core/fs/cpio.c (grub_cpio_fs) [GRUB_UTIL]: Likewise.
	* grub-core/fs/sfs.c (grub_sfs_fs) [GRUB_UTIL]: Likewise.
	* grub-core/fs/xfs.c (grub_xfs_fs) [GRUB_UTIL]: Likewise.
2010-12-19 00:49:52 +01:00
Vladimir 'phcoder' Serbinenko 80113a6258 declare AFFS, CPIO, TAR and XFS as non-installable explicitly 2010-12-11 18:21:39 +01:00
Vladimir 'phcoder' Serbinenko db64f5b167 mtime support for cpio and tar 2010-12-10 08:42:40 +01:00
BVK Chaitanya 8c41176882 automake commit without merge history 2010-05-06 11:34:04 +05:30