Subject: Re: RFC: new mode bits in stat structure
To: Ted Lemon <>
From: Wolfgang Rupprecht <>
List: tech-kern
Date: 06/26/1998 12:04:57
Ted Lemon writes:
> Let's say you have a three-layer storage scheme.  If the file has
> been archived on layer 1, then you go to layer 2.  If it's archived
> there, you go to layer 3.

It looks like I misunderstood what the bits implied.  I read it to
mean a two-level system where the flag bits indicated which of the two
layers the file was found on.

> Personally, I think storing a layer number in each layer is _less_
> hierarchical - now when layer two decides to archive the file, it
> has to somehow notify layer one.

My assumption is that the layer number would only exist in memory.
(more below)

> Again, you'd have to go through the layers.   When you have to resort
> to tape, I have to admit that this gets ugly.   What's your proposed
> solution?

This is just off the top of my head, feel free to poke holes in it.

1) add an st_level field to stuct stat. 

2) Assumption: storage scheme is really a union filesystem of all the 
   component layers.

   store a stat-struct worth of information about each layer that
   contains the file in the top-level "union layer".  The top level 
   stat struct would be tagged with the layer number, so one could tell
   which level the info came from.

3) stat() would return the information for the lowest numbered layer
   that contained the file.

   a recompiled ls(1) without knowledge of the "st_level" field
   would still do something useful.

4) statn(... , n) would return all the stats that applied,
   clipping the number of returned structs at "n".

   a new prog that understood the new field such as an updated ls()
   could display all the layer information about the file in question.


This admittedly assumes that the lower layer's directory operations
are fast enough or are somehow cached by layer-specific code.

Again, it just worry when I see things with wired in assumptions of
depth.  They always seem to come around and bite one later on.  If the
flag bit interpretation is loose enough to allow multiple levels, it
should be fine.