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

Re: shadowfs



On Sat, May 13, 2000 at 08:09:19PM +0300, Kalle Olavi Niemitalo wrote:
> Tomasz Wegrzanowski <maniek@beer.com> writes:
> 
> > Why to fork shadowfs ?
> > Why not operating it as single thread or 1 thr/per call ?
> 
> I didn't mean it should fork per directory.  I only meant that
> nested directories should be merged in the same way as the
> top-level directory.

dirs can be merged without any forking.

perl pseudocode describing what I think r/o shadowfs would do:
--- start ---
# globals :
@subfs; # table of some subfs objects/ids

sub shadowfs_where_forward_open_or_stat {
  @partsofpath = split '/',shift;
  @subfs_try = @subfs; # copy, not alias
  $dir = '';
  for $part ( @partsofpath ) {
      for $fs ( @subfs_try ) {
            if ( $fs->contains ($dir.$part) ) { push @sub_nexttry, $fs }
      }
      $dir .= '/'.$part;
      @sub_try = @sub_nexttry;
  }
  if (@subfs) { return $subfs_try[0] }
  else { return -1 } # or anf other error message
}

sub shadowfs_dir_listing {
  @partsofpath = split '/',shift;
  @subfs_try = @subfs; # copy, not alias
  $dir = '';
  for $part ( @partsofpath ) {
      for $fs ( @subfs_try ) {
            if ( $fs->contains_as_directory ($dir.$part) ) { push @sub_nexttry, $fs }
      }
      $dir .= '/'.$part;
      @sub_try = @sub_nexttry;
  }
  unless (@subfs) { return -1 } # or anf other error message
  for $fs ( @subfs_try ) {
      push @listing, $fs->listing ($dir); # fs->listing output as list of objects
  }					  # containing one file's statistics per item
  # some sorts
  # remove duplicated entries, ore suffix it as $(name)__fromfs_$(fs_nr)
  return @listing;
}
--- end ---

> > Ehm, is there any need for *entering* directories ?
> > I thought there is no such thing anywhere but in UI.
> 
> Each process has a current directory and a root directory, and in
> the Hurd those are handled in much the same way as open files.
> The shadowfs must be able to list the contents of such an open
> directory and look up files in it.

They can be faked by shadowfs, with content scaned on demand as of other dirs
and maybe cached until notified of directory change
    (on notify not to rescan, only to invalidate cache)

> >     ( autonmounter reacts for ls, so it doesn't need any
> >       special support for enter_directory )
> 
> Are you talking about the Hurd or something else?

I'm talking about Hurd automounter here, that it doen't
need any entry support also, contrary to the first impresion



Reply to: