0

I'm trying to mount my filesystem to a empty directory. The directory is /home/test. I have the following functions already written:

  • access
  • getattr
  • readdir
  • statfs
  • mkdir
  • rmdir
  • create
  • write
  • read

I use the command ./fusetest /home/test -d to mount my filesystem. When I try to ls under the directory of /home/test, I get the error information:

ls: cannot open directory .: Input/output error"

Like the following image shows :

enter image description here

And the debug information is here: enter image description here

What is the problem and how do I fix it?

jww
  • 97,681
  • 90
  • 411
  • 885
Erdong
  • 1
  • 1
  • 1
  • 1
    You should probably show the code for some of the functions. `open` and `read` seem like top candidates. Also, the value of `$?` may be helpful to pull the error code from the shell. – jww Jul 27 '17 at 02:41
  • I am sorry that I have not understanded you meanings. Because I implemented a DFS by c++. The code is too much . And how to use the value of $? Thankyou very much! – Erdong Jul 27 '17 at 02:59
  • 1
    Well, you need to have to provide something for Stack Overflow to work with. Without the relevant code someone needs a orbuculum to hazard a guess. Do you have a GitHub with the source? `echo $?` prints the last error. In your case, it may give you a toehold for the problem, or it may be totally irrelevant. – jww Jul 27 '17 at 03:05
  • oh,I know your meanings. The code haven't opened on github so far. – Erdong Jul 27 '17 at 03:29
  • For me, I had a bad fuse mount. I did a umount -a bad_directory and the directory behaved normally again. – Arkham Angel Sep 04 '22 at 16:21

1 Answers1

0

Your debug information doesn't show the os.ModeDir info. I'm guessing you didn't do a binary conversion between your unit type code and the required format. It goes something like this for Golang (since your question doesn't specify the language or the library you're using):

attr.Mode = os.ModeDir | uint32(0644)
sronin
  • 11
  • 2