Displaying 1 result from an estimated 1 matches for "dst_desc".
Did you mean:
drv_desc
2013 Oct 16
0
[BUG] Reflinking fails for files >2GB on 32-bit platform
...<errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
bool os_create_reflink(const char* linkname, const char* fname)
{
int src_desc=open(fname, O_RDONLY);
if( src_desc<0)
return false;
int dst_desc=open(linkname, O_WRONLY | O_CREAT | O_EXCL, S_IRWXU | S_IRWXG);
if( dst_desc<0 )
{
close(src_desc);
return false;
}
#define BTRFS_IOCTL_MAGIC 0x94
#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
int rc=ioctl(dst_desc, BTRFS_IOC_CLONE, src_desc);
close(src_desc);
c...