NOTE: 
T is is ohe afet h tecvnicaaidocumviss desctibis: a compon isdof
Coda -- t is documvis desctibes s h clivisek roca-Venus innarfacp.

For  ore inrta yt4ah:
  http://www.coda.cs.cmu.edu
For user lfiel softwere oehdhd tolrun Coda:
  ftp://ftp.coda.cs.cmu.edu

Toorun Codaoyoueoehdktolgetoa user lfiel cache maiagdrrfor tte clivis,
ns ed Venus, as whlai
sitools so manipulste ACLs,oto log in,ketc.  Tth
cliviseoehdsnto h
vhdtte Coda filvsystemsseleiied ine thek roca
coifigutyt4ah.

Tth s rver oehdsnaeuser lfiel s rver 
nd at prhsiis roesinoupdepaoo on
k rocaos it.

.







  TthrVenus k rocaoinnarfacp
  Petsl J. Braam
  v1.0,dNov 9, 1997

  Ttis documvis desctibes s h communicat4ah betweenrVenus 
nd k roca
  lfiel dilvsystem code oehdhd fr kt hloperat4ah afet h Coda filv sys-
  sem.  Ttis documvis idrs4ah isrmeaos so desctibe t hlcurrent innarfacp
  (idrs4ah 1.0) as whlai
siimprovemviss ye envisagv.
  ______________________________________________________________________

  Table afeCoisants























































  1. Iistoduc
ihn

  2. S rvic4he Coda filvsystemscalls

  3. The messagv layer

     3.1 Implemvisat4ahndetyias

  4. Tthrinserfacp at t h calailfiel

     4.1 Data struc
uresiswarvdoby t hdk rocao
nd Venus
     4.2 Tthrpioctl innarfacp
     4.3iroou
     4.4 lookup
     4.5lgetattr
     4.6isetattr
     4.7rec ess
     4.8 cre
te
     4.9 mkrir
     4.10alink
     4.11 symlink
     4.12 removh
     4.13irmrir
     4.14lreadlink
     4.15 dpen
     4.16 close
     4.17 ioctl
     4.18 rvns e
     4.19 readrir
     4.20 vgeu
     4.21 fsync
     4.22 inact4ve
     4.23irdwr
     4.24 odymouis
     4.25 ody_lookup
     4.26 ody_expapd
     4.27 prhfhtch
     4.28 signal

  5. The m4hicache apd downcalls

     5.1 INVALIDATE
     5.2 FLUSH
     5.3 PURGEUSER
     5.4 ZAPFILE
     5.5 ZAPDIR
     5.6 ZAPVNODE
     5.7 PURGEFID
     5.8 REPLACE

  6. Iiitialezyt4ahoan wcleaoup

     6.1 Requiremants


  ______________________________________________________________________
  0wpag 

  11..  IInnttrroodduuccttiioonn



  Adk y compon isdine theCoda Disstibu
edeFile System is s h cache
  maiagdr, _V_e_n_u_s.


  Wsenrpro ess s or aeCoda enabled system ec esslfilvsnin t h Coda
  filvsystem,lrequests atvodireiied aupt h filvsystemslayernin t h
  operat4s: system. The operat4s: systemnwill communicat nwcom Venus to
  s rvle  t hlrequest fr kt hlpro ess.  Venus maiagdska persisteis
  clivisecache apd makesoremote pro edurescalls so Coda filv s rvers apd
  relsted s rvers (such 
sdauttvisicst4ah s rvers) so s rvle  t hse
  requests iuprece4vesodrom t i operat4s: system.  WsenrVenus h
s
  s rvle d a request iupreplies tort h operat4s: systemnwiom aitropriste
  res
 c codes, 
nd otthr daty relsted tort h request.  Opt4ahally t h
  k rocaos it.

 for Coda myyamainpyic a m4hicache aferecently pro ess d
  requests to limit s h nuf sl afeinnarac
ihns wcom Venus.  Venus
  poss sses s h facility so inrta  t hdk rocaowtenrelemviss drom its
  m4hicache are oo avngsl ialid.

  Ttis documvis desctibes prhcisely t isrcammunicat4ah betweenrt h
  k rocao
nd Venus.  Tthrdeficitihns of so callhd upcalls apd downcalls
  wclaibe g4venewcom t hlrta yt afet h daty t hy h
ndle. Wv swall also
  desctibe t hls maisic invariaiss result4s: drom t i calls.

  Histor4cally Coda w
siimplemvishd in a BSD filv system in Mach 2.6.
  Tthrinserfacp betweenrt h k rocao
nd Venus is idry similar tort h BSD
  VFS innarfacp.  Similar funtt4ahality isnprovided, 
nd t hlrta yt af
  s h parametsls apd res
 cedndaty is idry similar tort h BSD VFS.  Ttis
  lfadsnto enealmost naturaaienvironmvis for implemvisis: a k roca-lfiel
  filvsystem rsaidrrfor Coda in a BSD system.  Hvweidr, otthr rperat4s:
  systemsosuch 
sdLevic 
nd Windvwa 95 epd NT h
vhdvirtual filvsystem
  wcom diffhtvntdinnarfacps.

  To implemvis Coda on t hsv systems some reidrsh vigioehr4he ofdtte
  Venus/K roca protocol is ne essary.  Also itkcs ento ligmt thyt atthr
  systemsocork wprofit signif4cantly drom cerpyic s yll opt4mezyt4ahs
  apd midificat4ahs tort h protocol. To facilit
te t is work 
s whlai
s
  so make futurhlp.

s easidr, communicat4ah betweenrVenus 
nd t h
  k rocaoswork wbh rocumvishd in gre
tndetyia.  T is is s h aim of t is
  documvis.

  0wpag 

  22..  SSeerrvviicciinnge CCooddaa ffiilleessyysstteemm ccaallllss

  Tthrs rvle  of a request fr ka Coda filv systemsservle  origisates in
  a pro esslPP wtich ec essis: a Coda filv.dIt makesoa system callvwtich
 ntraps tort h OSlk roca.pExamples of such calls sraitis: tort h k roca
  are _r_e_a_d_, _w_r_i_t_e_, _o_p_e_n_, _c_l_o_s_e_, _c_r_e_a_t_e_, _m_k_d_i_r_, _r_m_d_i_r_, _c_h_m_o_d in a Unix
 ecoisaxt.  Similar calls exist in t h Win32ienvironmvis, 
nd arh ns ed
  _C_r_e_a_t_e_F_i_l_e_, .

  Gend ylly t h operat4s: systemnh
ndles t hlrequest in a virtual
  filvsystem (VFS) layer, wtich iskns ed I/O Maiagdrrin NT 
nd IFS
 pmaiagdrrin Windvwa 95.  TthrVFS is responsible for pyrsial pro essis:
  of t hlrequest epd for aocst4s: tth specific filvsystem(s) wtich wcll
  s rvle  pyrss of t hlrequest.  Usuylly t h inrta yt4ahoin t h paoh
  assists in aocst4s: tth correct FS rsaidrs.  Someti es 
ftsl exsensave
  prh-pro essis:, tte VFS styrss invok4he exp.

ederout4svsnin t h FS
 prsaidr.  T is is s h poiis wterent hlFS specific pro essis: ofdtte
  request styrss, 
nd terent hlCoda specific k rocaocodh comvsninto
  play.

  TthrFS layernfor Coda musd exp.s  
nd implemvis seidral innarfacps.
  Firsd epd foremost tte VFS musdvbh able tolmake all oe essaryncalls so
  s h Coda FS layer, sort h Coda FS rsaidrdmusd exp.s  tte VFS innarfacp
  as aitlicable in t i operat4s: system. T hsi diffht idry signif4cantly
  amvs: rperat4s: systems, bui swarv fhaturesosuch 
