fixed FIEMAP support on linux

This commit is contained in:
Arvid Norberg
2010-04-11 00:48:48 +00:00
parent 6975f4b350
commit 6851254fdf
3 changed files with 21 additions and 4 deletions

View File

@@ -41,12 +41,27 @@ using namespace libtorrent;
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;
}
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;
boost::intrusive_ptr<torrent_info> ti(new torrent_info(argv[1], ec));