1
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2
* Use of this source code is governed by a BSD-style license that can be
3
* found in the LICENSE file.
5
* Header file for mount helpers.
7
#ifndef _MOUNT_HELPERS_H_
8
#define _MOUNT_HELPERS_H_
10
/* General utility functions. */
11
uint64_t blk_size(const char *device);
12
int remove_tree(const char *tree);
13
int runcmd(const gchar *argv[], gchar **output);
14
int same_vfs(const char *mnt_a, const char *mnt_b);
15
char *stringify_hex(uint8_t *binary, size_t length);
16
uint8_t *hexify_string(char *string, uint8_t *binary, size_t length);
17
void shred(const char *keyfile);
19
/* Loopback device attach/detach helpers. */
20
gchar *loop_attach(int fd, const char *name);
21
int loop_detach(const gchar *loopback);
22
int loop_detach_name(const char *name);
24
/* Encrypted device mapper setup/teardown. */
25
int dm_setup(uint64_t bytes, const gchar *encryption_key, const char *name,
26
const gchar *device, const char *path, int discard);
27
int dm_teardown(const gchar *device);
28
char *dm_get_key(const gchar *device);
30
/* Sparse file creation. */
31
int sparse_create(const char *path, uint64_t bytes);
33
/* Filesystem creation. */
34
int filesystem_build(const char *device, uint64_t block_bytes,
35
uint64_t blocks_min, uint64_t blocks_max);
36
int filesystem_resize(const char *device, uint64_t blocks, uint64_t blocks_max);
38
/* Encrypted keyfile handling. */
39
char *keyfile_read(const char *keyfile, uint8_t *system_key);
40
int keyfile_write(const char *keyfile, uint8_t *system_key, char *plain);
42
#endif /* _MOUNT_HELPERS_H_ */