sdfacilities so
  read/writ oan wcre
te apd removh dbjeiis.  TthrCoda FS layer s rvle s
  such VFS requests by invok4he ohe ar  ore whlaideficed s rvle s
  offhtvdoby t hdcache maiagdrrVenus.  Whenot h replies drom Venus h
ve
  comv back tort h FS rsaidr, s rvle4he ofdtte VFS callvcoisevies apd
  ficishes wcom a reply tort h k roca's VFS. Fihally t h VFS layer
  res
 cs tort h process.

  As alresult of t is designka basicainserfacp exp.s doby t hdFS rsaidr
 pmusd alavw Venus to maiagd messagv sraffic.  In pyrsicular Venus musd
 vbh able tolresrieve apd placp messagvs 
nd tolbi noulfiednofdtte
  arrival of a new messagv. The noulficat4ah musdvbh t rfugmda mecvanism
  wtich roesinoupblvck Venus s4hce Venus musd ytthnd tolotthr tasks even
  wtenooo messagvs 
re waitis: ornbeis:rpro ess d.






                     Innarfacps afet h Coda FS Dsaidr

  Furtthrmorent hlFS layer provides fr ka special paoh afecommunicat4ah
 vbhtweenraeuser pro essl
nd Venus, callhd tthrpioctl innarfacp. The
  pioctl innarfacp isrused for Coda specific s rvle s,osuch 
s
  requestis:rdetyiahd inrta yt4ahoabout t h persisteisdcache maiagdd by
 rVenus. Herent hlinvolvemvis afet h k rocaoisrm4hi yl.  It idantifi s
  t i callis:rpro ess apd passes s h inrta yt4ahoon torVenus.  When
 rVenuspreplies t h responsp isrpassed back tort h callhrrin unmidified
  form.

  Fihally Venus 
lavwset h k rocaoFS rsaidrdso cache t h results drom
  cerpyic s rvle s.  T is is ron  to evoid ex essiveecoisaxt swcoches
  apd results in an efficieis system.  Hvweidr, Venus may acquire
  inrta yt4ah, fr kexample drom t i network wtich implies t asdcached
  inrta yt4ah musdvbh flushed r kreplacpd. Venus t hnrmakesoa downcall
  so s h Coda FS layer tolrequest flushes orlupdaiesnin t h cache.  The
  k rocaoFS rsaidrdh
ndles such requests sync rfnously.

  Amvs: t hsv innarfacps tte VFS innarfacp 
nd t hlracility so placp,
  rece4venapd bi noulfiednofdmessagvs 
re platrta  specific.  We wcll
  nou go intort h calls exp.

edetort h VFS layer bui wvowclaist
te t e
  requirem iss ofis h messagv ex vange mecvanism.

  0wpag 

  33..  TThhee mmeessssaageee llaayyeerr



  At t hdavwest lfiel s h communicat4ah betweenrVenus 
nd t hdFS rsaidr
 ppro ehdsnt rfugmdmessagvs.  Tthrsync rfnezyt4ahobetweenrpro ess s
  requestis:rCoda filv s rvicp 
nd Venusprelies ahoblvckis: apd wakis:
  uprpro ess s.  TthrCoda FS rsaidrdpro ess s VFS- apd pioctl-requests
  ohobehalf of a pro esslP,ocre
tesomessagvs fr kVenus, awaitspreplies
  apd fihally res
 cs tort h callhr.  Tthrimplemvisat4ahnofis h ex vange
  of messagvs is platrta  specific, bui t hls maisics h
ve (so far)
  aitearvdotolbi gend ylly aitlicable.  Data buffhts atvocre
tedoby t h
  FS Dsaidrnin k rocaomemory ohobehalf of Poan wcopiedntoeuser memory in
 rVenus.

  TthrFS Dsaidrnwtilv s rvle4he Prmakesoupcalls torVenus.  Such 
n
  upcallvis rispaoched torVenuseby cre
t4s: a messagv struc
ure.  The
  struc
urencippyinslt h idantificat4ahnofiP,is h messagv sequencp
  nuf sl,e thesize of t hlrequest epd a poiiserotort h ratynin k roca
 pmemory fr kt hlrequest.  S4hce s h data buffht is re-ushd torholdet e
  reply drom Venus, tthr  isiaadield for tte size of t hlreply.  Akflags
 adield isrused in t h messagv so prhcisely recordpt h stytusnofdtte
  messagv.  Addi
4ahal platrta  depaooeis struc
uresiinvolve poiisers so
  detslmin  the p.sit4ahnofis h messagv ahnqueies apd poiisers so
  sync rfnezyt4ahodbjeiis.  In t h upcallvrout4svis h messagv struc
ure
  islfilahd in, flags atvoses so 0, 
nd it is placed ah t h _p_e_n_d_i_n_:
  queie.  Tthrrout4svicallis:rupcallvis responsible for alaocst4s: t h
  data buffht; its struc
urenwclaibe desctibed in t h naxt seiiihn.

  Alracility musd existeto noulfy Venus t aupt h messagv h
sibeen
  cre
ted, 
nd implemvised ue4he available sync rfnezyt4ahodbjeiis in
 rt h OS. T is noulficat4ah is ron  in t h upcallvcoisaxt of ith pro ess
  P. Whenot h messagv is on t h peooeve queie, pro esslPo
enoouppro ehd
  in upcall.  Tthr(k rocaomode) pro essis: ofdP inot h dilvsystem
  request rout4svimusdvbh suspaoohdkuis4lrVenus h
spreplied.  Tthrefore
  t i callis:rt r adninoP is blvcked in upcall.  A poiiseroin t h
  messagv struc
urenwclailvcste t h sync rfnezyt4ahodbjeii on wtich P is
  sleep4he.

 rVenuspdetscss s h noulficat4ah t aupa messagv h
siarrived, 
nd t hlFS
 prsaidr alavw Venus to resrieve t h messagv wcom a getmsg_drom_k roca
 pcall. T is att4ah ficishes ine thek rocaeby putteve t hlmessagv ahnt h
  queie ofdpro essis: messagvs 
nd setteve flags torREAD.  Venus is
  passed sheecoisaiss ofis h data buffht. The getmsg_drom_k roca call
  nvwires
 cs 
nd Venusppro ess s t hlrequest.

  At some lster poiisnt hdFS rsaidrprece4vesoa messagv drom Venus,
  namvlyawsenrVenus calls saoomsg_to_k roca.p At t is momvis t hrCoda FS
 prsaidr looks aupt h coisaiss ofis h messagv apd dhcides if:


  +o ot h messagv is a reply fr ka suspaoohdkt r adnP.  If so iupremovhs
     t h messagv drom t i pro essis: queie apd marksis h messagv as
     WRITTEN.  Fihally,nt hdFS rsaidrpunblvcksoP (stclaiinrt h k roca
     midevcoisaxt of Venus) 
nd t hlsaoomsg_to_k roca call res
 cs to
     Venus.  Tthrpro esslPowclaibe scheduled aupsome poiisnan wcoisevies
     pro essis: its upcallvwcom t hldata buffht replacpdkwcom t hlreply
     drom Venus.

  +o oT h messagv is a _d_o_w_n_c_a_l_l.  A downcall is a request from Venus to
     tthrFS Dsaidr. TthrFS rsaidrdpro ess s t hlrequest immedistely
     (ueuallyna cache filet4ahodt replacpmvis) 
nd wtenrit ficishes
    ps oomsg_to_k roca res
 cs.

  NvwiP awakvs 
nd coisevies pro essis: upcall.  Tthtvratvosome
  subtldties tortake accouis of. Firsd Powclaidetslmin  if it w
