2019-04-21 00:46:08 +02:00
|
|
|
#ifndef UTIL_H
|
|
|
|
#define UTIL_H
|
|
|
|
|
2019-04-25 00:58:26 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-04-21 00:46:08 +02:00
|
|
|
/**
|
|
|
|
* \file util.h
|
|
|
|
* \brief utility functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-04-26 08:39:45 +02:00
|
|
|
* \brief the maximum length of a path and a URL.
|
|
|
|
* \details This corresponds the maximum path length under Ext4.
|
2019-04-21 00:46:08 +02:00
|
|
|
*/
|
2019-04-26 08:39:45 +02:00
|
|
|
#define MAX_PATH_LEN 4096
|
|
|
|
|
|
|
|
/** \brief the maximum length of a filename. */
|
|
|
|
#define MAX_FILENAME_LEN 255
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief append a path
|
|
|
|
* \details This function appends a path with the next level, while taking the
|
|
|
|
* trailing slash of the upper level into account.
|
|
|
|
*/
|
|
|
|
char *path_append(const char *path, const char *filename);
|
2019-04-21 00:46:08 +02:00
|
|
|
|
2019-04-25 00:58:26 +02:00
|
|
|
/**
|
|
|
|
* \brief division, but rounded to the nearest integer rather than truncating
|
|
|
|
*/
|
|
|
|
int64_t round_div(int64_t a, int64_t b);
|
|
|
|
|
2019-04-26 08:39:45 +02:00
|
|
|
|
2019-04-21 00:46:08 +02:00
|
|
|
#endif
|