Topic
2 replies Latest Post - ‏2013-02-06T18:43:12Z by SystemAdmin
styerd
styerd
14 Posts
ACCEPTED ANSWER

Pinned topic Anyone have file system development experience?

‏2010-11-11T15:02:04Z |
AIX provides a virtual file system interface that, well, basically allows one to create new file system types. Chapter 3, Virtual File Systems, in the Kernel Extensions and Device Support Programming Concepts manual covers much (but of course not all) of it. It makes for an interesting exercise. I currently have a file system skeleton in place. I can add files and directories and read and write to them but there are a few issues that I cannot seem to resolve ...

1. I cannot list the contents of a directory in the file system. I expected that an "ls" command would eventually call "vn_readdir" but it does not. An "ls" without parameters makes a "vn_lookup" call for a directory named "." to which I return a vnode pointer to the current directory (lets say we are currently in the V_ROOT directory). Truss tells me that "getdirent64" is called but my underlying vn_readdir" is not called. I'll enable the kernel debugger and dust off my "kdb" and take a closer look but I'm wondering if I'm missing something basic (yes the returned vnode is type VDIR) ...

2. I don't see any documentation about how file pointers (read/write) associated with the file descriptors are managed. I assumed that the logical layer would handle them mindelessly but several writes one after another do not affect the incoming "offset". I could manage them myself but that seems wrong since they are per process. The user file descriptor is not available to the "vn_" interfaces. None of the "vn_" man pages provide a clue ...
Updated on 2013-02-06T18:43:12Z at 2013-02-06T18:43:12Z by SystemAdmin
  • styerd
    styerd
    14 Posts
    ACCEPTED ANSWER

    Re: Anyone have file system development experience?

    ‏2010-11-16T18:03:16Z  in response to styerd
    I resolved my own problems ...

    I was not setting va_mode to _S_IFDIR returned by vn_getattr ... even thought the vnode type, v_vntype, was correctly set to VDIR. With this now set vn_readdir is called as expected.

    My other problem was just dumb. I was attempting to print a 64 bit offset value with uprintf in the kernel. And so it just always appeared to be zero. Sigh.
    • SystemAdmin
      SystemAdmin
      549 Posts
      ACCEPTED ANSWER

      Re: Anyone have file system development experience?

      ‏2013-02-06T18:43:12Z  in response to styerd
      I am working on a filesystem on AIX and I am running in to bad_vnode_bad_caller being called from vnop_getattr and I haven't been able to figure anything out. Do you have any insight and/or a skeleton filesystem?