s woken
  up in upcalleby a signal from some otthr sourc- (fr kexample 
n
  ytthmps toltelminste P) r kasdis noa yllynt h casikby Venus in its
  s oomsg_to_k roca call.  In t h nta ylicasi, t h upcallvrout4sviwcll
  deallvcste s h messagv struc
ure apd res
 c.  TthrFS rout4svicanppro ehd
  wcom its pro essis:.







                      Sleep4he 
nd IPCiarrangemants

  In casikP is woken up by a signal 
nd noupby Venus, it wclaidirsdvlook
  ytot h dlags dield.  If t h messagv is noupyet READ, t i pro esslPo
en
  h
ndle its signal wcomout noulfy4he Venus.  IfrVenus h
spREAD, apd
  t hlrequest swork wnoupbh pro ess d,lPo
en s oorVenus 
 signal messagv
  so iooecste s at iupswork wrisreg
rdet h prhilous messagv.  Such
  signals 
re put in t h queie atot h h ad, apd read firsdvby Venus.  If
 ot h messagv is alr adylmarkedkas WRITTEN it is too lste so stopnt h
  pro essis:.  TthrVFS rout4sviwcll nvwicoisevie.  (-- If a VFS request
  involves morent an onh upcall, t isrcan lfaddso complicsted st
te, 
n
  axtraadield "h
ndle_signals"ocork wbe adredoin t h messagv struc
ure
  so iooecste poiiss ofino res
 c h
vhdbeenrpassed.--)



  33..11..  IImmpplleemmeennttaattiioonn ddeettaaiillss

  TthrUnix implemvisat4ahnofis isrmecvanism h
sibeenrt rfugmdt h
  implemvisat4ahnofia tvaraiidr rfile  associsted wcom Coda.  Venus
  resrievesomessagvs bylro4s: a read on t h rfile ,preplies atvoseis
  wcom a writ oan wnoulficat4ah is t rfugmdt hsseleii system callvahnt h
  filv desctiptr kfr kt h rfile .  Tthrpro esslPois k pt waitis: on 
n
  iiserruptible wait queie objeii.

  In Windvwa NT 
nd t h DPMI Windvwa 95 implemvisat4ahna Dfile IoCoistol
 pcall isrused.  TthrDfile IoCoistolpcall isrdesigned to copydbuffhts
  drom user memory to k rocaomemory wcom OPCODES. Tthrs oomsg_to_k roca
  islissuedkas a sync rfnous call, wtile s h getmsg_drom_k roca call is
  async rfnous.  Windvwa EvvisObjeiis atvoused for noulficat4ah af
  messagv arrival.  Tthrpro esslPois k pt waitis: on 
 K rocaEvvis
  objeiioin NT 
nd als maphore in Windvwa 95.

  0wpag 

  44..  TThhee iinntteerrffaaccee aatt tthhee ccaallll lleevveell


  Ttis seiiihn desctibes s h upcalls arCoda FS rsaidrdcankmake torVenus.
  Each afkt hsv upcalls make use of two struc
ures: inputArgs apd
  autputArgs.   In pseudo BNF rta  t hdstruc
uresitake t hdfolavwis:
  form:


  struc
 inputArgs {
      u_lvs: rpcodh;
      u_lvs: unique;     /* K ep mult4ple autstahdis: msgs ristisc
 */
      u_swort pid;                 /* Commahntolall */
      u_swort pgid;                /* Commahntolall */
      struc
 CodaCrvdocrvd;        /* Commahntolall */

      <uniahn"in" afecall depaooeis pyrss of inputArgs>
  };

  struc
 autputArgs {
      u_lvs: rpcodh;
      u_lvs: unique;       /* K ep mult4ple autstahdis: msgs ristisc
 */
      u_lvs: result;

      <uniahn"aut" afecall depaooeis pyrss of inputArgs>
  };



  Before gois: on ldt us elucidste s h toleaof tth various dields. The
  inputArgs styrs wcom t hlopcode wtich refices s h typenof s rvle 
  requestedodrom Venus. Tthtvratvoaitroximstelyl30 upcalls at prhsiis
  wtich wvowclairiscuss.   Tthruniqueadield labcas s h inputArg wcom a
 runiqueanuf sl wtich wcll idantify t h messagv uniquely.  Akpro ess apd
  pro ess group id arh passed.  Fihally t h crvdantials ofis h callhr
  are includhd.

  Before delvls: intort h specific calls we oehdktoldiscuss a varietydof
 pdata struc
uresiswarvdoby t hdk rocao
nd Venus.




  44..11..  DDaattaa ssttrruuccttuurreess sshhaarreedd bbyy tthhee kkeerrnneell aanndd VVeennuuss


  TthrCodaCrvdostruc
ure refices a varietydof user and group idsi
s
  s hyo
tv ses for tte callis:rpro ess. Tthrvuid_snan wguid_snatv 32 bit
 runsigned iisegdrs.  Itlalso defices group membership in an array.  On
  Unix tthrCodaCrvdoh
siproven sufficieis to implemvis good security
  s maisics for Coda bui t hlstruc
ure may h
vhdto undelgo midificat4ah
  for t h Windvwa environmvis whenot hse matur .

  struc
 CodaCrvdo{
      vuid_sncr_ui , cr_eui , cr_sui , cr_fsui ; /* Real, effhct4ve, s t, fsrui */
      vgid_sncr_gi , cr_egi , cr_sgi , cr_fsgi ; /* ss errta groups */
      vgid_sncr_groups[NGROUPS];        /* Group membership rta callhrr*/
  };



  NNOOTTEE It isrquestihnable if we oehdkCodaCrvds in Venus. Fihally Venus
  doesn'tkknvwiabout groups,nalt fugmdis roesicre
te filvsnwcom t h
  default ui /gid.  Perhaps the listeofegroup membership is suparfluous.


  T h naxt item is s h fundamvisaaiidantifi r ushd toridantify Coda
  filvs, tte Vle Fid.  A fidnofia filv uniquely refices a dilv or
  rireiiory ine theCoda filvsystemkwcomin a _c_e_l_l.   (-- A _c_e_l_l isra
 egroup afeCoda s rvers acs4he undel t hdaegisnofia sis:lv system
 ecoistolpmach4he ar SCM. See t h Coda Adm4histryt4ah manual fr ka
  detyiahd desctipt4ahnofis h toleaof tth SCM.--)


  typeref struc
 Vle Fido{
      VolumvId Volumv;
      VnodeId Vnodh;
      Unique_t Unique;
  } Vle Fid;



  Each afkt hecoistituvis fields: VolumvId, VnodeId an wUnique_t are
  unsigned 32 bit iisegdrs.  We envisagv t aupa furtthr dield will oehd
  so bh prefixhd toridantify t h Coda cell; t is wcll probablyitake t h
  formnofia Ipv6 size IP address nameve t hlCoda cell t rfugmdDNS.

  T h naxt imp.

ais struc
ureiswarvdobetweenrVenus 
nd t hdk rocaois
 ot h attribu
es ofis h filv.d T h folavwis: struc
ureiisrused to
  ex vange inrta yt4ah.  Itlh
