github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/namespace/namespace_unix.go (about) 1 // Copyright 2020 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build !plan9 6 7 // This file is inserted here so the lack of these variables/implmenetations doesn't break 8 // IDEs and tooling on other platforms. 9 10 package namespace 11 12 // DefaultNamespace is the default namespace 13 var DefaultNamespace = &unixnamespace{} 14 15 const ( 16 // REPL Replace the old file by the new one. 17 // Henceforth, an evaluation of old will be translated to the new file. 18 // If they are directories (for mount, this condition is true by definition), 19 // old becomes a union directory consisting of one directory (the new file). 20 REPL mountflag = 0x0000 21 // BEFORE Both the old and new files must be directories. 22 // Add the constituent files of the new directory to the 23 // union directory at old so its contents appear first in the union. 24 // After an BEFORE bind or mount, the new directory will be 25 // searched first when evaluating file names in the union directory. 26 BEFORE mountflag = 0x0001 27 // AFTER Like MBEFORE but the new directory goes at the end of the union. 28 AFTER mountflag = 0x0002 29 // CREATE flag that can be OR'd with any of the above. 30 // When a create system call (see open(2)) attempts to create in a union directory, 31 // and the file does not exist, the elements of the union are searched in order until 32 // one is found with CREATE set. The file is created in that directory; 33 // if that attempt fails, the create fails. 34 CREATE mountflag = 0x0004 35 // CACHE flag, valid for mount only, turns on caching for files made available by the mount. 36 // By default, file contents are always retrieved from the server. 37 // With caching enabled, the kernel may instead use a local cache 38 // to satisfy read(5) requests for files accessible through this mount point. 39 CACHE mountflag = 0x0010 40 ) 41 42 const ( 43 // These are copied over from the syscall pkg for plan9 https://golang.org/pkg/syscall/?GOOS=plan9 44 45 // BIND is the plan9 bind syscall. https://9p.io/magic/man2html/2/bind 46 BIND syzcall = 2 47 // CHDIR is the plan9 bind syscall. https://9p.io/magic/man2html/2/chdir 48 CHDIR syzcall = 3 49 // UNMOUNT is the plan9 unmount syscall. https://9p.io/magic/man2html/2/bind 50 UNMOUNT syzcall = 35 51 // MOUNT is the plan9 MOUNT syscall. https://9p.io/magic/man2html/2/bind 52 MOUNT syzcall = 46 53 // RFORK is the plan9 rfork() syscall. https://9p.io/magic/man2html/2/fork 54 // used to perform clear 55 RFORK syzcall = 19 56 // IMPORT is not a syscall. https://9p.io/magic/man2html/4/import 57 IMPORT syzcall = 7 58 // INCLUDE is not a syscall 59 INCLUDE syzcall = 14 60 ) 61 62 type unixnamespace struct{} 63 64 // Bind binds new on old. 65 func (ns *unixnamespace) Bind(new string, old string, flag mountflag) error { 66 panic("not implemented") // TODO: Implement 67 } 68 69 // Mount mounts servename on old. 70 func (ns *unixnamespace) Mount(servername string, old string, spec string, flag mountflag) error { 71 panic("not implemented") // TODO: Implement 72 } 73 74 // Unmount unmounts new from old, or everything mounted on old if new is missing. 75 func (ns *unixnamespace) Unmount(new string, old string) error { 76 panic("not implemented") // TODO: Implement 77 } 78 79 // Clear clears the name space with rfork(RFCNAMEG). 80 func (ns *unixnamespace) Clear() error { 81 panic("not implemented") // TODO: Implement 82 } 83 84 // Chdir changes the working directory to dir. 85 func (ns *unixnamespace) Chdir(dir string) error { 86 panic("not implemented") // TODO: Implement 87 } 88 89 // Import imports a name space from a remote system 90 func (ns *unixnamespace) Import(host string, remotepath string, mountpoint string, flag mountflag) error { 91 panic("not implemented") // TODO: Implement 92 }