Skip to content

Instantly share code, notes, and snippets.

@kiryl
Created July 27, 2016 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiryl/2b344b51da1fd2725be420a996b10d22 to your computer and use it in GitHub Desktop.
Save kiryl/2b344b51da1fd2725be420a996b10d22 to your computer and use it in GitHub Desktop.
#define _GNU_SOURCE
#include <fcntl.h>
#include <limits.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/fs.h>
int main(int argc, char **argv)
{
struct file_dedupe_range file_dedupe_range = {
.dest_count = USHRT_MAX,
};
int fd;
fd = open("/tmp/", O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
ioctl(fd, FIDEDUPERANGE, &file_dedupe_range);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment