mirror of https://github.com/trapexit/mergerfs.git
Antonio SJ Musumeci
6 years ago
9 changed files with 425 additions and 144 deletions
-
2README.md
-
30libfuse/include/fuse.h
-
46libfuse/include/fuse_lowlevel.h
-
161libfuse/lib/fuse.c
-
118libfuse/lib/fuse_lowlevel.c
-
2man/mergerfs.1
-
71src/fuse_copy_file_range.cpp
-
30src/fuse_copy_file_range.hpp
-
109src/mergerfs.cpp
@ -0,0 +1,71 @@ |
|||
/*
|
|||
Copyright (c) 2019, 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 "errno.hpp"
|
|||
#include "fileinfo.hpp"
|
|||
#include "fs_copy_file_range.hpp"
|
|||
|
|||
#include <fuse.h>
|
|||
|
|||
#include <stdio.h>
|
|||
|
|||
namespace l |
|||
{ |
|||
static |
|||
ssize_t |
|||
copy_file_range(const int fd_in_, |
|||
off_t offset_in_, |
|||
const int fd_out_, |
|||
off_t offset_out_, |
|||
size_t size_, |
|||
int flags_) |
|||
{ |
|||
ssize_t rv; |
|||
|
|||
rv = fs::copy_file_range(fd_in_, |
|||
&offset_in_, |
|||
fd_out_, |
|||
&offset_out_, |
|||
size_, |
|||
flags_); |
|||
|
|||
return ((rv == -1) ? -errno : rv); |
|||
} |
|||
} |
|||
|
|||
namespace FUSE |
|||
{ |
|||
ssize_t |
|||
copy_file_range(const char *path_in_, |
|||
struct fuse_file_info *ffi_in_, |
|||
off_t offset_in_, |
|||
const char *path_out_, |
|||
struct fuse_file_info *ffi_out_, |
|||
off_t offset_out_, |
|||
size_t size_, |
|||
int flags_) |
|||
{ |
|||
FileInfo *fi_in = reinterpret_cast<FileInfo*>(ffi_in_->fh); |
|||
FileInfo *fi_out = reinterpret_cast<FileInfo*>(ffi_out_->fh); |
|||
|
|||
return l::copy_file_range(fi_in->fd, |
|||
offset_in_, |
|||
fi_out->fd, |
|||
offset_out_, |
|||
size_, |
|||
flags_); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
/*
|
|||
Copyright (c) 2019, 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. |
|||
*/ |
|||
|
|||
#pragma once
|
|||
|
|||
namespace FUSE |
|||
{ |
|||
ssize_t |
|||
copy_file_range(const char *path_in, |
|||
struct fuse_file_info *ffi_in, |
|||
off_t offset_in, |
|||
const char *path_out, |
|||
struct fuse_file_info *ffi_out, |
|||
off_t offset_out, |
|||
size_t size, |
|||
int flags); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue