blob: eb86abab12b8751ae712ef377e5759af1eff86fe [file] [log] [blame]
/*
* Copyright (c) 2018 The Fuchsia Authors
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _ZIRCON_PARTITION_H_
#define _ZIRCON_PARTITION_H_
#include <zircon/boot/image.h>
#define ZIRCON_PARTITION_PREFIX "zircon_"
/* TODO(dmitryya@) add descriptions for API */
/* Gets zircon partition layout */
const zbi_partition_map_t *zircon_get_partition_map(void);
/* Gets |name| partition size from zircon partition layout.
*/
int zircon_get_partititon_size(const char *name, uint64_t *size);
/* Writes |size| bytes from the buffer starting at |data| to the
* |name| zircon partition.
*/
int zircon_partition_write(const char *name, uint64_t offset,
const unsigned char *data, size_t size);
/* Attempts to read |size| bytes from |name| zircon partition
* into the buffer starting at |data|.
*/
int zircon_partition_read(const char *name, uint64_t offset,
unsigned char *data, size_t size);
/* Erase |name| partition */
int zircon_partition_erase(const char *name);
#endif /* _ZIRCON_PARTITION_H_ */