1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045 |
- #include <u.h>
- #include <libc.h>
- #include <thread.h>
- #include <sunrpc.h>
- #include <nfs3.h>
- char*
- nfs3StatusStr(Nfs3Status x)
- {
- switch(x){
- case Nfs3Ok:
- return "Nfs3Ok";
- case Nfs3ErrNotOwner:
- return "Nfs3ErrNotOwner";
- case Nfs3ErrNoEnt:
- return "Nfs3ErrNoEnt";
- case Nfs3ErrNoMem:
- return "Nfs3ErrNoMem";
- case Nfs3ErrIo:
- return "Nfs3ErrIo";
- case Nfs3ErrNxio:
- return "Nfs3ErrNxio";
- case Nfs3ErrAcces:
- return "Nfs3ErrAcces";
- case Nfs3ErrExist:
- return "Nfs3ErrExist";
- case Nfs3ErrXDev:
- return "Nfs3ErrXDev";
- case Nfs3ErrNoDev:
- return "Nfs3ErrNoDev";
- case Nfs3ErrNotDir:
- return "Nfs3ErrNotDir";
- case Nfs3ErrIsDir:
- return "Nfs3ErrIsDir";
- case Nfs3ErrInval:
- return "Nfs3ErrInval";
- case Nfs3ErrFbig:
- return "Nfs3ErrFbig";
- case Nfs3ErrNoSpc:
- return "Nfs3ErrNoSpc";
- case Nfs3ErrRoFs:
- return "Nfs3ErrRoFs";
- case Nfs3ErrMLink:
- return "Nfs3ErrMLink";
- case Nfs3ErrNameTooLong:
- return "Nfs3ErrNameTooLong";
- case Nfs3ErrNotEmpty:
- return "Nfs3ErrNotEmpty";
- case Nfs3ErrDQuot:
- return "Nfs3ErrDQuot";
- case Nfs3ErrStale:
- return "Nfs3ErrStale";
- case Nfs3ErrRemote:
- return "Nfs3ErrRemote";
- case Nfs3ErrBadHandle:
- return "Nfs3ErrBadHandle";
- case Nfs3ErrNotSync:
- return "Nfs3ErrNotSync";
- case Nfs3ErrBadCookie:
- return "Nfs3ErrBadCookie";
- case Nfs3ErrNotSupp:
- return "Nfs3ErrNotSupp";
- case Nfs3ErrTooSmall:
- return "Nfs3ErrTooSmall";
- case Nfs3ErrServerFault:
- return "Nfs3ErrServerFault";
- case Nfs3ErrBadType:
- return "Nfs3ErrBadType";
- case Nfs3ErrJukebox:
- return "Nfs3ErrJukebox";
- case Nfs3ErrFprintNotFound:
- return "Nfs3ErrFprintNotFound";
- case Nfs3ErrAborted:
- return "Nfs3ErrAborted";
- default:
- return "unknown";
- }
- }
- static struct {
- SunStatus status;
- char *msg;
- } etab[] = {
- Nfs3ErrNotOwner, "not owner",
- Nfs3ErrNoEnt, "directory entry not found",
- Nfs3ErrIo, "i/o error",
- Nfs3ErrNxio, "no such device",
- Nfs3ErrNoMem, "out of memory",
- Nfs3ErrAcces, "access denied",
- Nfs3ErrExist, "file or directory exists",
- Nfs3ErrXDev, "cross-device operation",
- Nfs3ErrNoDev, "no such device",
- Nfs3ErrNotDir, "not a directory",
- Nfs3ErrIsDir, "is a directory",
- Nfs3ErrInval, "invalid arguments",
- Nfs3ErrFbig, "file too big",
- Nfs3ErrNoSpc, "no space left on device",
- Nfs3ErrRoFs, "read-only file system",
- Nfs3ErrMLink, "too many links",
- Nfs3ErrNameTooLong, "name too long",
- Nfs3ErrNotEmpty, "directory not empty",
- Nfs3ErrDQuot, "dquot",
- Nfs3ErrStale, "stale handle",
- Nfs3ErrRemote, "remote error",
- Nfs3ErrBadHandle, "bad handle",
- Nfs3ErrNotSync, "out of sync with server",
- Nfs3ErrBadCookie, "bad cookie",
- Nfs3ErrNotSupp, "not supported",
- Nfs3ErrTooSmall, "too small",
- Nfs3ErrServerFault, "server fault",
- Nfs3ErrBadType, "bad type",
- Nfs3ErrJukebox, "jukebox -- try again later",
- Nfs3ErrFprintNotFound, "fprint not found",
- Nfs3ErrAborted, "aborted",
- };
- void
- nfs3Errstr(SunStatus status)
- {
- int i;
- for(i=0; i<nelem(etab); i++){
- if(etab[i].status == status){
- werrstr(etab[i].msg);
- return;
- }
- }
- werrstr("unknown nfs3 error %d", (int)status);
- }
- char*
- nfs3FileTypeStr(Nfs3FileType x)
- {
- switch(x){
- case Nfs3FileReg:
- return "Nfs3FileReg";
- case Nfs3FileDir:
- return "Nfs3FileDir";
- case Nfs3FileBlock:
- return "Nfs3FileBlock";
- case Nfs3FileChar:
- return "Nfs3FileChar";
- case Nfs3FileSymlink:
- return "Nfs3FileSymlink";
- case Nfs3FileSocket:
- return "Nfs3FileSocket";
- case Nfs3FileFifo:
- return "Nfs3FileFifo";
- default:
- return "unknown";
- }
- }
- void
- nfs3HandlePrint(Fmt *fmt, Nfs3Handle *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3Handle");
- fmtprint(fmt, "\t%s=", "handle");
- if(x->len > 64)
- fmtprint(fmt, "%.*H... (%d)", 64, x->h, x->len);
- else
- fmtprint(fmt, "%.*H", x->len, x->h);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3HandleSize(Nfs3Handle *x)
- {
- uint a;
- USED(x);
- a = 0 + sunVarOpaqueSize(x->len);
- return a;
- }
- int
- nfs3HandlePack(uchar *a, uchar *ea, uchar **pa, Nfs3Handle *x)
- {
- if(x->len > Nfs3MaxHandleSize || sunUint32Pack(a, ea, &a, &x->len) < 0
- || sunFixedOpaquePack(a, ea, &a, x->h, x->len) < 0)
- goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3HandleUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Handle *x)
- {
- uchar *ha;
- u32int n;
- if(sunUint32Unpack(a, ea, &a, &n) < 0 || n > Nfs3MaxHandleSize)
- goto Err;
- ha = a;
- a += (n+3)&~3;
- if(a > ea)
- goto Err;
- memmove(x->h, ha, n);
- x->len = n;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TimePrint(Fmt *fmt, Nfs3Time *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3Time");
- fmtprint(fmt, "\t%s=", "sec");
- fmtprint(fmt, "%ud", x->sec);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "nsec");
- fmtprint(fmt, "%ud", x->nsec);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TimeSize(Nfs3Time *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- return a;
- }
- int
- nfs3TimePack(uchar *a, uchar *ea, uchar **pa, Nfs3Time *x)
- {
- if(sunUint32Pack(a, ea, &a, &x->sec) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->nsec) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TimeUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Time *x)
- {
- if(sunUint32Unpack(a, ea, &a, &x->sec) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->nsec) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3AttrPrint(Fmt *fmt, Nfs3Attr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3Attr");
- fmtprint(fmt, "\t%s=", "type");
- fmtprint(fmt, "%s", nfs3FileTypeStr(x->type));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "mode");
- fmtprint(fmt, "%ud", x->mode);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "nlink");
- fmtprint(fmt, "%ud", x->nlink);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "uid");
- fmtprint(fmt, "%ud", x->uid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "gid");
- fmtprint(fmt, "%ud", x->gid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "size");
- fmtprint(fmt, "%llud", x->size);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "used");
- fmtprint(fmt, "%llud", x->used);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "major");
- fmtprint(fmt, "%ud", x->major);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "minor");
- fmtprint(fmt, "%ud", x->minor);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "fsid");
- fmtprint(fmt, "%llud", x->fsid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "fileid");
- fmtprint(fmt, "%llud", x->fileid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "atime");
- nfs3TimePrint(fmt, &x->atime);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "mtime");
- nfs3TimePrint(fmt, &x->mtime);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "ctime");
- nfs3TimePrint(fmt, &x->ctime);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3AttrSize(Nfs3Attr *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 4 + 8 + 8 + nfs3TimeSize(&x->atime) + nfs3TimeSize(&x->mtime) + nfs3TimeSize(&x->ctime);
- return a;
- }
- int
- nfs3AttrPack(uchar *a, uchar *ea, uchar **pa, Nfs3Attr *x)
- {
- int i;
- if(i=x->type, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->mode) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->nlink) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->uid) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->gid) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->size) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->used) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->major) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->minor) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->fsid) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->atime) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->mtime) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->ctime) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3AttrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Attr *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->type = i;
- if(sunUint32Unpack(a, ea, &a, &x->mode) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->nlink) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->uid) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->gid) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->size) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->used) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->major) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->minor) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->fsid) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->atime) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->mtime) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->ctime) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3WccAttrPrint(Fmt *fmt, Nfs3WccAttr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3WccAttr");
- fmtprint(fmt, "\t%s=", "size");
- fmtprint(fmt, "%llud", x->size);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "mtime");
- nfs3TimePrint(fmt, &x->mtime);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "ctime");
- nfs3TimePrint(fmt, &x->ctime);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3WccAttrSize(Nfs3WccAttr *x)
- {
- uint a;
- USED(x);
- a = 0 + 8 + nfs3TimeSize(&x->mtime) + nfs3TimeSize(&x->ctime);
- return a;
- }
- int
- nfs3WccAttrPack(uchar *a, uchar *ea, uchar **pa, Nfs3WccAttr *x)
- {
- if(sunUint64Pack(a, ea, &a, &x->size) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->mtime) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->ctime) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3WccAttrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3WccAttr *x)
- {
- if(sunUint64Unpack(a, ea, &a, &x->size) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->mtime) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->ctime) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3WccPrint(Fmt *fmt, Nfs3Wcc *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3Wcc");
- fmtprint(fmt, "\t%s=", "haveWccAttr");
- fmtprint(fmt, "%d", x->haveWccAttr);
- fmtprint(fmt, "\n");
- switch(x->haveWccAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "wccAttr");
- nfs3WccAttrPrint(fmt, &x->wccAttr);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3WccSize(Nfs3Wcc *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->haveWccAttr){
- case 1:
- a = a + nfs3WccAttrSize(&x->wccAttr);
- break;
- }
- a = a + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- return a;
- }
- int
- nfs3WccPack(uchar *a, uchar *ea, uchar **pa, Nfs3Wcc *x)
- {
- if(sunUint1Pack(a, ea, &a, &x->haveWccAttr) < 0) goto Err;
- switch(x->haveWccAttr){
- case 1:
- if(nfs3WccAttrPack(a, ea, &a, &x->wccAttr) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3WccUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Wcc *x)
- {
- if(sunUint1Unpack(a, ea, &a, &x->haveWccAttr) < 0) goto Err;
- switch(x->haveWccAttr){
- case 1:
- if(nfs3WccAttrUnpack(a, ea, &a, &x->wccAttr) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- char*
- nfs3SetTimeStr(Nfs3SetTime x)
- {
- switch(x){
- case Nfs3SetTimeDont:
- return "Nfs3SetTimeDont";
- case Nfs3SetTimeServer:
- return "Nfs3SetTimeServer";
- case Nfs3SetTimeClient:
- return "Nfs3SetTimeClient";
- default:
- return "unknown";
- }
- }
- void
- nfs3SetAttrPrint(Fmt *fmt, Nfs3SetAttr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3SetAttr");
- fmtprint(fmt, "\t%s=", "setMode");
- fmtprint(fmt, "%d", x->setMode);
- fmtprint(fmt, "\n");
- switch(x->setMode){
- case 1:
- fmtprint(fmt, "\t%s=", "mode");
- fmtprint(fmt, "%ud", x->mode);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "setUid");
- fmtprint(fmt, "%d", x->setUid);
- fmtprint(fmt, "\n");
- switch(x->setUid){
- case 1:
- fmtprint(fmt, "\t%s=", "uid");
- fmtprint(fmt, "%ud", x->uid);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "setGid");
- fmtprint(fmt, "%d", x->setGid);
- fmtprint(fmt, "\n");
- switch(x->setGid){
- case 1:
- fmtprint(fmt, "\t%s=", "gid");
- fmtprint(fmt, "%ud", x->gid);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "setSize");
- fmtprint(fmt, "%d", x->setSize);
- fmtprint(fmt, "\n");
- switch(x->setSize){
- case 1:
- fmtprint(fmt, "\t%s=", "size");
- fmtprint(fmt, "%llud", x->size);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "setAtime");
- fmtprint(fmt, "%s", nfs3SetTimeStr(x->setAtime));
- fmtprint(fmt, "\n");
- switch(x->setAtime){
- case Nfs3SetTimeClient:
- fmtprint(fmt, "\t%s=", "atime");
- nfs3TimePrint(fmt, &x->atime);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "setMtime");
- fmtprint(fmt, "%s", nfs3SetTimeStr(x->setMtime));
- fmtprint(fmt, "\n");
- switch(x->setMtime){
- case Nfs3SetTimeClient:
- fmtprint(fmt, "\t%s=", "mtime");
- nfs3TimePrint(fmt, &x->mtime);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3SetAttrSize(Nfs3SetAttr *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->setMode){
- case 1:
- a = a + 4;
- break;
- }
- a = a + 4;
- switch(x->setUid){
- case 1:
- a = a + 4;
- break;
- }
- a = a + 4;
- switch(x->setGid){
- case 1:
- a = a + 4;
- break;
- }
- a = a + 4;
- switch(x->setSize){
- case 1:
- a = a + 8;
- break;
- }
- a = a + 4;
- switch(x->setAtime){
- case Nfs3SetTimeClient:
- a = a + nfs3TimeSize(&x->atime);
- break;
- }
- a = a + 4;
- switch(x->setMtime){
- case Nfs3SetTimeClient:
- a = a + nfs3TimeSize(&x->mtime);
- break;
- }
- return a;
- }
- int
- nfs3SetAttrPack(uchar *a, uchar *ea, uchar **pa, Nfs3SetAttr *x)
- {
- int i;
- if(sunUint1Pack(a, ea, &a, &x->setMode) < 0) goto Err;
- switch(x->setMode){
- case 1:
- if(sunUint32Pack(a, ea, &a, &x->mode) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->setUid) < 0) goto Err;
- switch(x->setUid){
- case 1:
- if(sunUint32Pack(a, ea, &a, &x->uid) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->setGid) < 0) goto Err;
- switch(x->setGid){
- case 1:
- if(sunUint32Pack(a, ea, &a, &x->gid) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->setSize) < 0) goto Err;
- switch(x->setSize){
- case 1:
- if(sunUint64Pack(a, ea, &a, &x->size) < 0) goto Err;
- break;
- }
- if(i=x->setAtime, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->setAtime){
- case Nfs3SetTimeClient:
- if(nfs3TimePack(a, ea, &a, &x->atime) < 0) goto Err;
- break;
- }
- if(i=x->setMtime, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->setMtime){
- case Nfs3SetTimeClient:
- if(nfs3TimePack(a, ea, &a, &x->mtime) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3SetAttrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3SetAttr *x)
- {
- int i;
- if(sunUint1Unpack(a, ea, &a, &x->setMode) < 0) goto Err;
- switch(x->setMode){
- case 1:
- if(sunUint32Unpack(a, ea, &a, &x->mode) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->setUid) < 0) goto Err;
- switch(x->setUid){
- case 1:
- if(sunUint32Unpack(a, ea, &a, &x->uid) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->setGid) < 0) goto Err;
- switch(x->setGid){
- case 1:
- if(sunUint32Unpack(a, ea, &a, &x->gid) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->setSize) < 0) goto Err;
- switch(x->setSize){
- case 1:
- if(sunUint64Unpack(a, ea, &a, &x->size) < 0) goto Err;
- break;
- }
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->setAtime = i;
- switch(x->setAtime){
- case Nfs3SetTimeClient:
- if(nfs3TimeUnpack(a, ea, &a, &x->atime) < 0) goto Err;
- break;
- }
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->setMtime = i;
- switch(x->setMtime){
- case Nfs3SetTimeClient:
- if(nfs3TimeUnpack(a, ea, &a, &x->mtime) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TNullPrint(Fmt *fmt, Nfs3TNull *x)
- {
- USED(x);
- fmtprint(fmt, "%s\n", "Nfs3TNull");
- }
- uint
- nfs3TNullSize(Nfs3TNull *x)
- {
- uint a;
- USED(x);
- a = 0;
- return a;
- }
- int
- nfs3TNullPack(uchar *a, uchar *ea, uchar **pa, Nfs3TNull *x)
- {
- USED(x);
- USED(ea);
- *pa = a;
- return 0;
- }
- int
- nfs3TNullUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TNull *x)
- {
- USED(x);
- USED(ea);
- *pa = a;
- return 0;
- }
- void
- nfs3RNullPrint(Fmt *fmt, Nfs3RNull *x)
- {
- USED(x);
- fmtprint(fmt, "%s\n", "Nfs3RNull");
- }
- uint
- nfs3RNullSize(Nfs3RNull *x)
- {
- uint a;
- USED(x);
- a = 0;
- return a;
- }
- int
- nfs3RNullPack(uchar *a, uchar *ea, uchar **pa, Nfs3RNull *x)
- {
- USED(ea);
- USED(x);
- *pa = a;
- return 0;
- }
- int
- nfs3RNullUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RNull *x)
- {
- USED(ea);
- USED(x);
- *pa = a;
- return 0;
- }
- void
- nfs3TGetattrPrint(Fmt *fmt, Nfs3TGetattr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TGetattr");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TGetattrSize(Nfs3TGetattr *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle);
- return a;
- }
- int
- nfs3TGetattrPack(uchar *a, uchar *ea, uchar **pa, Nfs3TGetattr *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TGetattrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TGetattr *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RGetattrPrint(Fmt *fmt, Nfs3RGetattr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RGetattr");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RGetattrSize(Nfs3RGetattr *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- return a;
- }
- int
- nfs3RGetattrPack(uchar *a, uchar *ea, uchar **pa, Nfs3RGetattr *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RGetattrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RGetattr *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TSetattrPrint(Fmt *fmt, Nfs3TSetattr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TSetattr");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "checkCtime");
- fmtprint(fmt, "%d", x->checkCtime);
- fmtprint(fmt, "\n");
- switch(x->checkCtime){
- case 1:
- fmtprint(fmt, "\t%s=", "ctime");
- nfs3TimePrint(fmt, &x->ctime);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3TSetattrSize(Nfs3TSetattr *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + nfs3SetAttrSize(&x->attr) + 4;
- switch(x->checkCtime){
- case 1:
- a = a + nfs3TimeSize(&x->ctime);
- break;
- }
- return a;
- }
- int
- nfs3TSetattrPack(uchar *a, uchar *ea, uchar **pa, Nfs3TSetattr *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->checkCtime) < 0) goto Err;
- switch(x->checkCtime){
- case 1:
- if(nfs3TimePack(a, ea, &a, &x->ctime) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TSetattrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TSetattr *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->checkCtime) < 0) goto Err;
- switch(x->checkCtime){
- case 1:
- if(nfs3TimeUnpack(a, ea, &a, &x->ctime) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RSetattrPrint(Fmt *fmt, Nfs3RSetattr *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RSetattr");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "wcc");
- nfs3WccPrint(fmt, &x->wcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RSetattrSize(Nfs3RSetattr *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->wcc);
- return a;
- }
- int
- nfs3RSetattrPack(uchar *a, uchar *ea, uchar **pa, Nfs3RSetattr *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RSetattrUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RSetattr *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TLookupPrint(Fmt *fmt, Nfs3TLookup *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TLookup");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TLookupSize(Nfs3TLookup *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name);
- return a;
- }
- int
- nfs3TLookupPack(uchar *a, uchar *ea, uchar **pa, Nfs3TLookup *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TLookupUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TLookup *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RLookupPrint(Fmt *fmt, Nfs3RLookup *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RLookup");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- break;
- }
- fmtprint(fmt, "\t%s=", "haveDirAttr");
- fmtprint(fmt, "%d", x->haveDirAttr);
- fmtprint(fmt, "\n");
- switch(x->haveDirAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "dirAttr");
- nfs3AttrPrint(fmt, &x->dirAttr);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RLookupSize(Nfs3RLookup *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + nfs3HandleSize(&x->handle) + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- break;
- }
- a = a + 4;
- switch(x->haveDirAttr){
- case 1:
- a = a + nfs3AttrSize(&x->dirAttr);
- break;
- }
- return a;
- }
- int
- nfs3RLookupPack(uchar *a, uchar *ea, uchar **pa, Nfs3RLookup *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveDirAttr) < 0) goto Err;
- switch(x->haveDirAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->dirAttr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RLookupUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RLookup *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveDirAttr) < 0) goto Err;
- switch(x->haveDirAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->dirAttr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TAccessPrint(Fmt *fmt, Nfs3TAccess *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TAccess");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "access");
- fmtprint(fmt, "%ud", x->access);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TAccessSize(Nfs3TAccess *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 4;
- return a;
- }
- int
- nfs3TAccessPack(uchar *a, uchar *ea, uchar **pa, Nfs3TAccess *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->access) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TAccessUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TAccess *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->access) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RAccessPrint(Fmt *fmt, Nfs3RAccess *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RAccess");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "access");
- fmtprint(fmt, "%ud", x->access);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RAccessSize(Nfs3RAccess *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + 4;
- break;
- }
- return a;
- }
- int
- nfs3RAccessPack(uchar *a, uchar *ea, uchar **pa, Nfs3RAccess *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Pack(a, ea, &a, &x->access) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RAccessUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RAccess *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Unpack(a, ea, &a, &x->access) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TReadlinkPrint(Fmt *fmt, Nfs3TReadlink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TReadlink");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TReadlinkSize(Nfs3TReadlink *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle);
- return a;
- }
- int
- nfs3TReadlinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadlink *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TReadlinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadlink *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RReadlinkPrint(Fmt *fmt, Nfs3RReadlink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RReadlink");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "data");
- fmtprint(fmt, "\"%s\"", x->data);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RReadlinkSize(Nfs3RReadlink *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + sunStringSize(x->data);
- break;
- }
- return a;
- }
- int
- nfs3RReadlinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadlink *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunStringPack(a, ea, &a, &x->data, -1) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RReadlinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadlink *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunStringUnpack(a, ea, &a, &x->data, -1) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TReadPrint(Fmt *fmt, Nfs3TRead *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TRead");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "offset");
- fmtprint(fmt, "%llud", x->offset);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TReadSize(Nfs3TRead *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 8 + 4;
- return a;
- }
- int
- nfs3TReadPack(uchar *a, uchar *ea, uchar **pa, Nfs3TRead *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TReadUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TRead *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RReadPrint(Fmt *fmt, Nfs3RRead *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RRead");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "eof");
- fmtprint(fmt, "%d", x->eof);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "data");
- if(x->ndata <= 32)
- fmtprint(fmt, "%.*H", x->ndata, x->data);
- else
- fmtprint(fmt, "%.32H...", x->data);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RReadSize(Nfs3RRead *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + 4 + 4 + sunVarOpaqueSize(x->ndata);
- break;
- }
- return a;
- }
- int
- nfs3RReadPack(uchar *a, uchar *ea, uchar **pa, Nfs3RRead *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->eof) < 0) goto Err;
- if(sunVarOpaquePack(a, ea, &a, &x->data, &x->ndata, x->count) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RReadUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RRead *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->eof) < 0) goto Err;
- if(sunVarOpaqueUnpack(a, ea, &a, &x->data, &x->ndata, x->count) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- char*
- nfs3SyncStr(Nfs3Sync x)
- {
- switch(x){
- case Nfs3SyncNone:
- return "Nfs3SyncNone";
- case Nfs3SyncData:
- return "Nfs3SyncData";
- case Nfs3SyncFile:
- return "Nfs3SyncFile";
- default:
- return "unknown";
- }
- }
- void
- nfs3TWritePrint(Fmt *fmt, Nfs3TWrite *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TWrite");
- fmtprint(fmt, "\t%s=", "file");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "offset");
- fmtprint(fmt, "%llud", x->offset);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "stable");
- fmtprint(fmt, "%s", nfs3SyncStr(x->stable));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "data");
- if(x->ndata > 32)
- fmtprint(fmt, "%.32H... (%d)", x->data, x->ndata);
- else
- fmtprint(fmt, "%.*H", x->ndata, x->data);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TWriteSize(Nfs3TWrite *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 8 + 4 + 4 + sunVarOpaqueSize(x->ndata);
- return a;
- }
- int
- nfs3TWritePack(uchar *a, uchar *ea, uchar **pa, Nfs3TWrite *x)
- {
- int i;
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- if(i=x->stable, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunVarOpaquePack(a, ea, &a, &x->data, &x->ndata, x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TWriteUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TWrite *x)
- {
- int i;
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->stable = i;
- if(sunVarOpaqueUnpack(a, ea, &a, &x->data, &x->ndata, x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RWritePrint(Fmt *fmt, Nfs3RWrite *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RWrite");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "wcc");
- nfs3WccPrint(fmt, &x->wcc);
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "committed");
- fmtprint(fmt, "%s", nfs3SyncStr(x->committed));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3WriteVerfSize, x->verf);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RWriteSize(Nfs3RWrite *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->wcc);
- switch(x->status){
- case Nfs3Ok:
- a = a + 4 + 4 + Nfs3WriteVerfSize;
- break;
- }
- return a;
- }
- int
- nfs3RWritePack(uchar *a, uchar *ea, uchar **pa, Nfs3RWrite *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->wcc) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- if(i=x->committed, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3WriteVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RWriteUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RWrite *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->wcc) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->committed = i;
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3WriteVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- char*
- nfs3CreateStr(Nfs3Create x)
- {
- switch(x){
- case Nfs3CreateUnchecked:
- return "Nfs3CreateUnchecked";
- case Nfs3CreateGuarded:
- return "Nfs3CreateGuarded";
- case Nfs3CreateExclusive:
- return "Nfs3CreateExclusive";
- default:
- return "unknown";
- }
- }
- void
- nfs3TCreatePrint(Fmt *fmt, Nfs3TCreate *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TCreate");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "mode");
- fmtprint(fmt, "%s", nfs3CreateStr(x->mode));
- fmtprint(fmt, "\n");
- switch(x->mode){
- case Nfs3CreateUnchecked:
- case Nfs3CreateGuarded:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- case Nfs3CreateExclusive:
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3CreateVerfSize, x->verf);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3TCreateSize(Nfs3TCreate *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name) + 4;
- switch(x->mode){
- case Nfs3CreateUnchecked:
- case Nfs3CreateGuarded:
- a = a + nfs3SetAttrSize(&x->attr);
- break;
- case Nfs3CreateExclusive:
- a = a + Nfs3CreateVerfSize;
- break;
- }
- return a;
- }
- int
- nfs3TCreatePack(uchar *a, uchar *ea, uchar **pa, Nfs3TCreate *x)
- {
- int i;
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(i=x->mode, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->mode){
- case Nfs3CreateUnchecked:
- case Nfs3CreateGuarded:
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- case Nfs3CreateExclusive:
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3CreateVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TCreateUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TCreate *x)
- {
- int i;
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->mode = i;
- switch(x->mode){
- case Nfs3CreateUnchecked:
- case Nfs3CreateGuarded:
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- case Nfs3CreateExclusive:
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3CreateVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RCreatePrint(Fmt *fmt, Nfs3RCreate *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RCreate");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "haveHandle");
- fmtprint(fmt, "%d", x->haveHandle);
- fmtprint(fmt, "\n");
- switch(x->haveHandle){
- case 1:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- break;
- }
- fmtprint(fmt, "\t%s=", "dirWcc");
- nfs3WccPrint(fmt, &x->dirWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RCreateSize(Nfs3RCreate *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + 4;
- switch(x->haveHandle){
- case 1:
- a = a + nfs3HandleSize(&x->handle);
- break;
- }
- a = a + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- break;
- }
- a = a + nfs3WccSize(&x->dirWcc);
- return a;
- }
- int
- nfs3RCreatePack(uchar *a, uchar *ea, uchar **pa, Nfs3RCreate *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Pack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccPack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RCreateUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RCreate *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Unpack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccUnpack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TMkdirPrint(Fmt *fmt, Nfs3TMkdir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TMkdir");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TMkdirSize(Nfs3TMkdir *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name) + nfs3SetAttrSize(&x->attr);
- return a;
- }
- int
- nfs3TMkdirPack(uchar *a, uchar *ea, uchar **pa, Nfs3TMkdir *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TMkdirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TMkdir *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RMkdirPrint(Fmt *fmt, Nfs3RMkdir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RMkdir");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "haveHandle");
- fmtprint(fmt, "%d", x->haveHandle);
- fmtprint(fmt, "\n");
- switch(x->haveHandle){
- case 1:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- break;
- }
- fmtprint(fmt, "\t%s=", "dirWcc");
- nfs3WccPrint(fmt, &x->dirWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RMkdirSize(Nfs3RMkdir *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + 4;
- switch(x->haveHandle){
- case 1:
- a = a + nfs3HandleSize(&x->handle);
- break;
- }
- a = a + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- break;
- }
- a = a + nfs3WccSize(&x->dirWcc);
- return a;
- }
- int
- nfs3RMkdirPack(uchar *a, uchar *ea, uchar **pa, Nfs3RMkdir *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Pack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccPack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RMkdirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RMkdir *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Unpack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccUnpack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TSymlinkPrint(Fmt *fmt, Nfs3TSymlink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TSymlink");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "data");
- fmtprint(fmt, "\"%s\"", x->data);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TSymlinkSize(Nfs3TSymlink *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name) + nfs3SetAttrSize(&x->attr) + sunStringSize(x->data);
- return a;
- }
- int
- nfs3TSymlinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3TSymlink *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->data, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TSymlinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TSymlink *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->data, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RSymlinkPrint(Fmt *fmt, Nfs3RSymlink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RSymlink");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "haveHandle");
- fmtprint(fmt, "%d", x->haveHandle);
- fmtprint(fmt, "\n");
- switch(x->haveHandle){
- case 1:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- break;
- }
- fmtprint(fmt, "\t%s=", "dirWcc");
- nfs3WccPrint(fmt, &x->dirWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RSymlinkSize(Nfs3RSymlink *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + 4;
- switch(x->haveHandle){
- case 1:
- a = a + nfs3HandleSize(&x->handle);
- break;
- }
- a = a + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- break;
- }
- a = a + nfs3WccSize(&x->dirWcc);
- return a;
- }
- int
- nfs3RSymlinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3RSymlink *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Pack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccPack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RSymlinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RSymlink *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Unpack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccUnpack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TMknodPrint(Fmt *fmt, Nfs3TMknod *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TMknod");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "type");
- fmtprint(fmt, "%s", nfs3FileTypeStr(x->type));
- fmtprint(fmt, "\n");
- switch(x->type){
- case Nfs3FileChar:
- case Nfs3FileBlock:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "major");
- fmtprint(fmt, "%ud", x->major);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "minor");
- fmtprint(fmt, "%ud", x->minor);
- fmtprint(fmt, "\n");
- break;
- case Nfs3FileSocket:
- case Nfs3FileFifo:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3SetAttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3TMknodSize(Nfs3TMknod *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name) + 4;
- switch(x->type){
- case Nfs3FileChar:
- case Nfs3FileBlock:
- a = a + nfs3SetAttrSize(&x->attr) + 4 + 4;
- break;
- case Nfs3FileSocket:
- case Nfs3FileFifo:
- a = a + nfs3SetAttrSize(&x->attr);
- break;
- }
- return a;
- }
- int
- nfs3TMknodPack(uchar *a, uchar *ea, uchar **pa, Nfs3TMknod *x)
- {
- int i;
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(i=x->type, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->type){
- case Nfs3FileChar:
- case Nfs3FileBlock:
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->major) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->minor) < 0) goto Err;
- break;
- case Nfs3FileSocket:
- case Nfs3FileFifo:
- if(nfs3SetAttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TMknodUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TMknod *x)
- {
- int i;
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->type = i;
- switch(x->type){
- case Nfs3FileChar:
- case Nfs3FileBlock:
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->major) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->minor) < 0) goto Err;
- break;
- case Nfs3FileSocket:
- case Nfs3FileFifo:
- if(nfs3SetAttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RMknodPrint(Fmt *fmt, Nfs3RMknod *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RMknod");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "haveHandle");
- fmtprint(fmt, "%d", x->haveHandle);
- fmtprint(fmt, "\n");
- switch(x->haveHandle){
- case 1:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- break;
- }
- fmtprint(fmt, "\t%s=", "dirWcc");
- nfs3WccPrint(fmt, &x->dirWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RMknodSize(Nfs3RMknod *x)
- {
- uint a;
- USED(x);
- a = 0 + 4;
- switch(x->status){
- case Nfs3Ok:
- a = a + 4;
- switch(x->haveHandle){
- case 1:
- a = a + nfs3HandleSize(&x->handle);
- break;
- }
- a = a + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- break;
- }
- a = a + nfs3WccSize(&x->dirWcc);
- return a;
- }
- int
- nfs3RMknodPack(uchar *a, uchar *ea, uchar **pa, Nfs3RMknod *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Pack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccPack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RMknodUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RMknod *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- switch(x->status){
- case Nfs3Ok:
- if(sunUint1Unpack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- break;
- }
- if(nfs3WccUnpack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TRemovePrint(Fmt *fmt, Nfs3TRemove *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TRemove");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TRemoveSize(Nfs3TRemove *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name);
- return a;
- }
- int
- nfs3TRemovePack(uchar *a, uchar *ea, uchar **pa, Nfs3TRemove *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TRemoveUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TRemove *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RRemovePrint(Fmt *fmt, Nfs3RRemove *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RRemove");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "wcc");
- nfs3WccPrint(fmt, &x->wcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RRemoveSize(Nfs3RRemove *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->wcc);
- return a;
- }
- int
- nfs3RRemovePack(uchar *a, uchar *ea, uchar **pa, Nfs3RRemove *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RRemoveUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RRemove *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TRmdirPrint(Fmt *fmt, Nfs3TRmdir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TRmdir");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TRmdirSize(Nfs3TRmdir *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + sunStringSize(x->name);
- return a;
- }
- int
- nfs3TRmdirPack(uchar *a, uchar *ea, uchar **pa, Nfs3TRmdir *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TRmdirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TRmdir *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RRmdirPrint(Fmt *fmt, Nfs3RRmdir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RRmdir");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "wcc");
- nfs3WccPrint(fmt, &x->wcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RRmdirSize(Nfs3RRmdir *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->wcc);
- return a;
- }
- int
- nfs3RRmdirPack(uchar *a, uchar *ea, uchar **pa, Nfs3RRmdir *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RRmdirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RRmdir *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->wcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TRenamePrint(Fmt *fmt, Nfs3TRename *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TRename");
- fmtprint(fmt, "\t%s=", "from");
- fmtprint(fmt, "{\n");
- fmtprint(fmt, "\t\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->from.handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->from.name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t}");
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "to");
- fmtprint(fmt, "{\n");
- fmtprint(fmt, "\t\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->to.handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->to.name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t}");
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TRenameSize(Nfs3TRename *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->from.handle) + sunStringSize(x->from.name) + nfs3HandleSize(&x->to.handle) + sunStringSize(x->to.name);
- return a;
- }
- int
- nfs3TRenamePack(uchar *a, uchar *ea, uchar **pa, Nfs3TRename *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->from.handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->from.name, -1) < 0) goto Err;
- if(nfs3HandlePack(a, ea, &a, &x->to.handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->to.name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TRenameUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TRename *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->from.handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->from.name, -1) < 0) goto Err;
- if(nfs3HandleUnpack(a, ea, &a, &x->to.handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->to.name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RRenamePrint(Fmt *fmt, Nfs3RRename *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RRename");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "fromWcc");
- nfs3WccPrint(fmt, &x->fromWcc);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "toWcc");
- nfs3WccPrint(fmt, &x->toWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RRenameSize(Nfs3RRename *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->fromWcc) + nfs3WccSize(&x->toWcc);
- return a;
- }
- int
- nfs3RRenamePack(uchar *a, uchar *ea, uchar **pa, Nfs3RRename *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->fromWcc) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->toWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RRenameUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RRename *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->fromWcc) < 0) goto Err;
- if(nfs3WccUnpack(a, ea, &a, &x->toWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TLinkPrint(Fmt *fmt, Nfs3TLink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TLink");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "link");
- fmtprint(fmt, "{\n");
- fmtprint(fmt, "\t\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->link.handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->link.name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t}");
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TLinkSize(Nfs3TLink *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + nfs3HandleSize(&x->link.handle) + sunStringSize(x->link.name);
- return a;
- }
- int
- nfs3TLinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3TLink *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(nfs3HandlePack(a, ea, &a, &x->link.handle) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->link.name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TLinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TLink *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(nfs3HandleUnpack(a, ea, &a, &x->link.handle) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->link.name, -1) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RLinkPrint(Fmt *fmt, Nfs3RLink *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RLink");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "dirWcc");
- nfs3WccPrint(fmt, &x->dirWcc);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3RLinkSize(Nfs3RLink *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- a = a + nfs3WccSize(&x->dirWcc);
- return a;
- }
- int
- nfs3RLinkPack(uchar *a, uchar *ea, uchar **pa, Nfs3RLink *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(nfs3WccPack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RLinkUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RLink *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(nfs3WccUnpack(a, ea, &a, &x->dirWcc) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TReadDirPrint(Fmt *fmt, Nfs3TReadDir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TReadDir");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "cookie");
- fmtprint(fmt, "%llud", x->cookie);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3CookieVerfSize, x->verf);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TReadDirSize(Nfs3TReadDir *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 8 + Nfs3CookieVerfSize + 4;
- return a;
- }
- int
- nfs3TReadDirPack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadDir *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TReadDirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadDir *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3EntryPrint(Fmt *fmt, Nfs3Entry *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3Entry");
- fmtprint(fmt, "\t%s=", "fileid");
- fmtprint(fmt, "%llud", x->fileid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "cookie");
- fmtprint(fmt, "%llud", x->cookie);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3EntrySize(Nfs3Entry *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 8 + sunStringSize(x->name) + 8;
- return a;
- }
- int
- nfs3EntryPack(uchar *a, uchar *ea, uchar **pa, Nfs3Entry *x)
- {
- u1int one;
- one = 1;
- if(sunUint1Pack(a, ea, &a, &one) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->cookie) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3EntryUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Entry *x)
- {
- u1int one;
- memset(x, 0, sizeof *x);
- if(sunUint1Unpack(a, ea, &a, &one) < 0 || one != 1) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->cookie) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RReadDirPrint(Fmt *fmt, Nfs3RReadDir *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RReadDir");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3CookieVerfSize, x->verf);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=%ud\n", "count", x->count);
- fmtprint(fmt, "\t%s=", "eof");
- fmtprint(fmt, "%d", x->eof);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RReadDirSize(Nfs3RReadDir *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + Nfs3CookieVerfSize;
- a += x->count;
- a += 4 + 4;
- break;
- }
- return a;
- }
- int
- nfs3RReadDirPack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadDir *x)
- {
- int i;
- u1int zero;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunFixedOpaquePack(a, ea, &a, x->data, x->count) < 0) goto Err;
- zero = 0;
- if(sunUint1Pack(a, ea, &a, &zero) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->eof) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- static int
- countEntry(uchar *a, uchar *ea, uchar **pa, u32int *n)
- {
- uchar *oa;
- u64int u64;
- u32int u32;
- u1int u1;
- oa = a;
- for(;;){
- if(sunUint1Unpack(a, ea, &a, &u1) < 0)
- return -1;
- if(u1 == 0)
- break;
- if(sunUint64Unpack(a, ea, &a, &u64) < 0
- || sunUint32Unpack(a, ea, &a, &u32) < 0)
- return -1;
- a += (u32+3)&~3;
- if(a >= ea)
- return -1;
- if(sunUint64Unpack(a, ea, &a, &u64) < 0)
- return -1;
- }
- *n = (a-4) - oa;
- *pa = a;
- return 0;
- }
- int
- nfs3RReadDirUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadDir *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(x->status == Nfs3Ok){
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- x->data = a;
- if(countEntry(a, ea, &a, &x->count) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->eof) < 0) goto Err;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TReadDirPlusPrint(Fmt *fmt, Nfs3TReadDirPlus *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TReadDirPlus");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "cookie");
- fmtprint(fmt, "%llud", x->cookie);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3CookieVerfSize, x->verf);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "dirCount");
- fmtprint(fmt, "%ud", x->dirCount);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "maxCount");
- fmtprint(fmt, "%ud", x->maxCount);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TReadDirPlusSize(Nfs3TReadDirPlus *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 8 + Nfs3CookieVerfSize + 4 + 4;
- return a;
- }
- int
- nfs3TReadDirPlusPack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadDirPlus *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->dirCount) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->maxCount) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TReadDirPlusUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TReadDirPlus *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->dirCount) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->maxCount) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3EntryPlusPrint(Fmt *fmt, Nfs3Entry *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3EntryPlus");
- fmtprint(fmt, "\t%s=", "fileid");
- fmtprint(fmt, "%llud", x->fileid);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "name");
- fmtprint(fmt, "\"%s\"", x->name);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "cookie");
- fmtprint(fmt, "%llud", x->cookie);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- fmtprint(fmt, "\t%s=", "haveHandle");
- fmtprint(fmt, "%d", x->haveHandle);
- fmtprint(fmt, "\n");
- switch(x->haveHandle){
- case 1:
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3EntryPlusSize(Nfs3Entry *x)
- {
- uint a;
- USED(x);
- a = 0 + 8 + sunStringSize(x->name) + 8 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- a = a + 4;
- switch(x->haveHandle){
- case 1:
- a = a + nfs3HandleSize(&x->handle);
- break;
- }
- return a;
- }
- int
- nfs3EntryPlusPack(uchar *a, uchar *ea, uchar **pa, Nfs3Entry *x)
- {
- u1int u1;
- if(sunUint1Pack(a, ea, &a, &u1) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(sunStringPack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(sunUint1Pack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3EntryPlusUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3Entry *x)
- {
- u1int u1;
- if(sunUint1Unpack(a, ea, &a, &u1) < 0 || u1 != 1) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->fileid) < 0) goto Err;
- if(sunStringUnpack(a, ea, &a, &x->name, -1) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->cookie) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(sunUint1Unpack(a, ea, &a, &x->haveHandle) < 0) goto Err;
- switch(x->haveHandle){
- case 1:
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RReadDirPlusPrint(Fmt *fmt, Nfs3RReadDirPlus *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RReadDirPlus");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3CookieVerfSize, x->verf);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\tcount=%ud\n", x->count);
- fmtprint(fmt, "\t%s=", "eof");
- fmtprint(fmt, "%d", x->eof);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RReadDirPlusSize(Nfs3RReadDirPlus *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + Nfs3CookieVerfSize;
- a += x->count;
- a += 4 + 4;
- break;
- }
- return a;
- }
- int
- nfs3RReadDirPlusPack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadDirPlus *x)
- {
- int i;
- u1int zero;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- if(sunFixedOpaquePack(a, ea, &a, x->data, x->count) < 0) goto Err;
- zero = 0;
- if(sunUint1Pack(a, ea, &a, &zero) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->eof) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- static int
- countEntryPlus(uchar *a, uchar *ea, uchar **pa, u32int *n)
- {
- uchar *oa;
- u64int u64;
- u32int u32;
- u1int u1;
- Nfs3Handle h;
- Nfs3Attr attr;
- oa = a;
- for(;;){
- if(sunUint1Unpack(a, ea, &a, &u1) < 0)
- return -1;
- if(u1 == 0)
- break;
- if(sunUint64Unpack(a, ea, &a, &u64) < 0
- || sunUint32Unpack(a, ea, &a, &u32) < 0)
- return -1;
- a += (u32+3)&~3;
- if(a >= ea)
- return -1;
- if(sunUint64Unpack(a, ea, &a, &u64) < 0
- || sunUint1Unpack(a, ea, &a, &u1) < 0
- || (u1 && nfs3AttrUnpack(a, ea, &a, &attr) < 0)
- || sunUint1Unpack(a, ea, &a, &u1) < 0
- || (u1 && nfs3HandleUnpack(a, ea, &a, &h) < 0))
- return -1;
- }
- *n = (a-4) - oa;
- *pa = a;
- return 0;
- }
-
- int
- nfs3RReadDirPlusUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RReadDirPlus *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- if(x->status == Nfs3Ok){
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3CookieVerfSize) < 0) goto Err;
- x->data = a;
- if(countEntryPlus(a, ea, &a, &x->count) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->eof) < 0) goto Err;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TFsStatPrint(Fmt *fmt, Nfs3TFsStat *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TFsStat");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TFsStatSize(Nfs3TFsStat *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle);
- return a;
- }
- int
- nfs3TFsStatPack(uchar *a, uchar *ea, uchar **pa, Nfs3TFsStat *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TFsStatUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TFsStat *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RFsStatPrint(Fmt *fmt, Nfs3RFsStat *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RFsStat");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "totalBytes");
- fmtprint(fmt, "%llud", x->totalBytes);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "freeBytes");
- fmtprint(fmt, "%llud", x->freeBytes);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "availBytes");
- fmtprint(fmt, "%llud", x->availBytes);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "totalFiles");
- fmtprint(fmt, "%llud", x->totalFiles);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "freeFiles");
- fmtprint(fmt, "%llud", x->freeFiles);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "availFiles");
- fmtprint(fmt, "%llud", x->availFiles);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "invarSec");
- fmtprint(fmt, "%ud", x->invarSec);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RFsStatSize(Nfs3RFsStat *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + 8 + 8 + 8 + 8 + 8 + 8 + 4;
- break;
- }
- return a;
- }
- int
- nfs3RFsStatPack(uchar *a, uchar *ea, uchar **pa, Nfs3RFsStat *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint64Pack(a, ea, &a, &x->totalBytes) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->freeBytes) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->availBytes) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->totalFiles) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->freeFiles) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->availFiles) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->invarSec) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RFsStatUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RFsStat *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint64Unpack(a, ea, &a, &x->totalBytes) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->freeBytes) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->availBytes) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->totalFiles) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->freeFiles) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->availFiles) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->invarSec) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TFsInfoPrint(Fmt *fmt, Nfs3TFsInfo *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TFsInfo");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TFsInfoSize(Nfs3TFsInfo *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle);
- return a;
- }
- int
- nfs3TFsInfoPack(uchar *a, uchar *ea, uchar **pa, Nfs3TFsInfo *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TFsInfoUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TFsInfo *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RFsInfoPrint(Fmt *fmt, Nfs3RFsInfo *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RFsInfo");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "readMax");
- fmtprint(fmt, "%ud", x->readMax);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "readPref");
- fmtprint(fmt, "%ud", x->readPref);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "readMult");
- fmtprint(fmt, "%ud", x->readMult);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "writeMax");
- fmtprint(fmt, "%ud", x->writeMax);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "writePref");
- fmtprint(fmt, "%ud", x->writePref);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "writeMult");
- fmtprint(fmt, "%ud", x->writeMult);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "readDirPref");
- fmtprint(fmt, "%ud", x->readDirPref);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "maxFileSize");
- fmtprint(fmt, "%llud", x->maxFileSize);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "timePrec");
- nfs3TimePrint(fmt, &x->timePrec);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "flags");
- fmtprint(fmt, "%ud", x->flags);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RFsInfoSize(Nfs3RFsInfo *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 8 + nfs3TimeSize(&x->timePrec) + 4;
- break;
- }
- return a;
- }
- int
- nfs3RFsInfoPack(uchar *a, uchar *ea, uchar **pa, Nfs3RFsInfo *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Pack(a, ea, &a, &x->readMax) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->readPref) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->readMult) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->writeMax) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->writePref) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->writeMult) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->readDirPref) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->maxFileSize) < 0) goto Err;
- if(nfs3TimePack(a, ea, &a, &x->timePrec) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->flags) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RFsInfoUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RFsInfo *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Unpack(a, ea, &a, &x->readMax) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->readPref) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->readMult) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->writeMax) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->writePref) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->writeMult) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->readDirPref) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->maxFileSize) < 0) goto Err;
- if(nfs3TimeUnpack(a, ea, &a, &x->timePrec) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->flags) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TPathconfPrint(Fmt *fmt, Nfs3TPathconf *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TPathconf");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TPathconfSize(Nfs3TPathconf *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle);
- return a;
- }
- int
- nfs3TPathconfPack(uchar *a, uchar *ea, uchar **pa, Nfs3TPathconf *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TPathconfUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TPathconf *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RPathconfPrint(Fmt *fmt, Nfs3RPathconf *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RPathconf");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "haveAttr");
- fmtprint(fmt, "%d", x->haveAttr);
- fmtprint(fmt, "\n");
- switch(x->haveAttr){
- case 1:
- fmtprint(fmt, "\t%s=", "attr");
- nfs3AttrPrint(fmt, &x->attr);
- fmtprint(fmt, "\n");
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "maxLink");
- fmtprint(fmt, "%ud", x->maxLink);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "maxName");
- fmtprint(fmt, "%ud", x->maxName);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "noTrunc");
- fmtprint(fmt, "%d", x->noTrunc);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "chownRestricted");
- fmtprint(fmt, "%d", x->chownRestricted);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "caseInsensitive");
- fmtprint(fmt, "%d", x->caseInsensitive);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "casePreserving");
- fmtprint(fmt, "%d", x->casePreserving);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RPathconfSize(Nfs3RPathconf *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + 4;
- switch(x->haveAttr){
- case 1:
- a = a + nfs3AttrSize(&x->attr);
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- a = a + 4 + 4 + 4 + 4 + 4 + 4;
- break;
- }
- return a;
- }
- int
- nfs3RPathconfPack(uchar *a, uchar *ea, uchar **pa, Nfs3RPathconf *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrPack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Pack(a, ea, &a, &x->maxLink) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->maxName) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->noTrunc) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->chownRestricted) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->caseInsensitive) < 0) goto Err;
- if(sunUint1Pack(a, ea, &a, &x->casePreserving) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RPathconfUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RPathconf *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(sunUint1Unpack(a, ea, &a, &x->haveAttr) < 0) goto Err;
- switch(x->haveAttr){
- case 1:
- if(nfs3AttrUnpack(a, ea, &a, &x->attr) < 0) goto Err;
- break;
- }
- switch(x->status){
- case Nfs3Ok:
- if(sunUint32Unpack(a, ea, &a, &x->maxLink) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->maxName) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->noTrunc) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->chownRestricted) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->caseInsensitive) < 0) goto Err;
- if(sunUint1Unpack(a, ea, &a, &x->casePreserving) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3TCommitPrint(Fmt *fmt, Nfs3TCommit *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3TCommit");
- fmtprint(fmt, "\t%s=", "handle");
- nfs3HandlePrint(fmt, &x->handle);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "offset");
- fmtprint(fmt, "%llud", x->offset);
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "count");
- fmtprint(fmt, "%ud", x->count);
- fmtprint(fmt, "\n");
- }
- uint
- nfs3TCommitSize(Nfs3TCommit *x)
- {
- uint a;
- USED(x);
- a = 0 + nfs3HandleSize(&x->handle) + 8 + 4;
- return a;
- }
- int
- nfs3TCommitPack(uchar *a, uchar *ea, uchar **pa, Nfs3TCommit *x)
- {
- if(nfs3HandlePack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Pack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Pack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3TCommitUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3TCommit *x)
- {
- if(nfs3HandleUnpack(a, ea, &a, &x->handle) < 0) goto Err;
- if(sunUint64Unpack(a, ea, &a, &x->offset) < 0) goto Err;
- if(sunUint32Unpack(a, ea, &a, &x->count) < 0) goto Err;
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- void
- nfs3RCommitPrint(Fmt *fmt, Nfs3RCommit *x)
- {
- fmtprint(fmt, "%s\n", "Nfs3RCommit");
- fmtprint(fmt, "\t%s=", "status");
- fmtprint(fmt, "%s", nfs3StatusStr(x->status));
- fmtprint(fmt, "\n");
- fmtprint(fmt, "\t%s=", "wcc");
- nfs3WccPrint(fmt, &x->wcc);
- fmtprint(fmt, "\n");
- switch(x->status){
- case Nfs3Ok:
- fmtprint(fmt, "\t%s=", "verf");
- fmtprint(fmt, "%.*H", Nfs3WriteVerfSize, x->verf);
- fmtprint(fmt, "\n");
- break;
- }
- }
- uint
- nfs3RCommitSize(Nfs3RCommit *x)
- {
- uint a;
- USED(x);
- a = 0 + 4 + nfs3WccSize(&x->wcc);
- switch(x->status){
- case Nfs3Ok:
- a = a + Nfs3WriteVerfSize;
- break;
- }
- return a;
- }
- int
- nfs3RCommitPack(uchar *a, uchar *ea, uchar **pa, Nfs3RCommit *x)
- {
- int i;
- if(i=x->status, sunEnumPack(a, ea, &a, &i) < 0) goto Err;
- if(nfs3WccPack(a, ea, &a, &x->wcc) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunFixedOpaquePack(a, ea, &a, x->verf, Nfs3WriteVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- int
- nfs3RCommitUnpack(uchar *a, uchar *ea, uchar **pa, Nfs3RCommit *x)
- {
- int i;
- if(sunEnumUnpack(a, ea, &a, &i) < 0) goto Err; x->status = i;
- if(nfs3WccUnpack(a, ea, &a, &x->wcc) < 0) goto Err;
- switch(x->status){
- case Nfs3Ok:
- if(sunFixedOpaqueUnpack(a, ea, &a, x->verf, Nfs3WriteVerfSize) < 0) goto Err;
- break;
- }
- *pa = a;
- return 0;
- Err:
- *pa = ea;
- return -1;
- }
- typedef int (*P)(uchar*, uchar*, uchar**, SunCall*);
- typedef void (*F)(Fmt*, SunCall*);
- typedef uint (*S)(SunCall*);
- static SunProc proc[] = {
- (P)nfs3TNullPack, (P)nfs3TNullUnpack, (S)nfs3TNullSize, (F)nfs3TNullPrint, sizeof(Nfs3TNull),
- (P)nfs3RNullPack, (P)nfs3RNullUnpack, (S)nfs3RNullSize, (F)nfs3RNullPrint, sizeof(Nfs3RNull),
- (P)nfs3TGetattrPack, (P)nfs3TGetattrUnpack, (S)nfs3TGetattrSize, (F)nfs3TGetattrPrint, sizeof(Nfs3TGetattr),
- (P)nfs3RGetattrPack, (P)nfs3RGetattrUnpack, (S)nfs3RGetattrSize, (F)nfs3RGetattrPrint, sizeof(Nfs3RGetattr),
- (P)nfs3TSetattrPack, (P)nfs3TSetattrUnpack, (S)nfs3TSetattrSize, (F)nfs3TSetattrPrint, sizeof(Nfs3TSetattr),
- (P)nfs3RSetattrPack, (P)nfs3RSetattrUnpack, (S)nfs3RSetattrSize, (F)nfs3RSetattrPrint, sizeof(Nfs3RSetattr),
- (P)nfs3TLookupPack, (P)nfs3TLookupUnpack, (S)nfs3TLookupSize, (F)nfs3TLookupPrint, sizeof(Nfs3TLookup),
- (P)nfs3RLookupPack, (P)nfs3RLookupUnpack, (S)nfs3RLookupSize, (F)nfs3RLookupPrint, sizeof(Nfs3RLookup),
- (P)nfs3TAccessPack, (P)nfs3TAccessUnpack, (S)nfs3TAccessSize, (F)nfs3TAccessPrint, sizeof(Nfs3TAccess),
- (P)nfs3RAccessPack, (P)nfs3RAccessUnpack, (S)nfs3RAccessSize, (F)nfs3RAccessPrint, sizeof(Nfs3RAccess),
- (P)nfs3TReadlinkPack, (P)nfs3TReadlinkUnpack, (S)nfs3TReadlinkSize, (F)nfs3TReadlinkPrint, sizeof(Nfs3TReadlink),
- (P)nfs3RReadlinkPack, (P)nfs3RReadlinkUnpack, (S)nfs3RReadlinkSize, (F)nfs3RReadlinkPrint, sizeof(Nfs3RReadlink),
- (P)nfs3TReadPack, (P)nfs3TReadUnpack, (S)nfs3TReadSize, (F)nfs3TReadPrint, sizeof(Nfs3TRead),
- (P)nfs3RReadPack, (P)nfs3RReadUnpack, (S)nfs3RReadSize, (F)nfs3RReadPrint, sizeof(Nfs3RRead),
- (P)nfs3TWritePack, (P)nfs3TWriteUnpack, (S)nfs3TWriteSize, (F)nfs3TWritePrint, sizeof(Nfs3TWrite),
- (P)nfs3RWritePack, (P)nfs3RWriteUnpack, (S)nfs3RWriteSize, (F)nfs3RWritePrint, sizeof(Nfs3RWrite),
- (P)nfs3TCreatePack, (P)nfs3TCreateUnpack, (S)nfs3TCreateSize, (F)nfs3TCreatePrint, sizeof(Nfs3TCreate),
- (P)nfs3RCreatePack, (P)nfs3RCreateUnpack, (S)nfs3RCreateSize, (F)nfs3RCreatePrint, sizeof(Nfs3RCreate),
- (P)nfs3TMkdirPack, (P)nfs3TMkdirUnpack, (S)nfs3TMkdirSize, (F)nfs3TMkdirPrint, sizeof(Nfs3TMkdir),
- (P)nfs3RMkdirPack, (P)nfs3RMkdirUnpack, (S)nfs3RMkdirSize, (F)nfs3RMkdirPrint, sizeof(Nfs3RMkdir),
- (P)nfs3TSymlinkPack, (P)nfs3TSymlinkUnpack, (S)nfs3TSymlinkSize, (F)nfs3TSymlinkPrint, sizeof(Nfs3TSymlink),
- (P)nfs3RSymlinkPack, (P)nfs3RSymlinkUnpack, (S)nfs3RSymlinkSize, (F)nfs3RSymlinkPrint, sizeof(Nfs3RSymlink),
- (P)nfs3TMknodPack, (P)nfs3TMknodUnpack, (S)nfs3TMknodSize, (F)nfs3TMknodPrint, sizeof(Nfs3TMknod),
- (P)nfs3RMknodPack, (P)nfs3RMknodUnpack, (S)nfs3RMknodSize, (F)nfs3RMknodPrint, sizeof(Nfs3RMknod),
- (P)nfs3TRemovePack, (P)nfs3TRemoveUnpack, (S)nfs3TRemoveSize, (F)nfs3TRemovePrint, sizeof(Nfs3TRemove),
- (P)nfs3RRemovePack, (P)nfs3RRemoveUnpack, (S)nfs3RRemoveSize, (F)nfs3RRemovePrint, sizeof(Nfs3RRemove),
- (P)nfs3TRmdirPack, (P)nfs3TRmdirUnpack, (S)nfs3TRmdirSize, (F)nfs3TRmdirPrint, sizeof(Nfs3TRmdir),
- (P)nfs3RRmdirPack, (P)nfs3RRmdirUnpack, (S)nfs3RRmdirSize, (F)nfs3RRmdirPrint, sizeof(Nfs3RRmdir),
- (P)nfs3TRenamePack, (P)nfs3TRenameUnpack, (S)nfs3TRenameSize, (F)nfs3TRenamePrint, sizeof(Nfs3TRename),
- (P)nfs3RRenamePack, (P)nfs3RRenameUnpack, (S)nfs3RRenameSize, (F)nfs3RRenamePrint, sizeof(Nfs3RRename),
- (P)nfs3TLinkPack, (P)nfs3TLinkUnpack, (S)nfs3TLinkSize, (F)nfs3TLinkPrint, sizeof(Nfs3TLink),
- (P)nfs3RLinkPack, (P)nfs3RLinkUnpack, (S)nfs3RLinkSize, (F)nfs3RLinkPrint, sizeof(Nfs3RLink),
- (P)nfs3TReadDirPack, (P)nfs3TReadDirUnpack, (S)nfs3TReadDirSize, (F)nfs3TReadDirPrint, sizeof(Nfs3TReadDir),
- (P)nfs3RReadDirPack, (P)nfs3RReadDirUnpack, (S)nfs3RReadDirSize, (F)nfs3RReadDirPrint, sizeof(Nfs3RReadDir),
- (P)nfs3TReadDirPlusPack, (P)nfs3TReadDirPlusUnpack, (S)nfs3TReadDirPlusSize, (F)nfs3TReadDirPlusPrint, sizeof(Nfs3TReadDirPlus),
- (P)nfs3RReadDirPlusPack, (P)nfs3RReadDirPlusUnpack, (S)nfs3RReadDirPlusSize, (F)nfs3RReadDirPlusPrint, sizeof(Nfs3RReadDirPlus),
- (P)nfs3TFsStatPack, (P)nfs3TFsStatUnpack, (S)nfs3TFsStatSize, (F)nfs3TFsStatPrint, sizeof(Nfs3TFsStat),
- (P)nfs3RFsStatPack, (P)nfs3RFsStatUnpack, (S)nfs3RFsStatSize, (F)nfs3RFsStatPrint, sizeof(Nfs3RFsStat),
- (P)nfs3TFsInfoPack, (P)nfs3TFsInfoUnpack, (S)nfs3TFsInfoSize, (F)nfs3TFsInfoPrint, sizeof(Nfs3TFsInfo),
- (P)nfs3RFsInfoPack, (P)nfs3RFsInfoUnpack, (S)nfs3RFsInfoSize, (F)nfs3RFsInfoPrint, sizeof(Nfs3RFsInfo),
- (P)nfs3TPathconfPack, (P)nfs3TPathconfUnpack, (S)nfs3TPathconfSize, (F)nfs3TPathconfPrint, sizeof(Nfs3TPathconf),
- (P)nfs3RPathconfPack, (P)nfs3RPathconfUnpack, (S)nfs3RPathconfSize, (F)nfs3RPathconfPrint, sizeof(Nfs3RPathconf),
- (P)nfs3TCommitPack, (P)nfs3TCommitUnpack, (S)nfs3TCommitSize, (F)nfs3TCommitPrint, sizeof(Nfs3TCommit),
- (P)nfs3RCommitPack, (P)nfs3RCommitUnpack, (S)nfs3RCommitSize, (F)nfs3RCommitPrint, sizeof(Nfs3RCommit)
- };
- SunProg nfs3Prog =
- {
- Nfs3Program,
- Nfs3Version,
- proc,
- nelem(proc),
- };
|