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)
|
||||
{
|
||||
int fd;
|
||||
private_cowfs_t *this = get_this();
|
||||
|
||||
rel(&from);
|
||||
rel(&to);
|
||||
|
||||
fd = get_rd(from);
|
||||
if (fd == this->master_fd)
|
||||
{
|
||||
fd = copy(from);
|
||||
if (fd < 0)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
if (renameat(fd, from, get_wr(to), to) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -517,12 +511,9 @@ static int cowfs_chmod(const char *path, mode_t mode)
|
||||
{
|
||||
int fd;
|
||||
struct stat st;
|
||||
private_cowfs_t *this = get_this();
|
||||
|
||||
rel(&path);
|
||||
fd = get_rd(path);
|
||||
if (fd == this->master_fd)
|
||||
{
|
||||
if (fstatat(fd, path, &st, 0) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -536,7 +527,6 @@ static int cowfs_chmod(const char *path, mode_t mode)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
if (fchmodat(fd, path, mode, 0) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -551,12 +541,9 @@ static int cowfs_chown(const char *path, uid_t uid, gid_t gid)
|
||||
{
|
||||
int fd;
|
||||
struct stat st;
|
||||
private_cowfs_t *this = get_this();
|
||||
|
||||
rel(&path);
|
||||
fd = get_rd(path);
|
||||
if (fd == this->master_fd)
|
||||
{
|
||||
if (fstatat(fd, path, &st, 0) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -570,7 +557,6 @@ static int cowfs_chown(const char *path, uid_t uid, gid_t gid)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
if (fchownat(fd, path, uid, gid, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -586,12 +572,8 @@ static int cowfs_truncate(const char *path, off_t size)
|
||||
int fd;
|
||||
struct stat st;
|
||||
|
||||
private_cowfs_t *this = get_this();
|
||||
|
||||
rel(&path);
|
||||
fd = get_rd(path);
|
||||
if (fd == this->master_fd)
|
||||
{
|
||||
if (fstatat(fd, path, &st, 0) < 0)
|
||||
{
|
||||
return -errno;
|
||||
@@ -605,7 +587,6 @@ static int cowfs_truncate(const char *path, off_t size)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
fd = openat(fd, path, O_WRONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
@@ -627,18 +608,13 @@ static int cowfs_utimens(const char *path, const struct timespec ts[2])
|
||||
{
|
||||
struct timeval tv[2];
|
||||
int fd;
|
||||
private_cowfs_t *this = get_this();
|
||||
|
||||
rel(&path);
|
||||
fd = get_rd(path);
|
||||
if (fd == this->master_fd)
|
||||
{
|
||||
fd = copy(path);
|
||||
if (fd < 0)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
tv[0].tv_sec = ts[0].tv_sec;
|
||||
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,
|
||||
off_t offset, struct fuse_file_info *fi)
|
||||
{
|
||||
private_cowfs_t *this = get_this();
|
||||
int file, fd, res;
|
||||
|
||||
rel(&path);
|
||||
|
||||
fd = get_wr(path);
|
||||
if (fd == this->master_fd ||
|
||||
(this->over_fd > 0 && fd == this->host_fd))
|
||||
{
|
||||
fd = copy(path);
|
||||
if (fd < 0)
|
||||
{
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
file = openat(fd, path, O_WRONLY);
|
||||
if (file < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user