mirror of https://github.com/trapexit/mergerfs.git
Browse Source
Merge pull request #330 from trapexit/cleanup
Merge pull request #330 from trapexit/cleanup
further abstraction of system callspull/333/head
Antonio SJ Musumeci
8 years ago
committed by
GitHub
8 changed files with 121 additions and 15 deletions
-
2src/access.cpp
-
5src/fs.cpp
-
17src/fs_base_access.hpp
-
33src/fs_base_lseek.hpp
-
10src/fs_base_read.hpp
-
42src/fs_base_realpath.hpp
-
10src/fs_base_write.hpp
-
17src/fs_clonefile.cpp
@ -0,0 +1,33 @@ |
|||
/*
|
|||
ISC License |
|||
|
|||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link> |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted, provided that the above |
|||
copyright notice and this permission notice appear in all copies. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
*/ |
|||
|
|||
#include <sys/types.h>
|
|||
#include <unistd.h>
|
|||
|
|||
namespace fs |
|||
{ |
|||
static |
|||
inline |
|||
off_t |
|||
lseek(const int fd, |
|||
const off_t offset, |
|||
const int whence) |
|||
{ |
|||
return ::lseek(fd,offset,whence); |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
/*
|
|||
ISC License |
|||
|
|||
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link> |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted, provided that the above |
|||
copyright notice and this permission notice appear in all copies. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
|||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
|||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
|||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
|||
*/ |
|||
|
|||
#include <string>
|
|||
|
|||
#include <limits.h>
|
|||
#include <stdlib.h>
|
|||
|
|||
namespace fs |
|||
{ |
|||
static |
|||
inline |
|||
char * |
|||
realpath(const std::string &path, |
|||
char *resolved_path) |
|||
{ |
|||
return ::realpath(path.c_str(),resolved_path); |
|||
} |
|||
|
|||
static |
|||
inline |
|||
char * |
|||
realpath(const std::string &path) |
|||
{ |
|||
return fs::realpath(path,NULL); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue