Giter Site home page Giter Site logo

9p4's Introduction

9p4

9p4 is an implementation of the 9P protocol in gforth [1]. It provides routines for encoding and decoding 9P [2] [3] messages, along with auxiliary routines for implementing 9P clients and servers.

The remainder of this document assumes familiarity with 9P and its messages.

Data structures

The fields in a 9p4 data structure are named prefix-field, where prefix is the 9P data structure/concept name.

Qid

  • qid-type ( 'qid -> 'qid-type )
  • qid-version ( 'qid -> 'qid-version )
  • qid-path ( 'qid -> 'qid-path )
  • qid% ( -> qid-alignment #qid ): for use with gforth struct allocation routines
  • /qid ( -> #qid ): size of qid structure

Stat

  • stat-size ( 'stat -> 'stat-size )
  • stat-type ( 'stat -> 'stat-type )
  • stat-dev ( 'stat -> 'stat-dev )
  • stat-qid ( 'stat -> 'stat-qid )
  • stat-mode ( 'stat -> 'stat-mode )
  • stat-atime ( 'stat -> 'stat-atime )
  • stat-mtime ( 'stat -> 'stat-mtime )
  • stat-length ( 'stat -> 'stat-length )
  • stat-name ( 'stat -> 'stat-name )
  • stat-uid ( 'stat -> 'stat-uid )
  • stat-gid ( 'stat -> 'stat-gid )
  • stat-muid ( 'stat -> 'stat-muid )
  • stat-base% ( -> stat-alignment #stat ): size of the constant-sized part of stat; for use with gforth struct allocation routines
  • /stat-base ( -> #stat ): size of the constant-sized part of stat

Encoding and decoding

Routines encoding T- messages always return a buffer and length containing the encoded message on the top of stack, i.e. their stack diagram has the form ( ... -> ... buf #buf ). On the other hand, all routines decoding R- messages expect the message length on the top of stack, i.e. ( #msg -> ... ).

A routine's name and stack diagram reflect its name and parameters as described in [2]. Whenever there are less items in the stack diagram than in the protocol documentation, 9p4 chooses sensible values for the missing parameters.

  • Tversion ( -> buf #buf )
  • Rversion ( #msg -> version #version msize )
  • Tattach ( uname #uname aname #aname -> rootfid buf #buf )
  • Rattach ( #msg -> 'qid )
  • Twalk ( name #name ... #names fid -> newfid buf #buf )
  • clonefid ( fid -> newfid buf #buf ): same as 0 fid Twalk
  • Rwalk ( #msg -> 'qids #qids )
  • Topen ( fid mode -> buf #buf )
  • Ropen ( #msg -> 'qid iounit )
  • Tcreate ( fid name #name perm mode -> buf #buf )
  • Rcreate ( #msg -> 'qid iounit )
  • Tread ( fid offset count -> buf #buf )
  • Rread ( #msg -> data count )
  • Twrite ( fid offset data count -> buf #buf )
  • Rwrite ( #msg -> count )
  • Tclunk ( fid -> buf #buf )
  • Rclunk ( #msg -> )
  • Tremove ( fid -> buf #buf )
  • Rremove ( fid -> buf #buf )
  • Tstat ( fid -> buf #buf )
  • Rstat ( #msg -> 'stat len )
  • Twstat ( 'stat fid -> len )
  • Rwstat ( #msg -> )

References

[1] gforth

[2] introduction to the Plan 9 File Protocol, 9P

[3] A sane distributed file system

9p4's People

Contributors

iru- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dfischer mmirko

9p4's Issues

c@+ undefined

c@+ is used without being defined. it's pretty obvious what it's meant to do, especially with c!+ defined, but i thought you might want to tidy it up. c@+ is not present in Forth standard document DPANS94 nor in gforth.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.