github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/fuchsia/layout/fidl_mappings.go (about) 1 // Copyright 2019 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package layout 5 6 import ( 7 "fmt" 8 "path/filepath" 9 "strings" 10 ) 11 12 // FidlLibrary is the fully-qualified name of a FIDL library. 13 type FidlLibrary []string 14 15 // AllFidlLibraries lists all FIDL libraries. 16 var AllFidlLibraries = []FidlLibrary{ 17 {"fuchsia", "cobalt"}, 18 {"fuchsia", "devicesettings"}, 19 {"fuchsia", "hardware", "ethernet"}, 20 {"fuchsia", "io"}, 21 {"fuchsia", "ldsvc"}, 22 {"fuchsia", "mem"}, 23 {"fuchsia", "net"}, 24 {"fuchsia", "process"}, 25 {"fuchsia", "scpi"}, 26 } 27 28 func (fidlLib FidlLibrary) dirName() string { 29 return strings.Join(fidlLib, ".") 30 } 31 32 // PathToJSONIr provides the path to the JSON IR, relative to the out/<arch> 33 // directory. 34 func (fidlLib FidlLibrary) PathToJSONIr() string { 35 return filepath.Join( 36 fidlLib.PathToCompiledDir(), 37 fmt.Sprintf("%s.fidl.json", fidlLib.dirName())) 38 } 39 40 // PathToCompiledDir provides the path to compiled headers, relative to the 41 // out/<arch> directory. 42 func (fidlLib FidlLibrary) PathToCompiledDir() string { 43 return filepath.Join("fidling", "gen", "sdk", "fidl", fidlLib.dirName()) 44 }