forked from premiere/premiere-libtorrent
fixed FIEMAP support on linux
This commit is contained in:
parent
6975f4b350
commit
6851254fdf
|
@ -26,6 +26,7 @@
|
||||||
incoming connection
|
incoming connection
|
||||||
* added more detailed instrumentation of the disk I/O thread
|
* added more detailed instrumentation of the disk I/O thread
|
||||||
|
|
||||||
|
* fixed FIEMAP support on linux
|
||||||
* fixed strict aliasing warning on gcc
|
* fixed strict aliasing warning on gcc
|
||||||
* fixed inconsistency when creating torrents with symlinks
|
* fixed inconsistency when creating torrents with symlinks
|
||||||
* properly detect windows version to initialize half-open connection limit
|
* properly detect windows version to initialize half-open connection limit
|
||||||
|
|
|
@ -41,12 +41,27 @@ using namespace libtorrent;
|
||||||
|
|
||||||
int main(int argc, char const* argv[])
|
int main(int argc, char const* argv[])
|
||||||
{
|
{
|
||||||
if (argc != 3)
|
if (argc != 3 && argc != 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: fragmentation_test torrent-file file-storage-path\n");
|
fprintf(stderr, "Usage: fragmentation_test torrent-file file-storage-path\n"
|
||||||
|
" fragmentation_test file\n\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc == 2)
|
||||||
|
{
|
||||||
|
error_code ec;
|
||||||
|
file f(argv[1], file::read_only, ec);
|
||||||
|
if (ec)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error opening file %s: %s\n", argv[1], ec.message().c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
size_type off = f.phys_offset(0);
|
||||||
|
printf("physical offset of file %s: %" PRId64 "\n", argv[1], off);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
error_code ec;
|
error_code ec;
|
||||||
boost::intrusive_ptr<torrent_info> ti(new torrent_info(argv[1], ec));
|
boost::intrusive_ptr<torrent_info> ti(new torrent_info(argv[1], ec));
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#ifdef HAVE_LINUX_FIEMAP_H
|
#ifdef HAVE_LINUX_FIEMAP_H
|
||||||
#include <linux/fiemap.h>
|
#include <linux/fiemap.h> // FIEMAP_*
|
||||||
|
#include <linux/fs.h> // FS_IOC_FIEMAP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <asm/unistd.h> // For __NR_fallocate
|
#include <asm/unistd.h> // For __NR_fallocate
|
||||||
|
@ -1394,7 +1395,7 @@ namespace libtorrent
|
||||||
|
|
||||||
size_type file::phys_offset(size_type offset)
|
size_type file::phys_offset(size_type offset)
|
||||||
{
|
{
|
||||||
#ifdef FS_IOC_FIEMAP
|
#ifdef FIEMAP_EXTENT_UNKNOWN
|
||||||
// for documentation of this feature
|
// for documentation of this feature
|
||||||
// http://lwn.net/Articles/297696/
|
// http://lwn.net/Articles/297696/
|
||||||
struct
|
struct
|
||||||
|
|
Loading…
Reference in New Issue