[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libnetfs: translators, symlinks and co

From: Gaël Le Mignot
Subject: libnetfs: translators, symlinks and co
Date: Mon, 13 Jan 2003 19:35:22 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)


        I'm trying to write a 'mirrorfs' translator (a translator that
duplicates a  sub-tree of  the filesystem, a  bit like a  symlink, but
with  it's own internal  tree and  nodes). It's  not really  useful, I
know, but I do it mostely to learn how to use libnetfs.

        My  questions  are  about  how translators  and  symlinks  are
handled by libnetfs.

* when the  users tries  to put  a passive translator  on a  node, the
  callback  function   `netfs_set_translator'  is  called.   But  this
  function is not provided informations about what should be done with
  the previously running translator  (those informations are passed by
  the caller of the `file_set_translator' function, but libnetfs "eat"
  them and do not forward them to the callback). So, I wonder how I can
  mimic the "standard" behavior of settrans:
(kilobug@kesto, 44) ~/src/mirrorfs $ rm plop
(kilobug@kesto, 45) ~/src/mirrorfs $ touch plop
(kilobug@kesto, 46) ~/src/mirrorfs $ settrans plop /hurd/null 
(kilobug@kesto, 47) ~/src/mirrorfs $ cat plop
(kilobug@kesto, 48) ~/src/mirrorfs $ settrans plop /hurd/null 
settrans: plop: Device or resource busy
(kilobug@kesto, 49) ~/src/mirrorfs $ settrans -fg plop /hurd/null 
(kilobug@kesto, 50) ~/src/mirrorfs $ cat plop
(kilobug@kesto, 51) ~/src/mirrorfs $ showtrans plop

  If  I  use FS_TRANS_SET  or  0 for  the  active_flags  when I  call
  `file_set_translator'  on  the  source  tree, the  settrans  always
  succeed,  and  if  I  use  FS_TRANS_SET  |  FS_TRANS_EXCL,  further
  settrans  always fails  (Device or  resource bus),  whenever  I use
  '-fg' or not.

* the second  question is  about `ntfs_get_translator'. With  the same
  'plop' as above, if I use showtrans on the source tree, I get:

(kilobug@kesto, 55) ~/src/mirrorfs $ showtrans plop
(kilobug@kesto, 56) ~/src/mirrorfs $ ls -l plop
crw-r--r--    1 kilobug  kilobug    0,   0 Jan 13 19:21 plop

  But if I use the showtrans on the mirrored node, I get:

(kilobug@kesto, 216) ~/src/foo $ showtrans plop
/hurd/chrdev 0 0

  What happens  is that  the "null" translator,  when asked  with stat
about his  type, answers it  is a character  device, with minor  0 and
major   0,  and  netfs,   showing  that,   directly  answers   to  the
`file_get_translator'      without      calling      the      callback
`mirrorfs_get_translator'.  Is  there  a  way  to  ask  netfs  to  not
auto-answer to such queries, and let the user of the librabry to catch
all `file_get_translator' and generates the query himself ?
* the  third question  is about  symlinks. I  think  something similar
  happens: the `netfs_attempt_mksymlink'  function is never called (if
  I put a breakpoint on it with gdb it is never reached, and debugging
  `fprintf' statement inside the function are never runned), even if
  I do 'ln -s plop plip' inside the translated tree.

If someone  can help me to  understand how to deal  more properly with
translators and symlinks using libnetfs, I'll be glad of it :)

Thank you for reading this long mail,

Gael Le Mignot "Kilobug" - -
GSM         : (in France)   ICQ UIN   : 7299959
Fingerprint : 1F2C 9804 7505 79DF 95E6 7323 B66B F67B 7103 C5DA

Member of HurdFr: - The GNU Hurd:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]