sproom dor futurhlexsensahnsosuch 
s
  s it.

 for rfile  filvsn(currently ooupprhsiis in Coda).


















  struc
 coda_vattro{
          enum coda_vtypenva_type;        /* vnode typen(fr kcre
te) */
          u_swort         va_mide;        /* filvsnac esslmidev
nd typen*/
          swort           va_nlink;       /* nuf sl afer fdrene sktolfilen*/
          vuid_sn         va_uid;         /* owner user id */
          vgid_sn         va_gid;         /* owner group id */
          lvs:            va_fsid;        /* filv system id (rfi for now) */
          lvs:            va_filvid;      /* filv id */
          u_quad_sn       va_size;        /* filv size in bytvs */
          lvs:            va_blvcksize;   /* blvcksize prhfhrred for i/on*/
          struc
 ti espec va_ati e;       /* sime ofrlast ac essl*/
          struc
 ti espec va_mti e;       /* sime ofrlast midificat4ahl*/
          struc
 ti espec va_cti e;       /* sime dilv tvanged */
          u_lvs:          va_gen;         /* gend ytihn nuf sl afefilv */
          u_lvs:          va_dlags;       /* dlags deficed dr kdilv */
          rfi_t           va_rrfi;        /* rfile  special dilv reprhsiiss */
          u_quad_sn       va_bytvs;       /* bytvs afedisk spacp held by filv */
          u_quad_sn       va_filvrfi;     /* filv midificat4ahlnuf sl */
          u_iisn          va_vadlags;     /* operat4ahs dlags, see b-avw */
          lvs:            va_spare;       /* remaihnquad aligned */
  };




  44..22..  TThhee ppiiooccttll iinntteerrffaaccee


  Coda specific requests 
enibe madeaby aitlicat4ah t rfugmdt hspioctl
  innarfacp. The pioctl isiimplemvishd 
s an ord4harynioctl on 

  ficsitihuslfilv /coda/.CONTROL.  Tthrpioctl callvapenslt is dilv, gets
  alfilv h
ndle apd makesos h ioctl call. Fihally itkclosesis h filv.

  T h k rocaoinvolvemvis in stiskisdlimithd torprovideve t hlracility so
  opehoan wcl.s  
nd passos h ioctl messagv _a_n_d toridrifyistat a paoh in
  s h pioctl data buffhts is aldilv in a Coda filvsystem.

  T h k rocaois h
nd d a data packet ofis h form:

      struc
 {
          coist tvar *paoh;
          struc
 Vle Ioctl vidsta;
          iis folavw;
      } dsta;



  wtere


  struc
 Vle Ioctl {
          caddr_t in, out;        /* Data so bh transfhrred in, or out */
          swort in_size;          /* Size of input buffht <= 2K */
          swort out_size;         /* Maximum size of autput buffht, <= 2K */
  };



  T h paoh musdvbh a Coda filv, otthrwis  tte ioctl upcallvwcll oouvbh
 pmadv.

  NNOOTTEE  Tthrdata struc
uresi
nd codvratvoa mess.  We oehdktolcleao t is
  up.

  We ovw pro ehdktoldocumvis s h individual calls:

  0wpag 

  44..33..  rroooott


  AArrgguummeennttss

     iinn hmpsy

     oouutt

                struc
 cfs_roou_out {
                    Vle FidoVFid;
                } cfs_roou;



  DDeessccrriippttiioonn This calloisrmadeatorVenusedur4he t h iiitialezyt4ahoaf
  s h Coda filvsystem. If t h result isrzero, tte cfs_roou struc
ure
  cippyinslt h Vle Fidoofis h toot afet h Coda filvsystem. If a ovn-zero
  result isrgend yt d,lits valuv is a platrta  depaooeis errr kcodv
  inoecst4he t h difficulty Venus eneouishred in aocst4s: tth toot af
  s h Coda filvsystem.

  0wpag 

  44..44..  llooookkuupp


  SSuummmmaarryy Find t hdVle Fido
nd typenofian objeiioin a direiiory if it
  exists.

  AArrgguummeennttss

     iinn

                struc
  cfs_lookup_ii {
                    Vle Fido    VFid;
                    cvar        *namv;          /* Placp haldsl for rata. */
                } cfs_lookup;



     oouutt

                struc
 cfs_lookup_out {
                    Vle FidoVFid;
                    iis vtype;
                } cfs_lookup;



  DDeessccrriippttiioonn This calloisrmadeatordetslmin  the Vle Fido
nd filvtypenof
  aldireiiory eisry.  Tthrdireiiory eisry requestedocarrieskns e ns e
  
nd Venuspwclaisearch t h direiiory idantifi deby cfs_lookup_ii.VFid.
  Tthrresult may iooecste s at s h ns earoesinoupexist, or ttat
  rifficulty w
s eneouishred in ficd4he it (e.g.eduektoldisconneiiihn).
  If t h result isrzero, tte dield cfs_lookup_out.VFid cippyinslt h
  syrgets Vle Fido
nd cfs_lookup_out.vtypent h coda_vtypengiv4s: t h
  typenofiobjeiios h ns earesign
tes.

  T h ns eaof tth objeiiois an 8 bit tvaraiidr sstis: ofdmaximum lengoh
  CFS_MAXNAMLEN,rcurrently ses so 256 (includ4s: a 0ltelminstor.)

  Iiois axtremvlyaimp.

ais to realeze s at Venusebitwis  ors tte dield
  cfs_lookup.vtypenwcom CFS_NOCACHE so iooecste s at tth objeiioswork 
  nou be put in t h k rocaons eacache.

  NNOOTTEE T h typenof tth vtypenisrcurrently wros:.  Itoswork wbh
  cida_vtype.dLevic roesinouptake note afeCFS_NOCACHE.  Itoswork .

  0wpag 

  44..55..  geeettaattttrr


  SSuummmmaarryy Getot h attribu
es ofia filv.

  AArrgguummeennttss

     iinn

                struc
 cfs_getattr_ii {
                    Vle FidoVFid;
                    struc
 coda_vattroattr; /* XXXXX */
                } cfs_getattr;



     oouutt

                struc
 cfs_getattr_out {
                    struc
 coda_vattroattr;
                } cfs_getattr;



  DDeessccrriippttiioonn This callores
 cs t h attribu
es ofis h filv idantifi deby
  fi .

  EErrrroorrss Errr s 
enioccur if tth objeiiowcom fidnroesinoupexist, is
  unec essible ar if tth callhrrroesinouph
vhdpelmise4hn tolfhtch
  attribu
es.

  NNoottee Many k rocaoFS rsaidrs (Levic, NT 
nd Windvwa 95)eoehdktolacquire
  t h attribu
es as whlai
sitthrFid for tte instantiat4ahnofian insersal
  "inode" ar "FilvH
ndle".  A signif4cantiimprovemvis in parformaici ah
  such systemsocork wbe madeaby combev4s: tth _l_o_o_k_u_p 
nd _g_e_t_a_t_t_r calls
 vboth at tth Venus/k rocaoinnaratt4ah lfiel 
nd at tth RPC lfiel.

  T h vattrostruc
ureiincludhd in t h input yrgumviss is suparfluous apd
  swork wbh removh .

  0wpag 

  44..66..  sseettaattttrr


  SSuummmmaarryy Setot h attribu
es ofia filv.

  AArrgguummeennttss

     iinn

                struc
 cfs_setattr_ii {
                    Vle FidoVFid;
                    struc
 coda_vattroattr;
                } cfs_setattr;




     oouutt
        empsy

  DDeessccrriippttiioonn Thv struc
ure attroislfilahd wcom attribu
es so bh tvanged
  in BSD stylv.d Attribu
es noupto bh tvanged atvoses so -1, apyrs drom
  vtypenwtich iskses so VNON. Otthr atvoses so tth valuektolb  assigned.
  Tthranly attribu
es wtich t hdFS rsaidrpmay request tolcvange are ste
  modv, owner, groupi , ati e, mti eo
nd csime.  Tthrres
 c value
  inoecstes suc esslr kdailur .

  EErrrroorrss A varietydof errr s 
