Browse Source

restructure fallocate abstraction

pull/391/head
Antonio SJ Musumeci 8 years ago
parent
commit
e2acffe55b
  1. 2
      src/fallocate.cpp
  2. 8
      src/fs_base_fallocate.cpp
  3. 6
      src/fs_base_fallocate.hpp
  4. 1
      src/fs_base_fallocate_linux.icpp
  5. 6
      src/fs_base_fallocate_osx.icpp
  6. 1
      src/fs_base_fallocate_posix.icpp
  7. 1
      src/fs_base_fallocate_unsupported.icpp
  8. 2
      src/fs_clonefile.cpp

2
src/fallocate.cpp

@ -20,7 +20,7 @@
#include "errno.hpp" #include "errno.hpp"
#include "fileinfo.hpp" #include "fileinfo.hpp"
#include "fs_fallocate.hpp"
#include "fs_base_fallocate.hpp"
static static
int int

8
src/fs_fallocate.cpp → src/fs_base_fallocate.cpp

@ -17,11 +17,11 @@
#include <fcntl.h> #include <fcntl.h>
#ifdef __linux__ #ifdef __linux__
# include "fs_fallocate_linux.icpp"
# include "fs_base_fallocate_linux.icpp"
#elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L #elif _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L
# include "fs_fallocate_posix.icpp"
# include "fs_base_fallocate_posix.icpp"
#elif __APPLE__ #elif __APPLE__
# include "fs_fallocate_osx.icpp"
# include "fs_base_fallocate_osx.icpp"
#else #else
# include "fs_fallocate_unsupported.icpp"
# include "fs_base_fallocate_unsupported.icpp"
#endif #endif

6
src/fs_fallocate.hpp → src/fs_base_fallocate.hpp

@ -14,8 +14,8 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#ifndef __FS_FALLOCATE_HPP__
#define __FS_FALLOCATE_HPP__
#ifndef __FS_BASE_FALLOCATE_HPP__
#define __FS_BASE_FALLOCATE_HPP__
#include <fcntl.h> #include <fcntl.h>
@ -28,4 +28,4 @@ namespace fs
const off_t len); const off_t len);
} }
#endif // __FS_FALLOCATE_HPP__
#endif

1
src/fs_fallocate_linux.icpp → src/fs_base_fallocate_linux.icpp

@ -17,7 +17,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "errno.hpp" #include "errno.hpp"
#include "fs_fallocate.hpp"
namespace fs namespace fs
{ {

6
src/fs_fallocate_osx.icpp → src/fs_base_fallocate_osx.icpp

@ -15,12 +15,10 @@
*/ */
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h>
#include "errno.hpp" #include "errno.hpp"
#include "fs_fallocate.hpp"
namespace fs
{
static static
int int
_fallocate_core(const int fd, _fallocate_core(const int fd,
@ -43,6 +41,8 @@ namespace fs
return ::ftruncate(fd,(offset+len)); return ::ftruncate(fd,(offset+len));
} }
namespace fs
{
int int
fallocate(const int fd, fallocate(const int fd,
const int mode, const int mode,

1
src/fs_fallocate_posix.icpp → src/fs_base_fallocate_posix.icpp

@ -17,7 +17,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "errno.hpp" #include "errno.hpp"
#include "fs_fallocate.hpp"
namespace fs namespace fs
{ {

1
src/fs_fallocate_unsupported.icpp → src/fs_base_fallocate_unsupported.icpp

@ -15,7 +15,6 @@
*/ */
#include "errno.hpp" #include "errno.hpp"
#include "fs_fallocate.hpp"
namespace fs namespace fs
{ {

2
src/fs_clonefile.cpp

@ -25,6 +25,7 @@
#include "fs_base_chmod.hpp" #include "fs_base_chmod.hpp"
#include "fs_base_chown.hpp" #include "fs_base_chown.hpp"
#include "fs_base_close.hpp" #include "fs_base_close.hpp"
#include "fs_base_fallocate.hpp"
#include "fs_base_lseek.hpp" #include "fs_base_lseek.hpp"
#include "fs_base_mkdir.hpp" #include "fs_base_mkdir.hpp"
#include "fs_base_open.hpp" #include "fs_base_open.hpp"
@ -33,7 +34,6 @@
#include "fs_base_utime.hpp" #include "fs_base_utime.hpp"
#include "fs_base_write.hpp" #include "fs_base_write.hpp"
#include "fs_fadvise.hpp" #include "fs_fadvise.hpp"
#include "fs_fallocate.hpp"
#include "fs_sendfile.hpp" #include "fs_sendfile.hpp"
#include "fs_xattr.hpp" #include "fs_xattr.hpp"

Loading…
Cancel
Save