2023-02-11 20:49:42 +00:00
|
|
|
// This file Copyright © 2013-2023 Mnemosyne LLC.
|
2022-08-08 18:05:39 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2013-07-08 17:07:31 +00:00
|
|
|
|
2017-11-14 20:21:28 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-01-13 02:13:58 +00:00
|
|
|
#include <cstdint> // int64_t
|
2021-11-13 18:09:14 +00:00
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
2013-07-08 17:07:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup tr_session Session
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct tr_device_info
|
|
|
|
{
|
2021-11-13 18:09:14 +00:00
|
|
|
std::string path;
|
|
|
|
std::string device;
|
|
|
|
std::string fstype;
|
2013-07-08 17:07:31 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 17:07:16 +00:00
|
|
|
struct tr_disk_space
|
|
|
|
{
|
|
|
|
int64_t free;
|
|
|
|
int64_t total;
|
|
|
|
};
|
|
|
|
|
2021-11-13 18:09:14 +00:00
|
|
|
tr_device_info tr_device_info_create(std::string_view path);
|
2013-07-08 17:07:31 +00:00
|
|
|
|
2021-10-14 17:07:16 +00:00
|
|
|
/** Values represents the total space on disk.
|
|
|
|
If the disk quota (free space) is enabled and readable, this returns how much is available in the quota.
|
|
|
|
Otherwise, it returns how much is available on the disk, or { -1, -1 } on error. */
|
2021-11-13 18:09:14 +00:00
|
|
|
tr_disk_space tr_device_info_get_disk_space(tr_device_info const& info);
|
2013-07-08 17:07:31 +00:00
|
|
|
|
|
|
|
/** @} */
|