github.com/hpcng/singularity@v3.1.1+incompatible/pkg/image/sandbox.go (about) 1 // Copyright (c) 2018-2019, Sylabs Inc. All rights reserved. 2 // This software is licensed under a 3-clause BSD license. Please consult the 3 // LICENSE.md file distributed with the sources of this project regarding your 4 // rights to use or distribute this software. 5 6 package image 7 8 import ( 9 "fmt" 10 "os" 11 ) 12 13 type sandboxFormat struct{} 14 15 func (f *sandboxFormat) initializer(img *Image, fileinfo os.FileInfo) error { 16 if fileinfo.IsDir() { 17 img.Type = SANDBOX 18 } else { 19 return fmt.Errorf("not a directory image") 20 } 21 img.Partitions[0].Type = SANDBOX 22 img.Partitions[0].Name = RootFs 23 return nil 24 } 25 26 func (f *sandboxFormat) openMode(writable bool) int { 27 return os.O_RDONLY 28 }