github.com/containerd/nerdctl@v1.7.7/pkg/mountutil/mountutil_freebsd.go (about) 1 /* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package mountutil 18 19 import ( 20 "fmt" 21 "strings" 22 23 "github.com/containerd/containerd/oci" 24 "github.com/containerd/errdefs" 25 "github.com/containerd/log" 26 "github.com/containerd/nerdctl/pkg/mountutil/volumestore" 27 ) 28 29 const ( 30 DefaultMountType = "nullfs" 31 32 // FreeBSD doesn't support bind mounts. 33 DefaultPropagationMode = "" 34 ) 35 36 func UnprivilegedMountFlags(path string) ([]string, error) { 37 m := []string{} 38 return m, nil 39 } 40 41 // parseVolumeOptions parses specified optsRaw with using information of 42 // the volume type and the src directory when necessary. 43 func parseVolumeOptions(vType, src, optsRaw string) ([]string, []oci.SpecOpts, error) { 44 var writeModeRawOpts []string 45 for _, opt := range strings.Split(optsRaw, ",") { 46 switch opt { 47 case "rw": 48 writeModeRawOpts = append(writeModeRawOpts, opt) 49 case "ro": 50 writeModeRawOpts = append(writeModeRawOpts, opt) 51 case "": 52 // NOP 53 default: 54 log.L.Warnf("unsupported volume option %q", opt) 55 } 56 } 57 var opts []string 58 if len(writeModeRawOpts) > 1 { 59 return nil, nil, fmt.Errorf("duplicated read/write volume option: %+v", writeModeRawOpts) 60 } else if len(writeModeRawOpts) > 0 && writeModeRawOpts[0] == "ro" { 61 opts = append(opts, "ro") 62 } // No need to return option when "rw" 63 return opts, nil, nil 64 } 65 66 func ProcessFlagTmpfs(s string) (*Processed, error) { 67 return nil, errdefs.ErrNotImplemented 68 } 69 70 func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, error) { 71 return nil, errdefs.ErrNotImplemented 72 }