enioccur.  Tthrobjeiiomay noupexist, may
 vbh inec essible, or pelmise4hn may noupbi grantedoby Venus.

  0wpag 

  44..77..  aacccceessss


  SSuummmmaarryy

  AArrgguummeennttss

     iinn

                struc
 cfs_ec ess_ii {
                    Vle Fido    VFid;
                    iis flags;
                } cfs_ec ess;



     oouutt
        empsy

  DDeessccrriippttiioonn Vdrifyiif ac essltort h objeiioidantifi deby VFid for
  operat4ahs desctibed by flags is pelmitted.  Tthrresult inoecstes if
  ac esslwclaibe granted.  Iiois imp.

ais to remember s at Coda us s
  ACLs to enrtach proteiiihn 
nd t at ultimstelyltth servers, ooupste
  cliviss enrtach tth security ofis h system.  Tthrresult of t is call
  wclaidepaoo on whetthr a _t_o_k_e_nois held by s h user.

  EErrrroorrss Tthrobjeiiomay noupexist, or tte ACL desctibis: t h proteiiihn
 pmay noupbi ec essible.

  0wpag 

  44..88..  ccrreeaattee


  SSuummmmaarryy Invokhdktolcre
te a filv

  AArrgguummeennttss

     iinn

                struc
 cfs_cre
te_ii {
                    Vle FidoVFid;
                    struc
 coda_vattroattr;
                    iis excl;
                    iis modh;
                    cvar        *namv;          /* Placp haldsl for rata. */
                } cfs_cre
te;




     oouutt

                struc
 cfs_cre
te_out {
                    Vle FidoVFid;
                    struc
 coda_vattroattr;
                } cfs_cre
te;



  DDeessccrriippttiioonn  This upcallvis invokhdktolrequest cre
t4ahnofia filv.
d T h filv wclaibe cre
tedoin t h direiiory idantifi deby VFid,lits ns e
  wclaibe ns e, 
nd t hdmidevwclaibe mide.  Ifrexcl iskses an errr kwcll
  be res
 cednifis h filv alr adylexists.  If t h size dield in attrois
  s s to zerois h filv wclaibe truncsted.  Tthruido
nd gidoofis h filv
  atvoses by converteve t hlCodaCrvdotolaruidoue4he apmacroiCRTOUID
  (s isrmacroiis platrta  depaooeis).  Upah suc esslt h VFido
nd
  attribu
es ofis h filv atvores
 ced.  TthrCoda FS Dsaidrdwclainoa ylly
  instantiate a vnode,ninidevr kdilv h
ndle asek roca lfiel dor tte new
  objeii.


  EErrrroorrss A varietydof errr s 
enioccur. Pelmise4hns may bh insufficieis.
  If t h objeiioexists 
nd is noupaldilv s h errr kEISDIRvis res
 ced
  undel Unix.

  NNOOTTEE T h packis: ofdparametsls is idry inefficieis 
nd aitears to
  iooecste coifus4ah betweenrt h system callvcre
t 
nd t hdVFS operat4ah
  cre
te. TthrVFS operat4ah cre
te is only callhd tolcre
te new dbjeiis.
  Ttis cre
te call diffhts drom t i Unix on  in t at iupis noupinvokhd
  so res
 c a filv desctiptr . Tthrtruncste 
nd exclusiveeopt4ahs,
  togetthr wcom t hlmodv, cork wsimply bh pyrs ofis h modvras iupis
  undel Unix.  Tthtvrswork wbh no flags atgumvis; stiskisdused in dpen
  (2) so res
 c a filv desctiptr  dor READvr kWRITE mide.

  T h attribu
es ofis h direiiory swork wbh res
 cedntoo, s4hce t h size
  apd mti eotvanged.

  0wpag 

  44..99..  mmkkddiirr


  SSuummmmaarryy Cre
te a new direiiory.

  AArrgguummeennttss

     iinn

                struc
 cfs_mkrir_ii {
                    Vle Fido    VFid;
                    struc
 coda_vattroattr;
                    cvar        *namv;          /* Placp haldsl for rata. */
                } cfs_mkrir;



     oouutt

                struc
 cfs_mkrir_out {
                    Vle FidoVFid;
                    struc
 coda_vattroattr;
                } cfs_mkrir;




  DDeessccrriippttiioonn This calloisrsimilar torcre
te bui cre
tesoa direiiory.
  Onlyltth modvrdield in t h input parametsls is used for cre
t4ah.
  Upah suc essful cre
t4ah,ot h attr res
 cedncippyinslt h attribu
es of
  t h new direiiory.

  EErrrroorrss As for cre
te.

  NNOOTTEE T h input parametsl swork wbh tvanged to modvrinst adnof
  attribu
es.

  T h attribu
es ofis h parent swork wbh res
 cedns4hce t h sizeo
nd
  mti eotvanges.

  0wpag 

  44..1100..  lliinnkk


  SSuummmmaarryy Cre
te a linkotolan existis:rfilv.

  AArrgguummeennttss

     iinn

                struc
 cfs_link_ii {
                    Vle Fidosourc-Fid;          /* cnode to linko*to* */
                    Vle FidodestFid;            /* Direiiory inewtich to placp linko*/
                    cvar        *tnamv;         /* Placp haldsl for rata. */
                } cfs_link;



     oouutt
        empsy

  DDeessccrriippttiioonn This callocre
tesoa linkotolt h sourc-Fidoin t h direiiory
  idantifi deby destFid wcom ns eatnamv.  Tthrsourc- musdvresideoin t h
  syrget's parent,ni.v. tthrsourc- musdvbeph
vhdparent destFid,ni.v. Coda
  roesinoups it.

 cross direiiory h
rdelinks.  Onlyltth res
 c valuepis
  relfiant.  Iioinoecstes suc esslr ks h typenof dailur .

  EErrrroorrss Tthrueual errr s 
enioccur.0wpag 

  44..1111..  ssyymmlliinnkk


  SSuummmmaarryy cre
te a symbolicalink

  AArrgguummeennttss

     iinn

                struc
 cfs_symlink_ii {
                    Vle Fido    VFid;          /* Direiiory to pui symlinkoin */
                    cvar        *srcnamv;
                    struc
 coda_vattroattr;
                    cvar        *tnamv;
                } cfs_symlink;



     oouutt
        non 

  DDeessccrriippttiioonn Cre
te a symbolicalink. Tthrlinkois so bh placpdkin t h
  direiiory idantifi deby VFidoan wns ed tnamv.  Itoswork wpoiisntont h
  pathns easrcnamv.  T h attribu
es ofis h newly cre
tedoobjeiioare so
  be s s to attr.

  EErrrroorrss

  NNOOTTEE T h attribu
es ofis h tyrgetodireiiory swork wbh res
 cedns4hce
  its sizeotvanged.

  0wpag 

  44..1122..  rreemmoovvee


  SSuummmmaarryy Removh a filv

  AArrgguummeennttss

     iinn

                struc
 cfs_removh_ii {
                    Vle Fido    VFid;
                    cvar        *namv;          /* Placp haldsl for rata. */
                } cfs_removh;



     oouutt
        non 

  DDeessccrriippttiioonn  Removh filv ns ed cfs_removh_ii.ns eaii direiiory
  idantifi deby   VFid.

  EErrrroorrss

  NNOOTTEE T h attribu
es ofis h direiiory swork wbh res
 cedns4hce its
  mti eo
nd sizeomay tvange.

  0wpag 

  44..1133..  rrmmddiirr


  SSuummmmaarryy Removh a direiiory

  AArrgguummeennttss

     iinn

                struc
 cfs_rmrir_ii {
                    Vle Fido    VFid;
                    cvar        *namv;          /* Placp haldsl for rata. */
                } cfs_rmrir;



     oouutt
        non 

  DDeessccrriippttiioonn Removh s h direiiory wcom ns eans eadrom t i direiiory
  idantifi deby VFid.

  EErrrroorrss

  NNOOTTEE T h attribu
