fixed template loading/unloading
identation cleanups
This commit is contained in:
@@ -462,21 +462,15 @@ static int cowfs_symlink(const char *from, const char *to)
|
|||||||
static int cowfs_rename(const char *from, const char *to)
|
static int cowfs_rename(const char *from, const char *to)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
|
|
||||||
rel(&from);
|
rel(&from);
|
||||||
rel(&to);
|
rel(&to);
|
||||||
|
|
||||||
fd = get_rd(from);
|
|
||||||
if (fd == this->master_fd)
|
|
||||||
{
|
|
||||||
fd = copy(from);
|
fd = copy(from);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (renameat(fd, from, get_wr(to), to) < 0)
|
if (renameat(fd, from, get_wr(to), to) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -517,12 +511,9 @@ static int cowfs_chmod(const char *path, mode_t mode)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
|
|
||||||
rel(&path);
|
rel(&path);
|
||||||
fd = get_rd(path);
|
fd = get_rd(path);
|
||||||
if (fd == this->master_fd)
|
|
||||||
{
|
|
||||||
if (fstatat(fd, path, &st, 0) < 0)
|
if (fstatat(fd, path, &st, 0) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -536,7 +527,6 @@ static int cowfs_chmod(const char *path, mode_t mode)
|
|||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (fchmodat(fd, path, mode, 0) < 0)
|
if (fchmodat(fd, path, mode, 0) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -551,12 +541,9 @@ static int cowfs_chown(const char *path, uid_t uid, gid_t gid)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
|
|
||||||
rel(&path);
|
rel(&path);
|
||||||
fd = get_rd(path);
|
fd = get_rd(path);
|
||||||
if (fd == this->master_fd)
|
|
||||||
{
|
|
||||||
if (fstatat(fd, path, &st, 0) < 0)
|
if (fstatat(fd, path, &st, 0) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -570,7 +557,6 @@ static int cowfs_chown(const char *path, uid_t uid, gid_t gid)
|
|||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (fchownat(fd, path, uid, gid, AT_SYMLINK_NOFOLLOW) < 0)
|
if (fchownat(fd, path, uid, gid, AT_SYMLINK_NOFOLLOW) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -586,12 +572,8 @@ static int cowfs_truncate(const char *path, off_t size)
|
|||||||
int fd;
|
int fd;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
|
|
||||||
rel(&path);
|
rel(&path);
|
||||||
fd = get_rd(path);
|
fd = get_rd(path);
|
||||||
if (fd == this->master_fd)
|
|
||||||
{
|
|
||||||
if (fstatat(fd, path, &st, 0) < 0)
|
if (fstatat(fd, path, &st, 0) < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
@@ -605,7 +587,6 @@ static int cowfs_truncate(const char *path, off_t size)
|
|||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fd = openat(fd, path, O_WRONLY);
|
fd = openat(fd, path, O_WRONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
@@ -627,18 +608,13 @@ static int cowfs_utimens(const char *path, const struct timespec ts[2])
|
|||||||
{
|
{
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
int fd;
|
int fd;
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
|
|
||||||
rel(&path);
|
rel(&path);
|
||||||
fd = get_rd(path);
|
|
||||||
if (fd == this->master_fd)
|
|
||||||
{
|
|
||||||
fd = copy(path);
|
fd = copy(path);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tv[0].tv_sec = ts[0].tv_sec;
|
tv[0].tv_sec = ts[0].tv_sec;
|
||||||
tv[0].tv_usec = ts[0].tv_nsec / 1000;
|
tv[0].tv_usec = ts[0].tv_nsec / 1000;
|
||||||
@@ -704,21 +680,15 @@ static int cowfs_read(const char *path, char *buf, size_t size, off_t offset,
|
|||||||
static int cowfs_write(const char *path, const char *buf, size_t size,
|
static int cowfs_write(const char *path, const char *buf, size_t size,
|
||||||
off_t offset, struct fuse_file_info *fi)
|
off_t offset, struct fuse_file_info *fi)
|
||||||
{
|
{
|
||||||
private_cowfs_t *this = get_this();
|
|
||||||
int file, fd, res;
|
int file, fd, res;
|
||||||
|
|
||||||
rel(&path);
|
rel(&path);
|
||||||
|
|
||||||
fd = get_wr(path);
|
|
||||||
if (fd == this->master_fd ||
|
|
||||||
(this->over_fd > 0 && fd == this->host_fd))
|
|
||||||
{
|
|
||||||
fd = copy(path);
|
fd = copy(path);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
file = openat(fd, path, O_WRONLY);
|
file = openat(fd, path, O_WRONLY);
|
||||||
if (file < 0)
|
if (file < 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user