Loading...
Searching...
No Matches
vfs_util.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 ML!PA Consulting GmbH
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
20#ifndef VFS_UTIL_H
21#define VFS_UTIL_H
22
23#include <stdbool.h>
24#include <stddef.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
41int vfs_file_from_buffer(const char *file, const void *buf, size_t len);
42
55int vfs_file_to_buffer(const char* file, void* buf, size_t len);
56
57#if MODULE_HASHES || DOXYGEN
71int vfs_file_md5(const char* file, void *digest,
72 void *work_buf, size_t work_buf_len);
73
87int vfs_file_sha1(const char* file, void *digest,
88 void *work_buf, size_t work_buf_len);
89
103int vfs_file_sha256(const char* file, void *digest,
104 void *work_buf, size_t work_buf_len);
105#endif
106
119int vfs_is_dir(const char *path);
120
128bool vfs_file_exists(const char *path);
129
141int vfs_unlink_recursive(const char *root, char *path_buf, size_t max_size);
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif /* VFS_UTIL_H */
int vfs_is_dir(const char *path)
Checks if path is a file or a directory.
int vfs_file_sha1(const char *file, void *digest, void *work_buf, size_t work_buf_len)
Compute the SHA1 message digest of a file.
int vfs_file_from_buffer(const char *file, const void *buf, size_t len)
Writes the content of a buffer to a file If the file already exists, it will be overwritten.
bool vfs_file_exists(const char *path)
Checks if path is a file and can be read.
int vfs_file_to_buffer(const char *file, void *buf, size_t len)
Reads the content of a file to a buffer.
int vfs_file_sha256(const char *file, void *digest, void *work_buf, size_t work_buf_len)
Compute the SHA256 message digest of a file.
int vfs_unlink_recursive(const char *root, char *path_buf, size_t max_size)
Behaves like rm -r @p root.
int vfs_file_md5(const char *file, void *digest, void *work_buf, size_t work_buf_len)
Compute the MD5 message digest of a file.