Friday, October 10, 2014

Clive for users: finders, trees, and name spaces


  1. The first example shows that listing all sources files under /zx/sys/src can be done with this command 

  2.              ; lz /zx/sys/src/,
                 /zx/sys/src
                 /zx/sys/src/clive
                 /zx/sys/src/clo
    
    
    
    Here, describing a file (or a set of files) is done by using a combination of a name and a predicate. In this case, all files starting at /zx/sys/src and matching an empty predicate (the empty string) are listed. 

    Or we can list only directories using
                              ; lz /zx/sys/src/,type=d

    Or we can remove all regular files in a hierarchy by using
                 ; rm /zx/sys/src/,type=-
    
    
    
    Commands operating on files find the involved directory entries and then operate on them. A directory entry is a set of name/value pairs, and may have any number of attributes with names and values chosen at will. Of course, there are some conventions about which attributes are expected to be there (like size, mode, etc). 

    Predicates used to find files are general expressions that may use directory attributes as values, which makes it easy for a command to issue an expression to find the entries of interest in a single or a few RPCs. Directory entries are self-describing entities (eg., they report also the address of the server and the name of the resource in the server). 

    This makes it easy for a program to issue requests for a directory entry it found. In short, file trees in clive are split into two important entities: Finders used to find directory entries, and  file trees that accept operations for directory entries

  3. Each process groups one or more finders into a name space, built from a textual representation (it might inherit the name space from the parent). For example, we can use 

      • ; NS=’/ /
      • ;;  /zx tcp!zxserver!zx
      • ;;  /dump tcp!zxserver!zx!dump
        ;; ’
        ; lz /zx/usr/nemo,type=d

  4. to define a new name space and then issue commands that work in it. In this example, we defined as / the root of the host OS file tree, and then mounted at /zx our main tree and at /dump its dump file system. To say it in a different way, the name space is a finder that may groups other finders (among other things). The name space is more powerful, and can mount at a given name a set of directory entries (be they for files or not), but the example suffices for now. 


No comments:

Post a Comment