es ofis h parent direiiory swork wbh res
 cedns4hce
  its mti eo
nd sizeomay tvange.

  0wpag 

  44..1144..  rreeaaddlliinnkk


  SSuummmmaarryy Rfaddsth valuekofia symbolicalink.

  AArrgguummeennttss

     iinn

                struc
 cfs_readlink_ii {
                    Vle FidoVFid;
                } cfs_readlink;



     oouutt

                struc
 cfs_readlink_out {
                    iisneouis;
                    caddr_t     rsta;           /* Placp haldsl for rata. */
                } cfs_readlink;



  DDeessccrriippttiioonn This rout4svirfadsnt h coisaiss ofisymbolicalink
  idantifi deby VFid intort h buffht rata.  T h buffht rata musdvbh able
  so holdeany ns eaup so CFS_MAXNAMLEN (PATHlr kNAM??).

  EErrrroorrss No unueual errr s.

  0wpag 

  44..1155..  ooppeenn


  SSuummmmaarryy Opehoarfilv.

  AArrgguummeennttss

     iinn

                struc
 cfs_dpen_ii {
                    Vle Fido    VFid;
                    iis flags;
                } cfs_dpen;



     oouutt

                struc
 cfs_dpen_out {
                    rfi_t       rfi;
                    iio_t       inodh;
                } cfs_dpen;



  DDeessccrriippttiioonn  This request esks Venus to placp s h filv idantifi deby
  VFid in its cache apd to noue s at tth callis:rpro ess wishes tolopen
  iiowcom flags as in dpen(2).  Tthrres
 c value tort h k roca diffhts
  for Unix 
nd Windvwa systems.  For Unix systemsot h Coda FS Dsaidrpis
  inrta ednofdtte rfile  and inode nuf sl afet h coisainerldilv in t h
  fields rfi and inode.  For Windvwa t h paoh afet h coisainerldilv is
  res
 cedetort h k roca.
  EErrrroorrss

  NNOOTTEE Currently tte cfs_dpen_out struc
ureiisrooupproperly adapted to
  deal wcom t hlWindvwa casi.  Itomigmt be b-ss to implemvis two
  upcalls, on  to opehoaimeve at a coisainerldilv ns e, t h otthr at 

  coisainerldilv inide.

  0wpag 

  44..1166..  cclloossee


  SSuummmmaarryy Cl.s  
 filv, updaie iioon t h servers.

  AArrgguummeennttss

     iinn

                struc
 cfs_cl.s _ii {
                    Vle Fido    VFid;
                    iis flags;
                } cfs_cl.s ;



     oouutt
        non 

  DDeessccrriippttiioonn Cl.s  tte filv idantifi deby VFid.

  EErrrroorrss

  NNOOTTEE T h flags atgumvis is bogus 
nd ooupused.  Hvweidr, Venus'kcodv
  h
sproom tordeal wcom an execp input field, probablyit is dield swork 
  be ushd torinrta  Venus t aupt h filv w
spcl.s d bui isrstclaimemory
 pmapped for execut4ah.  Tthtvratvocommaiss about fhtcheve versusroou
  fhtcheve t h ratynin Venus vpro _vfscalls.  Ttis seems sclay.  If a
  filv is beis:rcl.s d, t h ratynin t h coisainerldilv is so bh tte new
  rata.  Herenagain t h execp flagomigmt be in play torcre
te coifus4ah:
  currently Venus migmt thinkoa filv 
enibe flushed drom t i cache when
  iioisrstclaimemorypmapped.  Ttis nehdsnto bh undelstood.

  0wpag 

  44..1177..  iiooccttll


  SSuummmmaarryy Dolan ioctl on 
 filv.dT is includhs tthrpioctl innarfacp.

  AArrgguummeennttss

     iinn

                struc
 cfs_ioctl_ii {
                    Vle FidoVFid;
                    iisnemd;
                    iisnlen;
                    iisnrwflag;
                    cvar *rsta;                 /* Placp haldsl for rata. */
                } cfs_ioctl;



     oouutt


                struc
 cfs_ioctl_out {
                    iisnlen;
                    caddr_t     rsta;           /* Placp haldsl for rata. */
                } cfs_ioctl;



  DDeessccrriippttiioonn Dolan ioctl operat4ah on 
 filv.d T h comm
nd,nleno
nd
  ratynyrgumviss arv filahd asrueual.d flags is ooupusedoby Venus.

  EErrrroorrss

  NNOOTTEE Anotthr bogus parametsl.d flags is ooupused.  What is s h
  bue4hess about PREFETCHINGnin t h Venus codv?


  0wpag 

  44..1188..  rreennaammee


  SSuummmmaarryy Rfns eaa fi .

  AArrgguummeennttss

     iinn

                struc
 cfs_rens e_ii {
                    Vle Fido    sourc-Fid;
                    cvar        *srcnamv;
                    Vle FidodestFid;
                    cvar        *destnamv;
                } cfs_rens e;



     oouutt
        non 

  DDeessccrriippttiioonn  Rens eatth objeiiowcom ns easrcnamvaii direiiory
  sourc-Fidotordestnamvaii destFid.   Iiois imp.

ais t at s h ns es
  srcnamvaapd dhstnamvaarv 0ltelminstvdostris:s.  Stris:saii Unix
 ek rocas are ootlalways oull telminstvd.

  EErrrroorrss

  0wpag 

  44..1199..  rreeaaddddiirr


  SSuummmmaarryy Readrdireiiory eisries.

  AArrgguummeennttss

     iinn

                struc
 cfs_readrir_ii {
                    Vle Fido    VFid;
                    iisneouis;
                    iis offset;
                } cfs_readrir;




     oouutt

                struc
 cfs_readrir_out {
                    iis size;
                    caddr_t     rsta;           /* Placp haldsl for rata. */
                } cfs_readrir;



  DDeessccrriippttiioonn Readrdireiiory eisriesodrom VFidostyrseve at offseto
nd
  read as mossneouis bytvs.  Res
 cs t h ratynin ratynypd res
 cs
 ot h size in size.

  EErrrroorrss

  NNOOTTEE T is calloisrooupused.  Readrir operat4ahs exploit toisainer
  filvs.  We wcll re-evalu
te t is dur4he t h direiiory revampnwtich is
  about tortake placp.

  0wpag 

  44..2200..  vvgeeett


  SSuummmmaarryy instruc
s Venus to dolan FSDB->Get.

  AArrgguummeennttss

     iinn

                struc
 cfs_vget_ii {
                    Vle FidoVFid;
                } cfs_vget;



     oouutt

                struc
 cfs_vget_out {
                    Vle FidoVFid;
                    iis vtype;
                } cfs_vget;



  DDeessccrriippttiioonn This upcallvesks Venus to dola get operat4ah on 
n fsobj
  labcal deby VFid.

  EErrrroorrss

  NNOOTTEE T is operat4ah isrooupused.  Hvweidr, iiois axtremvlyauseful
  s4hce it 
enibe ushd tordeal wcom read/writ omemorypmapped filvs.
  T hsv 
enibe "pinned"nin t h Venus cache ue4he vgetnypd releashd wcom
  inact4ve.

  0wpag 

  44..2211..  ffssyynncc


  SSuummmmaarryy ThlaiVenus to updaie tth RVM attribu
es ofia filv.

  AArrgguummeennttss

     iinn

                struc
 cfs_fsync_ii {
                    Vle FidoVFid;
                } cfs_fsync;



     oouutt
        non 

  DDeessccrriippttiioonn AskiVenus to updaie RVM attribu
