| storage.hpp | | storage.hpp | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 113 | |
| storage_interface(): m_disk_pool(0), m_settings(0) {} | | storage_interface(): m_disk_pool(0), m_settings(0) {} | |
| // create directories and set file sizes | | // create directories and set file sizes | |
| // if allocate_files is true. | | // if allocate_files is true. | |
| // allocate_files is true if allocation mode | | // allocate_files is true if allocation mode | |
| // is set to full and sparse files are supported | | // is set to full and sparse files are supported | |
| // false return value indicates an error | | // false return value indicates an error | |
| virtual bool initialize(bool allocate_files) = 0; | | virtual bool initialize(bool allocate_files) = 0; | |
| | | | |
| virtual bool has_any_file() = 0; | | virtual bool has_any_file() = 0; | |
| | | | |
|
| virtual int readv(file::iovec_t const* bufs, int slot, int o | | virtual int readv(file::iovec_t const* bufs, int slot, int o | |
| ffset, int num_bufs); | | ffset, int num_bufs, int flags = file::random_access); | |
| virtual int writev(file::iovec_t const* bufs, int slot, int | | virtual int writev(file::iovec_t const* bufs, int slot, int | |
| offset, int num_bufs); | | offset, int num_bufs, int flags = file::random_access); | |
| | | | |
| virtual void hint_read(int slot, int offset, int len) {} | | virtual void hint_read(int slot, int offset, int len) {} | |
| // negative return value indicates an error | | // negative return value indicates an error | |
| virtual int read(char* buf, int slot, int offset, int size)
= 0; | | virtual int read(char* buf, int slot, int offset, int size)
= 0; | |
| | | | |
| // negative return value indicates an error | | // negative return value indicates an error | |
| virtual int write(const char* buf, int slot, int offset, int
size) = 0; | | virtual int write(const char* buf, int slot, int offset, int
size) = 0; | |
| | | | |
| virtual size_type physical_offset(int slot, int offset) = 0; | | virtual size_type physical_offset(int slot, int offset) = 0; | |
| | | | |
| | | | |
| skipping to change at line 162 | | skipping to change at line 162 | |
| // non-zero return value indicates an error | | // non-zero return value indicates an error | |
| virtual bool release_files() = 0; | | virtual bool release_files() = 0; | |
| | | | |
| // this will rename the file specified by index. | | // this will rename the file specified by index. | |
| virtual bool rename_file(int index, std::string const& new_f
ilename) = 0; | | virtual bool rename_file(int index, std::string const& new_f
ilename) = 0; | |
| | | | |
| // this will close all open files and delete them | | // this will close all open files and delete them | |
| // non-zero return value indicates an error | | // non-zero return value indicates an error | |
| virtual bool delete_files() = 0; | | virtual bool delete_files() = 0; | |
| | | | |
|
| | | #ifndef TORRENT_NO_DEPRECATE | |
| virtual void finalize_file(int file) {} | | virtual void finalize_file(int file) {} | |
|
| | | #endif | |
| | | | |
| disk_buffer_pool* disk_pool() { return m_disk_pool; } | | disk_buffer_pool* disk_pool() { return m_disk_pool; } | |
| session_settings const& settings() const { return *m_setting
s; } | | session_settings const& settings() const { return *m_setting
s; } | |
| | | | |
| void set_error(std::string const& file, error_code const& ec
) const; | | void set_error(std::string const& file, error_code const& ec
) const; | |
| | | | |
| error_code const& error() const { return m_error; } | | error_code const& error() const { return m_error; } | |
| std::string const& error_file() const { return m_error_file;
} | | std::string const& error_file() const { return m_error_file;
} | |
| virtual void clear_error() { m_error = error_code(); m_error
_file.resize(0); } | | virtual void clear_error() { m_error = error_code(); m_error
_file.resize(0); } | |
| | | | |
| | | | |
| skipping to change at line 189 | | skipping to change at line 191 | |
| session_settings* m_settings; | | session_settings* m_settings; | |
| }; | | }; | |
| | | | |
| class TORRENT_EXPORT default_storage : public storage_interface, boo
st::noncopyable | | class TORRENT_EXPORT default_storage : public storage_interface, boo
st::noncopyable | |
| { | | { | |
| public: | | public: | |
| default_storage(file_storage const& fs, file_storage const*
mapped, std::string const& path | | default_storage(file_storage const& fs, file_storage const*
mapped, std::string const& path | |
| , file_pool& fp, std::vector<boost::uint8_t> const&
file_prio); | | , file_pool& fp, std::vector<boost::uint8_t> const&
file_prio); | |
| ~default_storage(); | | ~default_storage(); | |
| | | | |
|
| | | #ifndef TORRENT_NO_DEPRECATE | |
| void finalize_file(int file); | | void finalize_file(int file); | |
|
| | | #endif | |
| bool has_any_file(); | | bool has_any_file(); | |
| bool rename_file(int index, std::string const& new_filename)
; | | bool rename_file(int index, std::string const& new_filename)
; | |
| bool release_files(); | | bool release_files(); | |
| bool delete_files(); | | bool delete_files(); | |
| bool initialize(bool allocate_files); | | bool initialize(bool allocate_files); | |
| bool move_storage(std::string const& save_path); | | bool move_storage(std::string const& save_path); | |
| int read(char* buf, int slot, int offset, int size); | | int read(char* buf, int slot, int offset, int size); | |
| int write(char const* buf, int slot, int offset, int size); | | int write(char const* buf, int slot, int offset, int size); | |
| int sparse_end(int start) const; | | int sparse_end(int start) const; | |
| void hint_read(int slot, int offset, int len); | | void hint_read(int slot, int offset, int len); | |
|
| int readv(file::iovec_t const* bufs, int slot, int offset, i | | int readv(file::iovec_t const* bufs, int slot, int offset, i | |
| nt num_bufs); | | nt num_bufs, int flags = file::random_access); | |
| int writev(file::iovec_t const* buf, int slot, int offset, i | | int writev(file::iovec_t const* buf, int slot, int offset, i | |
| nt num_bufs); | | nt num_bufs, int flags = file::random_access); | |
| size_type physical_offset(int slot, int offset); | | size_type physical_offset(int slot, int offset); | |
| bool move_slot(int src_slot, int dst_slot); | | bool move_slot(int src_slot, int dst_slot); | |
| bool swap_slots(int slot1, int slot2); | | bool swap_slots(int slot1, int slot2); | |
| bool swap_slots3(int slot1, int slot2, int slot3); | | bool swap_slots3(int slot1, int slot2, int slot3); | |
| bool verify_resume_data(lazy_entry const& rd, error_code& er
ror); | | bool verify_resume_data(lazy_entry const& rd, error_code& er
ror); | |
| bool write_resume_data(entry& rd) const; | | bool write_resume_data(entry& rd) const; | |
| | | | |
| // this identifies a read or write operation | | // this identifies a read or write operation | |
| // so that default_storage::readwritev() knows what to | | // so that default_storage::readwritev() knows what to | |
| // do when it's actually touching the file | | // do when it's actually touching the file | |
| | | | |
| skipping to change at line 273 | | skipping to change at line 277 | |
| disabled_storage(int piece_size) : m_piece_size(piece_size)
{} | | disabled_storage(int piece_size) : m_piece_size(piece_size)
{} | |
| bool has_any_file() { return false; } | | bool has_any_file() { return false; } | |
| bool rename_file(int index, std::string const& new_filename)
{ return false; } | | bool rename_file(int index, std::string const& new_filename)
{ return false; } | |
| bool release_files() { return false; } | | bool release_files() { return false; } | |
| bool delete_files() { return false; } | | bool delete_files() { return false; } | |
| bool initialize(bool allocate_files) { return false; } | | bool initialize(bool allocate_files) { return false; } | |
| bool move_storage(std::string const& save_path) { return tru
e; } | | bool move_storage(std::string const& save_path) { return tru
e; } | |
| int read(char* buf, int slot, int offset, int size) { return
size; } | | int read(char* buf, int slot, int offset, int size) { return
size; } | |
| int write(char const* buf, int slot, int offset, int size) {
return size; } | | int write(char const* buf, int slot, int offset, int size) {
return size; } | |
| size_type physical_offset(int slot, int offset) { return 0;
} | | size_type physical_offset(int slot, int offset) { return 0;
} | |
|
| int readv(file::iovec_t const* bufs, int slot, int offset, i | | int readv(file::iovec_t const* bufs, int slot, int offset, i | |
| nt num_bufs); | | nt num_bufs, int flags = file::random_access); | |
| int writev(file::iovec_t const* bufs, int slot, int offset, | | int writev(file::iovec_t const* bufs, int slot, int offset, | |
| int num_bufs); | | int num_bufs, int flags = file::random_access); | |
| bool move_slot(int src_slot, int dst_slot) { return false; } | | bool move_slot(int src_slot, int dst_slot) { return false; } | |
| bool swap_slots(int slot1, int slot2) { return false; } | | bool swap_slots(int slot1, int slot2) { return false; } | |
| bool swap_slots3(int slot1, int slot2, int slot3) { return f
alse; } | | bool swap_slots3(int slot1, int slot2, int slot3) { return f
alse; } | |
| bool verify_resume_data(lazy_entry const& rd, error_code& er
ror) { return false; } | | bool verify_resume_data(lazy_entry const& rd, error_code& er
ror) { return false; } | |
| bool write_resume_data(entry& rd) const { return false; } | | bool write_resume_data(entry& rd) const { return false; } | |
| | | | |
| int m_piece_size; | | int m_piece_size; | |
| }; | | }; | |
| | | | |
| struct disk_io_thread; | | struct disk_io_thread; | |
| | | | |
| skipping to change at line 309 | | skipping to change at line 313 | |
| , disk_io_thread& io | | , disk_io_thread& io | |
| , storage_constructor_type sc | | , storage_constructor_type sc | |
| , storage_mode_t sm | | , storage_mode_t sm | |
| , std::vector<boost::uint8_t> const& file_prio); | | , std::vector<boost::uint8_t> const& file_prio); | |
| | | | |
| ~piece_manager(); | | ~piece_manager(); | |
| | | | |
| boost::intrusive_ptr<torrent_info const> info() const { retu
rn m_info; } | | boost::intrusive_ptr<torrent_info const> info() const { retu
rn m_info; } | |
| void write_resume_data(entry& rd) const; | | void write_resume_data(entry& rd) const; | |
| | | | |
|
| void async_finalize_file(int file); | | | |
| | | | |
| void async_check_fastresume(lazy_entry const* resume_data | | void async_check_fastresume(lazy_entry const* resume_data | |
| , boost::function<void(int, disk_io_job const&)> con
st& handler); | | , boost::function<void(int, disk_io_job const&)> con
st& handler); | |
| | | | |
| void async_check_files(boost::function<void(int, disk_io_job
const&)> const& handler); | | void async_check_files(boost::function<void(int, disk_io_job
const&)> const& handler); | |
| | | | |
| void async_rename_file(int index, std::string const& name | | void async_rename_file(int index, std::string const& name | |
| , boost::function<void(int, disk_io_job const&)> con
st& handler); | | , boost::function<void(int, disk_io_job const&)> con
st& handler); | |
| | | | |
| void async_read( | | void async_read( | |
| peer_request const& r | | peer_request const& r | |
| | | | |
| skipping to change at line 439 | | skipping to change at line 441 | |
| , int num_bufs); | | , int num_bufs); | |
| | | | |
| int write_impl( | | int write_impl( | |
| file::iovec_t* bufs | | file::iovec_t* bufs | |
| , int piece_index | | , int piece_index | |
| , int offset | | , int offset | |
| , int num_bufs); | | , int num_bufs); | |
| | | | |
| size_type physical_offset(int piece_index, int offset); | | size_type physical_offset(int piece_index, int offset); | |
| | | | |
|
| void finalize_file(int index); | | | |
| | | | |
| // returns the number of pieces left in the | | // returns the number of pieces left in the | |
| // file currently being checked | | // file currently being checked | |
| int skip_file() const; | | int skip_file() const; | |
| // -1=error 0=ok >0=skip this many pieces | | // -1=error 0=ok >0=skip this many pieces | |
| int check_one_piece(int& have_piece); | | int check_one_piece(int& have_piece); | |
| int identify_data( | | int identify_data( | |
| sha1_hash const& large_hash | | sha1_hash const& large_hash | |
| , sha1_hash const& small_hash | | , sha1_hash const& small_hash | |
| , int current_slot); | | , int current_slot); | |
| | | | |
| | | | |
End of changes. 9 change blocks. |
| 16 lines changed or deleted | | 16 lines changed or added | |
|