マウントテーブル

プロセス(Proc)からチャネル(Chan)へのたどり方をまとめたのが次の図だ.この図は,/binに/386/binと/rc/binをbindした結果を示している.mnthashはMhead構造体へのポインタを指している.Mheadはマウントポイントとなるチャネルと,そこに何がマウントされているかを示すためにMount構造体のリストへのポインタを持っている.bind(mount)のMBEFORE,MAFTERフラグは,このリストの順番に反映される.

Mount構造体とMhead構造体は次の通り.

port/portdat.h
  250: struct Mount
  251: {
  252:         ulong  mountid;
  253:         Mount* next;
  254:         Mhead* head;
  255:         Mount* copy;
  256:         Mount* order;
  257:         Chan*  to;                      /* channel replacing channel */
  258:         int    mflag;
  259:         char   *spec;
  260: };
  261: 
  262: struct Mhead
  263: {
  264:         Ref;
  265:         RWlock lock;
  266:         Chan*  from;                    /* channel mounted upon */
  267:         Mount* mount;                  /* what's mounted upon it */
  268:         Mhead* hash;                   /* Hash chain */
  269: };