mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 14:19:21 +00:00
get rid of fs_stat.h and configure checks
These are used in libtorrent, not here. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
committed by
Jari Sundell
parent
6c25e64c26
commit
ad862f4b44
@@ -9,7 +9,6 @@ EXTRA_DIST= \
|
|||||||
rak/algorithm.h \
|
rak/algorithm.h \
|
||||||
rak/error_number.h \
|
rak/error_number.h \
|
||||||
rak/file_stat.h \
|
rak/file_stat.h \
|
||||||
rak/fs_stat.h \
|
|
||||||
rak/path.h \
|
rak/path.h \
|
||||||
rak/partial_queue.h \
|
rak/partial_queue.h \
|
||||||
rak/regex.h \
|
rak/regex.h \
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ TORRENT_ENABLE_ARCH
|
|||||||
TORRENT_WITH_SYSROOT
|
TORRENT_WITH_SYSROOT
|
||||||
|
|
||||||
TORRENT_WITHOUT_VARIABLE_FDSET
|
TORRENT_WITHOUT_VARIABLE_FDSET
|
||||||
TORRENT_WITHOUT_STATVFS
|
|
||||||
TORRENT_WITHOUT_STATFS
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(execinfo,
|
AC_ARG_ENABLE(execinfo,
|
||||||
AS_HELP_STRING([--disable-execinfo],
|
AS_HELP_STRING([--disable-execinfo],
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
// rak - Rakshasa's toolbox
|
|
||||||
// Copyright (C) 2005-2007, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#ifndef RAK_FS_STAT_H
|
|
||||||
#define RAK_FS_STAT_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <cinttypes>
|
|
||||||
|
|
||||||
#include <rak/error_number.h>
|
|
||||||
|
|
||||||
#if HAVE_SYS_VFS_H
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_STATVFS_H
|
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_STATFS_H
|
|
||||||
#include <sys/statfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_MOUNT_H
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace rak {
|
|
||||||
|
|
||||||
class fs_stat {
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef FS_STAT_SIZE_TYPE blocksize_type;
|
|
||||||
typedef FS_STAT_COUNT_TYPE blockcount_type;
|
|
||||||
typedef FS_STAT_STRUCT fs_stat_type;
|
|
||||||
|
|
||||||
bool update(int fd) { return FS_STAT_FD; }
|
|
||||||
bool update(const char* fn) { return FS_STAT_FN; }
|
|
||||||
bool update(const std::string& filename) { return update(filename.c_str()); }
|
|
||||||
|
|
||||||
blocksize_type blocksize() { return FS_STAT_BLOCK_SIZE; }
|
|
||||||
blockcount_type blocks_avail() { return m_stat.f_bavail; }
|
|
||||||
int64_t bytes_avail() { return (int64_t) blocksize() * m_stat.f_bavail; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
fs_stat_type m_stat;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -170,121 +170,6 @@ AC_DEFUN([TORRENT_WITH_POSIX_FALLOCATE], [
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_CHECK_STATVFS], [
|
|
||||||
AC_CHECK_HEADERS(sys/vfs.h sys/statvfs.h sys/statfs.h)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for statvfs)
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#if HAVE_SYS_VFS_H
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_STATVFS_H
|
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_STATFS_H
|
|
||||||
#include <sys/statfs.h>
|
|
||||||
#endif
|
|
||||||
]], [[
|
|
||||||
struct statvfs s; fsblkcnt_t c;
|
|
||||||
statvfs("", &s);
|
|
||||||
fstatvfs(0, &s);
|
|
||||||
]])],[
|
|
||||||
AC_DEFINE(FS_STAT_FD, [fstatvfs(fd, &m_stat) == 0], Function to determine filesystem stats from fd)
|
|
||||||
AC_DEFINE(FS_STAT_FN, [statvfs(fn, &m_stat) == 0], Function to determine filesystem stats from filename)
|
|
||||||
AC_DEFINE(FS_STAT_STRUCT, [struct statvfs], Type of second argument to statfs function)
|
|
||||||
AC_DEFINE(FS_STAT_SIZE_TYPE, [unsigned long], Type of block size member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_COUNT_TYPE, [fsblkcnt_t], Type of block count member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_BLOCK_SIZE, [(m_stat.f_frsize)], Determine the block size)
|
|
||||||
AC_MSG_RESULT(ok)
|
|
||||||
have_stat_vfs=yes
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
have_stat_vfs=no
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_CHECK_STATFS], [
|
|
||||||
AC_CHECK_HEADERS(sys/statfs.h sys/param.h sys/mount.h)
|
|
||||||
|
|
||||||
AC_MSG_CHECKING(for statfs)
|
|
||||||
|
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#if HAVE_SYS_STATFS_H
|
|
||||||
#include <sys/statfs.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_PARAM_H
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
#if HAVE_SYS_MOUNT_H
|
|
||||||
#include <sys/mount.h>
|
|
||||||
#endif
|
|
||||||
]], [[
|
|
||||||
struct statfs s;
|
|
||||||
statfs("", &s);
|
|
||||||
fstatfs(0, &s);
|
|
||||||
]])],[
|
|
||||||
AC_DEFINE(FS_STAT_FD, [fstatfs(fd, &m_stat) == 0], Function to determine filesystem stats from fd)
|
|
||||||
AC_DEFINE(FS_STAT_FN, [statfs(fn, &m_stat) == 0], Function to determine filesystem stats from filename)
|
|
||||||
AC_DEFINE(FS_STAT_STRUCT, [struct statfs], Type of second argument to statfs function)
|
|
||||||
AC_DEFINE(FS_STAT_SIZE_TYPE, [long], Type of block size member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_COUNT_TYPE, [long], Type of block count member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_BLOCK_SIZE, [(m_stat.f_bsize)], Determine the block size)
|
|
||||||
AC_MSG_RESULT(ok)
|
|
||||||
have_stat_vfs=yes
|
|
||||||
],[
|
|
||||||
AC_MSG_RESULT(no)
|
|
||||||
have_stat_vfs=no
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_DISABLED_STATFS], [
|
|
||||||
AC_DEFINE(FS_STAT_FD, [(errno = ENOSYS) == 0], Function to determine filesystem stats from fd)
|
|
||||||
AC_DEFINE(FS_STAT_FN, [(errno = ENOSYS) == 0], Function to determine filesystem stats from filename)
|
|
||||||
AC_DEFINE(FS_STAT_STRUCT, [struct {blocksize_type f_bsize; blockcount_type f_bavail;}], Type of second argument to statfs function)
|
|
||||||
AC_DEFINE(FS_STAT_SIZE_TYPE, [int], Type of block size member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_COUNT_TYPE, [int], Type of block count member in stat struct)
|
|
||||||
AC_DEFINE(FS_STAT_BLOCK_SIZE, [(4096)], Determine the block size)
|
|
||||||
AC_MSG_RESULT(No filesystem stats available)
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_WITHOUT_STATVFS], [
|
|
||||||
AC_ARG_WITH(statvfs,
|
|
||||||
AS_HELP_STRING([--without-statvfs],[don't try to use statvfs to find free diskspace]),
|
|
||||||
[
|
|
||||||
if test "$withval" = "yes"; then
|
|
||||||
TORRENT_CHECK_STATVFS
|
|
||||||
else
|
|
||||||
have_stat_vfs=no
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[
|
|
||||||
TORRENT_CHECK_STATVFS
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_WITHOUT_STATFS], [
|
|
||||||
AC_ARG_WITH(statfs,
|
|
||||||
AS_HELP_STRING([--without-statfs],[don't try to use statfs to find free diskspace]),
|
|
||||||
[
|
|
||||||
if test "$have_stat_vfs" = "no"; then
|
|
||||||
if test "$withval" = "yes"; then
|
|
||||||
TORRENT_CHECK_STATFS
|
|
||||||
else
|
|
||||||
TORRENT_DISABLED_STATFS
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
],
|
|
||||||
[
|
|
||||||
if test "$have_stat_vfs" = "no"; then
|
|
||||||
TORRENT_CHECK_STATFS
|
|
||||||
if test "$have_stat_vfs" = "no"; then
|
|
||||||
TORRENT_DISABLED_STATFS
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([TORRENT_WITH_ADDRESS_SPACE], [
|
AC_DEFUN([TORRENT_WITH_ADDRESS_SPACE], [
|
||||||
AC_ARG_WITH(address-space,
|
AC_ARG_WITH(address-space,
|
||||||
AS_HELP_STRING([--with-address-space=MB],[change the default address space size [[default=1024mb]]]),
|
AS_HELP_STRING([--with-address-space=MB],[change the default address space size [[default=1024mb]]]),
|
||||||
|
|||||||
Reference in New Issue
Block a user