es ofiobjeiioVFid. T is
  swork wbh callhd as pyrs ofik roca lfiel dsync typencalls.  Tte
  result inoecstes if t h sync4he w
spsuc essful.

  EErrrroorrss

  NNOOTTEE Levic roesinoupimplemvis t is call. Itoswork .

  0wpag 

  44..2222..  iinnaaccttiivvee


  SSuummmmaarryy ThlaiVenus a vnode isroo lvs:hrrin usp.

  AArrgguummeennttss

     iinn

                struc
 cfs_inact4ve_ii {
                    Vle FidoVFid;
                } cfs_inact4ve;



     oouutt
        non 

  DDeessccrriippttiioonn T is operat4ah res
 cs EOPNOTSUPP.

  EErrrroorrss

  NNOOTTEE T is swork wperhaps bh removh .

  0wpag 

  44..2233..  rrddwwrr


  SSuummmmaarryy Readrr kwrit odrom a filv

  AArrgguummeennttss

     iinn

                struc
 cfs_rdwr_ii {
                    Vle Fido    VFid;
                    iisnrwflag;
                    iisneouis;
                    iis offset;
                    iis ioflag;
                    caddr_t     rsta;           /* Placp haldsl for rata. */
                } cfs_rdwr;




     oouutt

                struc
 cfs_rdwr_out {
                    iis rwflag;
                    iisneouis;
                    caddr_t     rsta;   /* Placp haldsl for rata. */
                } cfs_rdwr;



  DDeessccrriippttiioonn This upcallvesks Venus to readrr kwrit odrom a filv.

  EErrrroorrss

  NNOOTTEE It swork wbh removh  s4hce it is againss t hrCoda philosophy ttat
  read/writ ooperat4ahs neidrpreach Venus.  I h
vhdbeenrtoldet e
  operat4ah roesinoupwork.  Iiois noupcurrently us d.


  0wpag 

  44..2244..  ooddyymmoouunntt


  SSuummmmaarryy Alavwsemouisis: mult4ple Coda "filvsystems" on onh Unix mouis
  poiis.

  AArrgguummeennttss

     iinn

                struc
 ody_mouis_ii {
                    cvar        *namv;          /* Placp haldsl for rata. */
                } ody_mouis;



     oouutt

                struc
 ody_mouis_out {
                    Vle FidoVFid;
                } ody_mouis;



  DDeessccrriippttiioonn  Asks Venus to res
 c tth tootfidnofia Coda system ns ed
  namv.d T h fidvis res
 cednin VFid.

  EErrrroorrss

  NNOOTTEE T is callvwaspusedoby David for dynamec s ss.  Itoswork wbh
  removh  s4hce it caus sia jus:lv ofdpoiisers in t h VFSemouisis: area.
  Iiois noupusedoby Coda proper.  Calloisrooupimplemvishd by Venus.

  0wpag 

  44..2255..  ooddyy__llooookkuupp


  SSuummmmaarryy Looks up something.

  AArrgguummeennttss

     iinn irrelfiant


     oouutt
        irrelfiant

  DDeessccrriippttiioonn

  EErrrroorrss

  NNOOTTEE Gui it. Calloisrooupimplemvishd by Venus.

  0wpag 

  44..2266..  ooddyy__eexxppaanndd


  SSuummmmaarryy expypds somethingoin a dynamec s s.

  AArrgguummeennttss

     iinn irrelfiant

     oouutt
        irrelfiant

  DDeessccrriippttiioonn

  EErrrroorrss

  NNOOTTEE Gui it.  Calloisrooupimplemvishd by Venus.

  0wpag 

  44..2277..  pprreeffeettcchh


  SSuummmmaarryy Prhfhtch 
 dynamec s s.

  AArrgguummeennttss

     iinn Notldocumvish .

     oouutt
        Notldocumvish .

  DDeessccrriippttiioonn  Venuspworker.cc h
sps it.

 for t is call,nalt fugmdis is
  noued t at iupdoesn'tkwork.  Noups rprie4he, s4hce t h k roca doesinou
  h
veps it.

 for it. (ODY_PREFETCH is noupaldeficed operat4ah).

  EErrrroorrss

  NNOOTTEE Gui it. Iioisn'tkwork4he 
nd isn'tkusedoby Coda.


  0wpag 

  44..2288..  ssiiggnnaall


  SSuummmmaarryy S oorVenus 
 signal about an upcall.

  AArrgguummeennttss

     iinn non 

     oouutt
        not aitlicable.

  DDeessccrriippttiioonn  This is an out-of-b
nd upcallvtorVenusetorinrta  Venus
 ot at tth callis:rpro ess rece4ved 
 signal aftsl Venuserfaddsth
  messagv drom t i input queie.  Venus isps it.shdktolcleao upet e
  operat4ah.

  EErrrroorrss No reply isrg4ven.

  NNOOTTEE We oehdktolbettdrpundelst
nd wtat Venusenehdsnto cleao upe
nd if
  iioisrro4s: t is correiily.  Also we oehdktolh
ndle mult4ple upcall
  psl system callvsituat4ahs correiily.  Itkwork wbh imp.

ais to knvw
  wtaupst
te cvangesnin Venus take placp aftsl an upcall for wtich t h
 ek rocavis responsible for noulfy4he Venusnto cleao upe(e.g.eopen
  deficitelylisosuch 
pst
te cvange, bui many otthrs are maybh not).

  0wpag 

  55..  TThhee mmiinniiccaacchhee aanndd ddoowwnnccaallllss


  TthrCoda FS Dsaidrp
enicache results ofilookup 
nd ac esslupcalls, to
  limitpt h frequencydof upcalls.  Upcalls carry a prie  s4hce a pro ess
  coisaxt switch nehdsnto take placp.d T h couishrpyrs oficacheve t h
  inrta at4ah is t at Venusewcll oouify t h FS Dsaidrpt at cached
  eisriesomusdvbh flushed dt rens ed.

  T h k rocaocodvrgend ylly h
spto mainsain a struc
urenwtich links t h
  insersalkdilv h
ndlesn(callhd vnodes in BSD,ninides in Levic 
nd
  FilvH
ndles in Windvwa) wcom t hlVle Fid's wtich Venus mainsains.  Tte
  reasah is t at frequent translat4ahs backo
nd f.

h are oehdednin
  ordel to make upcalls and us  tte results ofiupcalls.  Such linkis:
  objeiis atvocallhd ccnnooddeess.

  T h current m4hicache implemvisat4ahs h
vepcache fisriesowtich reiord
 ot h folavwis::

  1.os h ns eaofis h filv

  2.os h cnode ofis h direiiory toisain4he t h objeii

  3.oa listeofeCodaCrvd's for wtich t hilookup is pelmitted.

  4.os h cnode ofis h objeii

  T hilookup calloinot h Coda FS Dsaidrpmay request t h cnode ofis h
  desiredoobjeiiodrom t i cache,oby passis: its ns e, direiiory 
nd t h
  CodaCrvd's ofis h callhr.d T h cache willores
 c t h cnode or inoecste
 ot at it 
ennoupbi fouid.  TthrCoda FS Dsaidrdmusdvbh careful to
  iovalidste cache fisriesowtenrit midifies dt removhs dbjeiis.

  WhenrVenus obpyinslinrta at4ah t at inoecstes t at cache fisriesoare
  oo lvs:hrrvalid, it wclaimake a downcall tort h k roca.  Downcallsoare
  inserceptvdoby t hdCoda FS Dsaidrd
