Skip to content

Commit

Permalink
lxcfs_read: Combine last 3 commits into one commit that changes the m…
Browse files Browse the repository at this point in the history
…acros

Signed-off-by: Devon Schwartz <[email protected]>
  • Loading branch information
DevonSchwartz committed May 3, 2024
1 parent d837e79 commit 0cb15be
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lxcfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,28 +876,34 @@ static int lxcfs_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
int ret;
enum lxcfs_virt_t type;

type = file_info_type(fi);

if (cgroup_is_enabled && strncmp(path, "/cgroup", 7) == 0) {
if (LXCFS_TYPE_CGROUP(type)) {
up_users();
ret = do_cg_read(path, buf, size, offset, fi);
down_users();
return ret;
}

if (strncmp(path, "/proc", 5) == 0) {
if (LXCFS_TYPE_PROC(type)) {
up_users();
ret = do_proc_read(path, buf, size, offset, fi);
down_users();
return ret;
}

if (strncmp(path, "/sys", 4) == 0) {
if (LXCFS_TYPE_SYS(type)) {
up_users();
ret = do_sys_read(path, buf, size, offset, fi);
down_users();
return ret;
}

lxcfs_error("unknown file type: path=%s, type=%d, fi->fh=%" PRIu64,
path, type, fi->fh);

return -EINVAL;
}

Expand Down

0 comments on commit 0cb15be

Please sign in to comment.