github.com/avfs/avfs@v0.33.1-0.20240303173310-c6ba67c33eb7/vfs/mountfs/mountfs_types.go (about) 1 // 2 // Copyright 2022 The AVFS 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 mountfs 18 19 import ( 20 "sync" 21 22 "github.com/avfs/avfs" 23 ) 24 25 // MountFS implements a memory file system using the avfs.VFS interface. 26 type MountFS struct { 27 rootFS avfs.VFS // 28 mounts mounts // 29 rootMnt *mount // 30 curMnt *mount // 31 name string // 32 mu sync.RWMutex // 33 avfs.CurDirFn // CurDirFn provides current directory functions to a file system. 34 avfs.CurUserFn // CurUserFn provides current user functions to a file system. 35 avfs.IdmFn // IdmFn provides identity manager functions to a file system. 36 avfs.UMaskFn // UMaskFn provides UMask functions to file systems. 37 avfs.FeaturesFn // FeaturesFn provides features functions to a file system or an identity manager. 38 avfs.OSTypeFn // OSTypeFn provides OS type functions to a file system or an identity manager. 39 } 40 41 // mounts are the mount points of the MountFS file system. 42 type mounts map[string]*mount 43 44 // mount is the mount point of a file system. 45 type mount struct { 46 vfs avfs.VFS 47 mntPath string 48 basePath string 49 } 50 51 // MountFile represents an open file descriptor. 52 type MountFile struct { 53 vfs *MountFS 54 mount *mount 55 file avfs.File 56 }