/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef V_ALPM_NATIVE_SPACE_H #define V_ALPM_NATIVE_SPACE_H #include #include typedef struct v_alpm_space_info { uint64_t block_size; uint64_t blocks; uint64_t available; uint32_t read_only; } v_alpm_space_info; static int v_alpm_space_stat(const char *path, v_alpm_space_info *result) { struct statvfs info; if(statvfs(path, &info) != 0) { return -1; } result->block_size = info.f_bsize; result->blocks = info.f_blocks; result->available = info.f_bavail; result->read_only = (info.f_flag & ST_RDONLY) != 0; return 0; } #endif