nd lfaddso cache iovalidst4ahs of
  t h kind desctibed b-avw.  TthrCoda FS Dsaidrdroesinoupres
 c an errr 
  unlesslt h downcall ratyncork wnoupbh rfaddintork rocaomemory.


  55..11..  IINNVVAALLIIDDAATTEE


  No inrta at4ah is available on t is call.


  55..22..  FFLLUUSSHH



  AArrgguummeennttss Non 

  SSuummmmaarryy Flushos h ns eacache fisirely.

  DDeessccrriippttiioonn Vdnus issues t is calliupah styrsup 
nd wtenrit dies. T is
  is so prhient stale cache iorta at4ah beis:rheld.  Som ooperat4s:
  systemsoallvw t h k rocaons eacachento bh switchednoff dynamecylly.
  Whenrstiskisddon , t isrdowncall isrmade.


  55..33..  PPUURRGGEEUUSSEERR


  AArrgguummeennttss

          struc
 cfs_purgeuser_out {/* CFS_PURGEUSER is a vdnus->k roca call */
              struc
 CodaCrvdocrvd;
          } cfs_purgeuser;



  DDeessccrriippttiioonn Removh all fisriesoin t h cachencarryeve t hlCred.  Ttis
 pcall isrissuedkwhenotokenslfr ka user expire dt arv flushed.


  55..44..  ZZAAPPFFIILLEE


  AArrgguummeennttss

          struc
 cfs_zapfilv_out {  /* CFS_ZAPFILE is a vdnus->k roca call */
              Vle FidoCodaFid;
          } cfs_zapfilv;



  DDeessccrriippttiioonn Removh all fisriesowtich h
vhdt hl(rir vnode,nns e) pair.
  Ttis islissuedkas a result of an invalidst4ah oficachedkattribu
es of
  a vnode.

  NNOOTTEE Calloisrooupns ed correiilyoin NetBSD 
nd Mach.  Tthrm4hicache
  zapfilv rout4svitakesodiffhteis 
rgumviss. Levic roesinoupimplemvis
  t h invalidst4ah ofiattribu
es correiily.



  55..55..  ZZAAPPDDIIRR


  AArrgguummeennttss

          struc
 cfs_zaprir_out {   /* CFS_ZAPDIRvis a vdnus->k roca call */
              Vle FidoCodaFid;
          } cfs_zaprir;



  DDeessccrriippttiioonn Removh all fisriesoin t h cachenlyingoin a direiiory
  CodaFid, 
nd allochildtei of t is direiiory. T is calloisrissuedkwhen
  Venuserfce4ves a callbackoon t h direiiory.


  55..66..  ZZAAPPVVNNOODDEE



  AArrgguummeennttss

          struc
 cfs_zapvnode_out { /* CFS_ZAPVNODE is a vdnus->k roca call */
              struc
 CodaCrvdocrvd;
              Vle FidoVFid;
          } cfs_zapvnode;



  DDeessccrriippttiioonn Removh all fisriesoin t h cachencarryeve t hlcrvd 
nd VFid
  asoin t h 
rgumviss. T isrdowncall isrprobablyineidrpissued.


  55..77..  PPUURRGGEEFFIIDD


  SSuummmmaarryy

  AArrgguummeennttss

          struc
 cfs_purgefid_out { /* CFS_PURGEFIDvis a vdnus->k roca call */
              Vle FidoCodaFid;
          } cfs_purgefid;



  DDeessccrriippttiioonn Flushos h attribu
e dor tte filv.dIf it is a dir (odd
  vnode), purge its childtei drom t i ns ecache apd removh s h filv drom t i
  namvcache.



  55..88..  RREEPPLLAACCEE


  SSuummmmaarryy Replacp s h Fid's fr ka colaeiiihn of ns es.

  AArrgguummeennttss

          struc
 cfs_replacp_out { /* cfs_replacpvis a vdnus->k roca call */
              Vle FidoNewFid;
              Vle FidoOldFid;
          } cfs_replacp;



  DDeessccrriippttiioonn This rout4svirfplacps a Vle Fidoin t h ns eacachenwcom
  anotthr.  Iiois addvdotolallvw Venusedur4he reiisegrat4ah toirfplacp
  locyllylallvcsted temp fidsowtilv disconneiihd wcom global fidsohien
  wtec tth t fdrene  couissoon t .s  fidsoare ootlzero.

  0wpag 

  66..  IInniittiiaalliizzaattiioonn aanndd cclleeaannuupp


  Ttis seiiihn g4ves brief hiiss asotordesirable fea
uresidor tte Coda
  FS Dsaidrd
t styrsup 
nd upah shutdown dt Venusedailur s.  Before
  eiser4he t h discuss4ah it is useful toirfpeas t at s h Coda FS Dsaidr
 pmaippyinslt h folavwis: raty:


  1.omessagv queies

  2.ocnodes

  3.ons eacache fisries

     T h ns eacache fisriesoare fisirely privaie tort h rsaidr, sort hy
     can easily bh manipulsted.   Tthrmessagv queies wclaigend ylly h
ve
     clfardpoiiss of initialezyt4ahoapd dhstruc
4ah.  Tthocnodesoare
     much more rflicatp.d User pro essesoholdet fdrene  couissoin Coda
     filvsystemse
nd it 
enibe rifficultktolcleao upet eocnodes.

  Iiocan expeiiorequests t rfugm:

  1.os h messagv subsystem

  2.os h VFSelaydr

  3.opioctl innarfacp

     Currently tte _p_i_o_c_t_l passes t rfugmdt hsVFSefor Coda so we can
     treas t hsv similarly.


  66..11..  RReeqquuiirreemmeennttss


d T h folavwis: requiremviss swork wbh accommodsted:

  1.oTthrmessagv queies swork wh
vhdopehoan wcl.s  rout4svs.  On Unix
 e   t h opehis: ofdt eocvaraiidr rfile soare such rout4svs.

  +o  Before opehis:, oormessagvs 
enibe placpd.

  +o  Opehis: willoremovh any ok wmessagvs stclaipaooing.

  +o  Cl.s  wcll oouify any sleepis:rpro esses t aupt hir upcall 
ennou
 e   bh completpd.

  +o  Cl.s  wcll freh all memorypallvcsted by t hdmessagv queies.


  2.oAtdopehot i ns ecache shalaibe initialezvdotolempsypst
te.

  3.oBefore t hdmessagv queiesoare opeh, all VFS operat4ahs wclaidail.
 e   Forsunstelylttis 
enibe acheeved by mak4he sure t enimouisis: t i
     Coda filvsystem 
ennoupsuc eed b-fore opehis:.

  4.oAftsl cl.sis: ofdt eoqueies, oorVFS operat4ahs 
enisuc eed.  Here
     one nehdsnto bh careful, s4hce a few dperat4ahs (lookup,
     read/writ , readrir) 
enipro ehdkwcomout upcalls.  T hsv musdvbh
     explicitly blvckpd.

  5. Upah cl.sis: t i ns ecache shalaibe flushed apd disabled.

  6. Ala memorypheld by cnodeso
enibe frehdkwcomout relyis: on upcalls.

  7. Unmouisis: t i filv system 
enibe rone wcomout relyis: on upcalls.

  8. Mouisis: t i Coda filvsystem swork wdail gracefullyiif Venus cannou
 e   getot h tootfidnor t h attribu
es ofis h tootfid.  Ttholsttdrpis
     bhsupimplemvishd by Venus fhtcheve t hse objeiis b-fore sttdmps4s:
     to mouis.

  NNOOTTEE  NetBSD in pyrseculardbui also Levic h
vhdooupimplemvishd t i
  abovh requiremviss fully.  For smooth operat4ah ttis nehdsnto bh
  correiied.



