shadow-image: write tag table entry executable info to image
This commit is contained in:
@@ -31,6 +31,43 @@ static void encode_header(
|
||||
out->h_app_magic = b_i64_htob(in->img_id);
|
||||
}
|
||||
|
||||
static void encode_tag_executable_info(
|
||||
const struct ec3_tag_executable_info *in,
|
||||
struct ec3_executable *out)
|
||||
{
|
||||
out->exe_format = b_i16_htob(in->exe_format);
|
||||
|
||||
switch (in->exe_format) {
|
||||
case EC3_EXEC_ELF:
|
||||
out->exe_elf.elf_data_offset
|
||||
= b_i32_htob(in->exe_elf.elf_data_offset);
|
||||
out->exe_elf.elf_data_filesz
|
||||
= b_i32_htob(in->exe_elf.elf_data_filesz);
|
||||
out->exe_elf.elf_data_memsz
|
||||
= b_i32_htob(in->exe_elf.elf_data_memsz);
|
||||
out->exe_elf.elf_data_align
|
||||
= b_i32_htob(in->exe_elf.elf_data_align);
|
||||
|
||||
out->exe_elf.elf_text_offset
|
||||
= b_i32_htob(in->exe_elf.elf_text_offset);
|
||||
out->exe_elf.elf_text_filesz
|
||||
= b_i32_htob(in->exe_elf.elf_text_filesz);
|
||||
out->exe_elf.elf_text_memsz
|
||||
= b_i32_htob(in->exe_elf.elf_text_memsz);
|
||||
out->exe_elf.elf_text_align
|
||||
= b_i32_htob(in->exe_elf.elf_text_align);
|
||||
|
||||
out->exe_elf.elf_data_vaddr
|
||||
= b_i64_htob(in->exe_elf.elf_data_vaddr);
|
||||
out->exe_elf.elf_text_vaddr
|
||||
= b_i64_htob(in->exe_elf.elf_text_vaddr);
|
||||
out->exe_elf.elf_entry = b_i64_htob(in->exe_elf.elf_entry);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void encode_tag(
|
||||
const struct ec3_tag_info *in,
|
||||
struct ec3_tag_table_entry *out)
|
||||
@@ -42,6 +79,10 @@ static void encode_tag(
|
||||
out->tag_checksum = b_i32_htob(in->tag_checksum);
|
||||
out->tag_ident = b_i64_htob(in->tag_ident);
|
||||
out->tag_length = b_i64_htob(in->tag_total_length);
|
||||
|
||||
if (in->tag_type == EC3_TAG_EXEC) {
|
||||
encode_tag_executable_info(&in->tag_exe, &out->tag_exe);
|
||||
}
|
||||
}
|
||||
|
||||
static void encode_extent(
|
||||
@@ -454,8 +495,8 @@ static enum ec3_status put_empty_cluster(
|
||||
return EC3_SUCCESS;
|
||||
}
|
||||
|
||||
/* retrieve a cached cluster from a tag io context, encode it, and write it
|
||||
* to the shadow image */
|
||||
/* retrieve a cached cluster from a tag io context, encode it, and write
|
||||
* it to the shadow image */
|
||||
static enum ec3_status copy_cached_cluster(
|
||||
struct shadow_image *image,
|
||||
struct ec3_tag_ioctx *tag,
|
||||
@@ -521,10 +562,10 @@ static enum ec3_status copy_cached_cluster(
|
||||
return EC3_SUCCESS;
|
||||
}
|
||||
|
||||
/* read a range of clusters from the source image, delimited by an extent.
|
||||
* write the clusters to the shadow image. the tag's cache is also checked for
|
||||
* each cluster in the extent. of a cached version of the cluster's contents
|
||||
* exists, that is used instead */
|
||||
/* read a range of clusters from the source image, delimited by an
|
||||
* extent. write the clusters to the shadow image. the tag's cache is
|
||||
* also checked for each cluster in the extent. of a cached version of
|
||||
* the cluster's contents exists, that is used instead */
|
||||
static enum ec3_status copy_cluster_range(
|
||||
struct ec3_image_ioctx *src,
|
||||
struct shadow_image *dest,
|
||||
|
||||
Reference in New Issue
Block a user