[patch 1/4] Add function get_bootparam

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 27, 2013 at 12:04:38PM +0800, dyoung at redhat.com wrote:
> Not only setup_subarch will get data from debugfs file
> boot_params/data, later code for adding efi_info will
> also need do same thing. Thus add a common function here
> for later use.
> 
> Signed-off-by: Dave Young <dyoung at redhat.com>
> ---
>  kexec/arch/i386/x86-linux-setup.c |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> --- kexec-tools.orig/kexec/arch/i386/x86-linux-setup.c
> +++ kexec-tools/kexec/arch/i386/x86-linux-setup.c
> @@ -436,10 +436,9 @@ char *find_mnt_by_fsname(char *fsname)
>  	return mntdir;
>  }
>  
> -void setup_subarch(struct x86_linux_param_header *real_mode)
> +void get_bootparam(void *buf, off_t offset, size_t size)
>  {
>  	int data_file;
> -	const off_t offset = offsetof(typeof(*real_mode), hardware_subarch);
>  	char *debugfs_mnt;
>  	char filename[PATH_MAX];
>  
> @@ -447,7 +446,7 @@ void setup_subarch(struct x86_linux_para
>  	if (!debugfs_mnt)
>  		return;
>  	snprintf(filename, PATH_MAX, "%s/%s", debugfs_mnt, "boot_params/data");
> -	filename[PATH_MAX-1] = 0;
> +	filename[PATH_MAX - 1] = 0;
>  	free(debugfs_mnt);

This change appears to be unrelated to the rest of the patch.

>  
>  	data_file = open(filename, O_RDONLY);
> @@ -455,11 +454,18 @@ void setup_subarch(struct x86_linux_para
>  		return;
>  	if (lseek(data_file, offset, SEEK_SET) < 0)
>  		goto close;
> -	read(data_file, &real_mode->hardware_subarch, sizeof(uint32_t));
> +	read(data_file, buf, size);
>  close:
>  	close(data_file);
>  }
>  
> +void setup_subarch(struct x86_linux_param_header *real_mode)
> +{
> +	off_t offset = offsetof(typeof(*real_mode), hardware_subarch);
> +
> +	get_bootparam(&real_mode->hardware_subarch, offset, sizeof(uint32_t));
> +}
> +
>  void setup_linux_system_parameters(struct kexec_info *info,
>  				   struct x86_linux_param_header *real_mode)
>  {
> 
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
> 



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux