1
0
Files
overlaydirs/overlay-common.hh
2025-05-27 11:36:06 +03:00

44 lines
840 B
C++

/* SPDX-License-Identifier: Apache-2.0
* (c) 2025, Konstantin Demin
*/
#ifndef INCLUDE_OVERLAY_COMMON_HH
#define INCLUDE_OVERLAY_COMMON_HH 1
#include <vector>
extern "C" {
#include <dirent.h>
}
constexpr unsigned int ovl_name_max = sizeof(dirent::d_name);
constexpr unsigned int ovl_path_max = (PATH_MAX);
/*
constexpr unsigned int ovl_path_max =
#ifdef PATH_MAX
#if (PATH_MAX > 0) && (PATH_MAX <= 8192)
(PATH_MAX);
#else
8192;
#endif
#else
4096;
#endif
*/
constexpr unsigned int ovl_path_name_ratio = ovl_path_max / ovl_name_max;
constexpr unsigned int ovl_depth_max = ovl_path_name_ratio - 1;
struct ovl_name_t {
size_t len;
char str[ovl_name_max];
};
struct ovl_path_t {
size_t len;
char str[ovl_path_max];
};
typedef std::vector<ovl_path_t> ovl_path_vec;
#endif /* INCLUDE_OVERLAY_COMMON_HH */