Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8302125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:12:20+00:00 2026-06-08T17:12:20+00:00

In the implemention of xxx_readdir() in FUSE , I use the codes below: static

  • 0

In the implemention of xxx_readdir() in FUSE, I use the codes below:

static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
                         off_t offset, struct fuse_file_info *fi)
{
    DIR *dp;
    struct dirent *de;

    (void) offset;
    (void) fi;

    dp = opendir(path);
    if (dp == NULL)
        return -errno;

    while ((de = readdir(dp)) != NULL) {
        struct stat st;
        memset(&st, 0, sizeof(st));
        st.st_ino = de->d_ino;
        st.st_mode = de->d_type << 12;
        if (filler(buf, de->d_name, &st, 0))
            break;
    }

    closedir(dp);
    return 0;
}

Then, compile and execute on a foler:

./hello /tmp/hello/

When I use ls /tmp/hello/ command, the results are as below:

bin   dev  home  lib64       media  opt   root  sbin  sys  usr
boot  etc  lib   lost+found  mnt    proc  run   srv   tmp  var

However, I have not created any file or directory in /tmp/hello/. So, why are these direcoties reside on it when I use the ls command?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:12:22+00:00Added an answer on June 8, 2026 at 5:12 pm

    You call:

    dp = opendir(path);
    

    to begin your readdir implementation. When you call that path is relative to the root of your filesystem, not an absolute path on your system.

    So in /tmp/hello/ the value of path will be ‘/’ because it doesn’t make sense for filesystems to need to know the details of where they’re mounted. There’s a deliberate abstraction there that makes it such that each filesystem is only concerned with things it stores.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the code: public static int sum(String a, String b) /* throws? WHAT? */
There is a new style of implemention menues which I see around stylish web
when implementing a recursive function during development, i will use a counter and exit
I am making a program which makes use of a couple of constants. At
I'm using the static code analyser in objective C and I found that using
I'm trying to use Backbone with an API. The default API response format is:
For members, I use //.......vv SomeType m_XXX; //.......^^ I'd love to use _ as
I have an interface method public void Execute(ICommand command); which needs to pass known
Implementing a custom Dependency Property on a Framework Element object causes my Visual Studio
Implementing the ScriptControlClass was extremely easy, unfortunately the side effects with the language implementation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.