Marc, regarding your dentry full pathname function (and Serge's): I've not
yet looked at either in detail but what I think is needed (assuming it's not
there already) is this:

- a flag to pass to the function: if true, returns full path names starting
  w/ a '/' and crossing mount points.  There are cases you want one behavior
  and cases for another.

- if the flag is false, return relative pathname to this super_block

- a faster method than constant shifting of the bytes.  This is a serious
  one.  If you keep shifting bytes for each component, your complexity is
  O(n^2).  You can make it 2*O(n) as follows:

  (1) first, scan the dentrys and their parents in reverse, cross mount
      points as needed.

  (2) sum up the total number of bytes needed, from the q_str structures.

  (3) allocate the correct number of bytes (or verify that the user passed
      enough space)

  (4) repeat the reverse traversal, but this time, copy the bytes into the
      output buffer directly at their offsets into the buffer (don't copy
      any terminating nulls so you won't trash the beginning of the
      component that followed).

I'll be happy to help anyone write or test such a version (I started
something similar a while back).  I think it would be a useful small
addition to the kernel.

Erez.

Reply via email to