mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
ce66e5c442
* chore: remove unused #include <array> * chore: remove unused #include <chrono> * chore: remove unused #include <set> * chore: remove unused #include <algorithm> * chore: remove unused #include "interned-string.h" * chore: remove unused #include <list> * chore: remove unused #include <optional> * chore: iwyu <cstddef> * chore: iwyu <ctime> * chore: remove unused #include <cerrno> * chore: remove unused #include <deque> * chore: remove unused #include <vector> * chore: remove unused #include <memory> * chore: remove unused #include <unordered_set> * chore: remove unused #include <array> * chore: remove unused #include <mutex> * chore: remove unused #include <functional> * chore: remove unused #include <cmath>
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
// This file Copyright © 2007-2023 Mnemosyne LLC.
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
// License text can be found in the licenses/ folder.
|
|
|
|
#pragma once
|
|
|
|
#ifndef __TRANSMISSION__
|
|
#error only libtransmission should #include this header.
|
|
#endif
|
|
|
|
#include <cstddef> // size_t
|
|
#include <cstdint> // uint8_t, uint32_t
|
|
|
|
#include "transmission.h"
|
|
|
|
#include "block-info.h"
|
|
|
|
struct tr_torrent;
|
|
|
|
/**
|
|
* @addtogroup file_io File IO
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* Reads the block specified by the piece index, offset, and length.
|
|
* @return 0 on success, or an errno value on failure.
|
|
*/
|
|
[[nodiscard]] int tr_ioRead(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t* setme);
|
|
|
|
int tr_ioPrefetch(tr_torrent* tor, tr_block_info::Location const& loc, size_t len);
|
|
|
|
/**
|
|
* Writes the block specified by the piece index, offset, and length.
|
|
* @return 0 on success, or an errno value on failure.
|
|
*/
|
|
[[nodiscard]] int tr_ioWrite(struct tr_torrent* tor, tr_block_info::Location const& loc, size_t len, uint8_t const* writeme);
|
|
|
|
/**
|
|
* @brief Test to see if the piece matches its metainfo's SHA1 checksum.
|
|
*/
|
|
bool tr_ioTestPiece(tr_torrent* tor, tr_piece_index_t piece);
|
|
|
|
/* @} */
|