id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
150,700
Microsoft/go-winio
wim/wim.go
Readdir
func (f *File) Readdir() ([]*File, error) { if !f.IsDir() { return nil, errors.New("not a directory") } return f.img.readdir(f.subdirOffset) }
go
func (f *File) Readdir() ([]*File, error) { if !f.IsDir() { return nil, errors.New("not a directory") } return f.img.readdir(f.subdirOffset) }
[ "func", "(", "f", "*", "File", ")", "Readdir", "(", ")", "(", "[", "]", "*", "File", ",", "error", ")", "{", "if", "!", "f", ".", "IsDir", "(", ")", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "...
// Readdir reads the directory entries.
[ "Readdir", "reads", "the", "directory", "entries", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/wim.go#L855-L860
150,701
Microsoft/go-winio
wim/lzx/lzx.go
feed
func (f *decompressor) feed() bool { err := f.ensureAtLeast(2) if err != nil { if err == io.ErrUnexpectedEOF { return false } } f.c |= (uint32(f.b[f.bo+1])<<8 | uint32(f.b[f.bo])) << (16 - f.nbits) f.nbits += 16 f.bo += 2 return true }
go
func (f *decompressor) feed() bool { err := f.ensureAtLeast(2) if err != nil { if err == io.ErrUnexpectedEOF { return false } } f.c |= (uint32(f.b[f.bo+1])<<8 | uint32(f.b[f.bo])) << (16 - f.nbits) f.nbits += 16 f.bo += 2 return true }
[ "func", "(", "f", "*", "decompressor", ")", "feed", "(", ")", "bool", "{", "err", ":=", "f", ".", "ensureAtLeast", "(", "2", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "ErrUnexpectedEOF", "{", "return", "false", "\n", ...
// feed retrieves another 16-bit word from the stream and consumes // it into f.c. It returns false if there are no more bytes available. // Otherwise, on error, it sets f.err.
[ "feed", "retrieves", "another", "16", "-", "bit", "word", "from", "the", "stream", "and", "consumes", "it", "into", "f", ".", "c", ".", "It", "returns", "false", "if", "there", "are", "no", "more", "bytes", "available", ".", "Otherwise", "on", "error", ...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L118-L129
150,702
Microsoft/go-winio
wim/lzx/lzx.go
getBits
func (f *decompressor) getBits(n byte) uint16 { if f.nbits < n { if !f.feed() { f.fail(io.ErrUnexpectedEOF) } } c := uint16(f.c >> (32 - n)) f.c <<= n f.nbits -= n return c }
go
func (f *decompressor) getBits(n byte) uint16 { if f.nbits < n { if !f.feed() { f.fail(io.ErrUnexpectedEOF) } } c := uint16(f.c >> (32 - n)) f.c <<= n f.nbits -= n return c }
[ "func", "(", "f", "*", "decompressor", ")", "getBits", "(", "n", "byte", ")", "uint16", "{", "if", "f", ".", "nbits", "<", "n", "{", "if", "!", "f", ".", "feed", "(", ")", "{", "f", ".", "fail", "(", "io", ".", "ErrUnexpectedEOF", ")", "\n", ...
// getBits retrieves the next n bits from the byte stream. n // must be <= 16. It sets f.err on error.
[ "getBits", "retrieves", "the", "next", "n", "bits", "from", "the", "byte", "stream", ".", "n", "must", "be", "<", "=", "16", ".", "It", "sets", "f", ".", "err", "on", "error", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L133-L143
150,703
Microsoft/go-winio
wim/lzx/lzx.go
getCode
func (f *decompressor) getCode(h *huffman) uint16 { if h.maxbits > 0 { if f.nbits < maxTreePathLen { f.feed() } // For codes with length < tablebits, it doesn't matter // what the remainder of the bits used for table lookup // are, since entries with all possible suffixes were // added to the table. ...
go
func (f *decompressor) getCode(h *huffman) uint16 { if h.maxbits > 0 { if f.nbits < maxTreePathLen { f.feed() } // For codes with length < tablebits, it doesn't matter // what the remainder of the bits used for table lookup // are, since entries with all possible suffixes were // added to the table. ...
[ "func", "(", "f", "*", "decompressor", ")", "getCode", "(", "h", "*", "huffman", ")", "uint16", "{", "if", "h", ".", "maxbits", ">", "0", "{", "if", "f", ".", "nbits", "<", "maxTreePathLen", "{", "f", ".", "feed", "(", ")", "\n", "}", "\n\n", "...
// getCode retrieves the next code using the provided // huffman tree. It sets f.err on error.
[ "getCode", "retrieves", "the", "next", "code", "using", "the", "provided", "huffman", "tree", ".", "It", "sets", "f", ".", "err", "on", "error", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L224-L257
150,704
Microsoft/go-winio
wim/lzx/lzx.go
readTree
func (f *decompressor) readTree(lens []byte) error { // Get the pre-tree for the main tree. var pretreeLen [20]byte for i := range pretreeLen { pretreeLen[i] = byte(f.getBits(4)) } if f.err != nil { return f.err } h := buildTable(pretreeLen[:]) // The lengths are encoded as a series of huffman codes // en...
go
func (f *decompressor) readTree(lens []byte) error { // Get the pre-tree for the main tree. var pretreeLen [20]byte for i := range pretreeLen { pretreeLen[i] = byte(f.getBits(4)) } if f.err != nil { return f.err } h := buildTable(pretreeLen[:]) // The lengths are encoded as a series of huffman codes // en...
[ "func", "(", "f", "*", "decompressor", ")", "readTree", "(", "lens", "[", "]", "byte", ")", "error", "{", "// Get the pre-tree for the main tree.", "var", "pretreeLen", "[", "20", "]", "byte", "\n", "for", "i", ":=", "range", "pretreeLen", "{", "pretreeLen",...
// readTree updates the huffman tree path lengths in lens by // reading and decoding lengths from the byte stream. lens // should be prepopulated with the previous block's tree's path // lengths. For the first block, lens should be zero.
[ "readTree", "updates", "the", "huffman", "tree", "path", "lengths", "in", "lens", "by", "reading", "and", "decoding", "lengths", "from", "the", "byte", "stream", ".", "lens", "should", "be", "prepopulated", "with", "the", "previous", "block", "s", "tree", "s...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L263-L326
150,705
Microsoft/go-winio
wim/lzx/lzx.go
readTrees
func (f *decompressor) readTrees(readAligned bool) (main *huffman, length *huffman, aligned *huffman, err error) { // Aligned offset blocks start with a small aligned offset tree. if readAligned { var alignedLen [8]byte for i := range alignedLen { alignedLen[i] = byte(f.getBits(3)) } aligned = buildTable(a...
go
func (f *decompressor) readTrees(readAligned bool) (main *huffman, length *huffman, aligned *huffman, err error) { // Aligned offset blocks start with a small aligned offset tree. if readAligned { var alignedLen [8]byte for i := range alignedLen { alignedLen[i] = byte(f.getBits(3)) } aligned = buildTable(a...
[ "func", "(", "f", "*", "decompressor", ")", "readTrees", "(", "readAligned", "bool", ")", "(", "main", "*", "huffman", ",", "length", "*", "huffman", ",", "aligned", "*", "huffman", ",", "err", "error", ")", "{", "// Aligned offset blocks start with a small al...
// readTrees reads the two or three huffman trees for the current block. // readAligned specifies whether to read the aligned offset tree.
[ "readTrees", "reads", "the", "two", "or", "three", "huffman", "trees", "for", "the", "current", "block", ".", "readAligned", "specifies", "whether", "to", "read", "the", "aligned", "offset", "tree", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L393-L437
150,706
Microsoft/go-winio
wim/lzx/lzx.go
readCompressedBlock
func (f *decompressor) readCompressedBlock(start, end uint16, hmain, hlength, haligned *huffman) (int, error) { i := start for i < end { main := f.getCode(hmain) if f.err != nil { break } if main < 256 { // Literal byte. f.window[i] = byte(main) i++ continue } // This is a match backward i...
go
func (f *decompressor) readCompressedBlock(start, end uint16, hmain, hlength, haligned *huffman) (int, error) { i := start for i < end { main := f.getCode(hmain) if f.err != nil { break } if main < 256 { // Literal byte. f.window[i] = byte(main) i++ continue } // This is a match backward i...
[ "func", "(", "f", "*", "decompressor", ")", "readCompressedBlock", "(", "start", ",", "end", "uint16", ",", "hmain", ",", "hlength", ",", "haligned", "*", "huffman", ")", "(", "int", ",", "error", ")", "{", "i", ":=", "start", "\n", "for", "i", "<", ...
// readCompressedBlock decodes a compressed block, writing into the window // starting at start and ending at end, and using the provided huffman trees.
[ "readCompressedBlock", "decodes", "a", "compressed", "block", "writing", "into", "the", "window", "starting", "at", "start", "and", "ending", "at", "end", "and", "using", "the", "provided", "huffman", "trees", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L441-L510
150,707
Microsoft/go-winio
wim/lzx/lzx.go
readBlock
func (f *decompressor) readBlock(start uint16) (int, error) { blockType, size, err := f.readBlockHeader() if err != nil { return 0, err } if blockType == uncompressedBlock { if size%2 == 1 { // Remember to realign the byte stream at the next block. f.unaligned = true } copied := 0 if f.bo < f.bv { ...
go
func (f *decompressor) readBlock(start uint16) (int, error) { blockType, size, err := f.readBlockHeader() if err != nil { return 0, err } if blockType == uncompressedBlock { if size%2 == 1 { // Remember to realign the byte stream at the next block. f.unaligned = true } copied := 0 if f.bo < f.bv { ...
[ "func", "(", "f", "*", "decompressor", ")", "readBlock", "(", "start", "uint16", ")", "(", "int", ",", "error", ")", "{", "blockType", ",", "size", ",", "err", ":=", "f", ".", "readBlockHeader", "(", ")", "\n", "if", "err", "!=", "nil", "{", "retur...
// readBlock decodes the current block and returns the number of uncompressed bytes.
[ "readBlock", "decodes", "the", "current", "block", "and", "returns", "the", "number", "of", "uncompressed", "bytes", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L513-L544
150,708
Microsoft/go-winio
wim/lzx/lzx.go
decodeE8
func decodeE8(b []byte, off int64) { if off > maxe8offset || len(b) < 10 { return } for i := 0; i < len(b)-10; i++ { if b[i] == 0xe8 { currentPtr := int32(off) + int32(i) abs := int32(binary.LittleEndian.Uint32(b[i+1 : i+5])) if abs >= -currentPtr && abs < e8filesize { var rel int32 if abs >= 0 ...
go
func decodeE8(b []byte, off int64) { if off > maxe8offset || len(b) < 10 { return } for i := 0; i < len(b)-10; i++ { if b[i] == 0xe8 { currentPtr := int32(off) + int32(i) abs := int32(binary.LittleEndian.Uint32(b[i+1 : i+5])) if abs >= -currentPtr && abs < e8filesize { var rel int32 if abs >= 0 ...
[ "func", "decodeE8", "(", "b", "[", "]", "byte", ",", "off", "int64", ")", "{", "if", "off", ">", "maxe8offset", "||", "len", "(", "b", ")", "<", "10", "{", "return", "\n", "}", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "b", ")...
// decodeE8 reverses the 0xe8 x86 instruction encoding that was performed // to the uncompressed data before it was compressed.
[ "decodeE8", "reverses", "the", "0xe8", "x86", "instruction", "encoding", "that", "was", "performed", "to", "the", "uncompressed", "data", "before", "it", "was", "compressed", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L548-L568
150,709
Microsoft/go-winio
wim/lzx/lzx.go
NewReader
func NewReader(r io.Reader, uncompressedSize int) (io.ReadCloser, error) { if uncompressedSize > windowSize { return nil, errors.New("uncompressed size is limited to 32KB") } f := &decompressor{ lru: [3]uint16{1, 1, 1}, uncompressed: uncompressedSize, b: make([]byte, 4096), r: ...
go
func NewReader(r io.Reader, uncompressedSize int) (io.ReadCloser, error) { if uncompressedSize > windowSize { return nil, errors.New("uncompressed size is limited to 32KB") } f := &decompressor{ lru: [3]uint16{1, 1, 1}, uncompressed: uncompressedSize, b: make([]byte, 4096), r: ...
[ "func", "NewReader", "(", "r", "io", ".", "Reader", ",", "uncompressedSize", "int", ")", "(", "io", ".", "ReadCloser", ",", "error", ")", "{", "if", "uncompressedSize", ">", "windowSize", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\""...
// NewReader returns a new io.ReadCloser that decompresses a // WIM LZX stream until uncompressedSize bytes have been returned.
[ "NewReader", "returns", "a", "new", "io", ".", "ReadCloser", "that", "decompresses", "a", "WIM", "LZX", "stream", "until", "uncompressedSize", "bytes", "have", "been", "returned", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/wim/lzx/lzx.go#L595-L606
150,710
Microsoft/go-winio
pkg/guid/guid.go
FromString
func FromString(s string) (*GUID, error) { if len(s) != 36 { return nil, errors.New("invalid GUID format (length)") } if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return nil, errors.New("invalid GUID format (dashes)") } var g GUID data1, err := strconv.ParseUint(s[0:8], 16, 32) if err !...
go
func FromString(s string) (*GUID, error) { if len(s) != 36 { return nil, errors.New("invalid GUID format (length)") } if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { return nil, errors.New("invalid GUID format (dashes)") } var g GUID data1, err := strconv.ParseUint(s[0:8], 16, 32) if err !...
[ "func", "FromString", "(", "s", "string", ")", "(", "*", "GUID", ",", "error", ")", "{", "if", "len", "(", "s", ")", "!=", "36", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "s", "[", "8", "]...
// FromString parses a string containing a GUID and returns the GUID. The only // format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` // format.
[ "FromString", "parses", "a", "string", "containing", "a", "GUID", "and", "returns", "the", "GUID", ".", "The", "only", "format", "currently", "supported", "is", "the", "xxxxxxxx", "-", "xxxx", "-", "xxxx", "-", "xxxx", "-", "xxxxxxxxxxxx", "format", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/guid/guid.go#L56-L93
150,711
Microsoft/go-winio
pkg/guid/guid.go
UnmarshalJSON
func (g *GUID) UnmarshalJSON(data []byte) error { g2, err := FromString(strings.Trim(string(data), "\"")) if err != nil { return err } *g = *g2 return nil }
go
func (g *GUID) UnmarshalJSON(data []byte) error { g2, err := FromString(strings.Trim(string(data), "\"")) if err != nil { return err } *g = *g2 return nil }
[ "func", "(", "g", "*", "GUID", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "g2", ",", "err", ":=", "FromString", "(", "strings", ".", "Trim", "(", "string", "(", "data", ")", ",", "\"", "\\\"", "\"", ")", ")", "\n", ...
// UnmarshalJSON unmarshals a GUID from JSON representation and sets itself to // the unmarshaled GUID.
[ "UnmarshalJSON", "unmarshals", "a", "GUID", "from", "JSON", "representation", "and", "sets", "itself", "to", "the", "unmarshaled", "GUID", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/guid/guid.go#L103-L110
150,712
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
tmpVar
func (p *Param) tmpVar() string { if p.tmpVarIdx < 0 { p.tmpVarIdx = p.fn.curTmpVarIdx p.fn.curTmpVarIdx++ } return fmt.Sprintf("_p%d", p.tmpVarIdx) }
go
func (p *Param) tmpVar() string { if p.tmpVarIdx < 0 { p.tmpVarIdx = p.fn.curTmpVarIdx p.fn.curTmpVarIdx++ } return fmt.Sprintf("_p%d", p.tmpVarIdx) }
[ "func", "(", "p", "*", "Param", ")", "tmpVar", "(", ")", "string", "{", "if", "p", ".", "tmpVarIdx", "<", "0", "{", "p", ".", "tmpVarIdx", "=", "p", ".", "fn", ".", "curTmpVarIdx", "\n", "p", ".", "fn", ".", "curTmpVarIdx", "++", "\n", "}", "\n...
// tmpVar returns temp variable name that will be used to represent p during syscall.
[ "tmpVar", "returns", "temp", "variable", "name", "that", "will", "be", "used", "to", "represent", "p", "during", "syscall", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L100-L106
150,713
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
BoolTmpVarCode
func (p *Param) BoolTmpVarCode() string { const code = `var %s uint32 if %s { %s = 1 } else { %s = 0 }` tmp := p.tmpVar() return fmt.Sprintf(code, tmp, p.Name, tmp, tmp) }
go
func (p *Param) BoolTmpVarCode() string { const code = `var %s uint32 if %s { %s = 1 } else { %s = 0 }` tmp := p.tmpVar() return fmt.Sprintf(code, tmp, p.Name, tmp, tmp) }
[ "func", "(", "p", "*", "Param", ")", "BoolTmpVarCode", "(", ")", "string", "{", "const", "code", "=", "`var %s uint32\n\tif %s {\n\t\t%s = 1\n\t} else {\n\t\t%s = 0\n\t}`", "\n", "tmp", ":=", "p", ".", "tmpVar", "(", ")", "\n", "return", "fmt", ".", "Sprintf", ...
// BoolTmpVarCode returns source code for bool temp variable.
[ "BoolTmpVarCode", "returns", "source", "code", "for", "bool", "temp", "variable", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L109-L118
150,714
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SliceTmpVarCode
func (p *Param) SliceTmpVarCode() string { const code = `var %s *%s if len(%s) > 0 { %s = &%s[0] }` tmp := p.tmpVar() return fmt.Sprintf(code, tmp, p.Type[2:], p.Name, tmp, p.Name) }
go
func (p *Param) SliceTmpVarCode() string { const code = `var %s *%s if len(%s) > 0 { %s = &%s[0] }` tmp := p.tmpVar() return fmt.Sprintf(code, tmp, p.Type[2:], p.Name, tmp, p.Name) }
[ "func", "(", "p", "*", "Param", ")", "SliceTmpVarCode", "(", ")", "string", "{", "const", "code", "=", "`var %s *%s\n\tif len(%s) > 0 {\n\t\t%s = &%s[0]\n\t}`", "\n", "tmp", ":=", "p", ".", "tmpVar", "(", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "cod...
// SliceTmpVarCode returns source code for slice temp variable.
[ "SliceTmpVarCode", "returns", "source", "code", "for", "slice", "temp", "variable", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L121-L128
150,715
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
StringTmpVarCode
func (p *Param) StringTmpVarCode() string { errvar := p.fn.Rets.ErrorVarName() if errvar == "" { errvar = "_" } tmp := p.tmpVar() const code = `var %s %s %s, %s = %s(%s)` s := fmt.Sprintf(code, tmp, p.fn.StrconvType(), tmp, errvar, p.fn.StrconvFunc(), p.Name) if errvar == "-" { return s } const morecode =...
go
func (p *Param) StringTmpVarCode() string { errvar := p.fn.Rets.ErrorVarName() if errvar == "" { errvar = "_" } tmp := p.tmpVar() const code = `var %s %s %s, %s = %s(%s)` s := fmt.Sprintf(code, tmp, p.fn.StrconvType(), tmp, errvar, p.fn.StrconvFunc(), p.Name) if errvar == "-" { return s } const morecode =...
[ "func", "(", "p", "*", "Param", ")", "StringTmpVarCode", "(", ")", "string", "{", "errvar", ":=", "p", ".", "fn", ".", "Rets", ".", "ErrorVarName", "(", ")", "\n", "if", "errvar", "==", "\"", "\"", "{", "errvar", "=", "\"", "\"", "\n", "}", "\n",...
// StringTmpVarCode returns source code for string temp variable.
[ "StringTmpVarCode", "returns", "source", "code", "for", "string", "temp", "variable", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L131-L148
150,716
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
TmpVarCode
func (p *Param) TmpVarCode() string { switch { case p.Type == "bool": return p.BoolTmpVarCode() case strings.HasPrefix(p.Type, "[]"): return p.SliceTmpVarCode() default: return "" } }
go
func (p *Param) TmpVarCode() string { switch { case p.Type == "bool": return p.BoolTmpVarCode() case strings.HasPrefix(p.Type, "[]"): return p.SliceTmpVarCode() default: return "" } }
[ "func", "(", "p", "*", "Param", ")", "TmpVarCode", "(", ")", "string", "{", "switch", "{", "case", "p", ".", "Type", "==", "\"", "\"", ":", "return", "p", ".", "BoolTmpVarCode", "(", ")", "\n", "case", "strings", ".", "HasPrefix", "(", "p", ".", ...
// TmpVarCode returns source code for temp variable.
[ "TmpVarCode", "returns", "source", "code", "for", "temp", "variable", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L151-L160
150,717
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperType
func (p *Param) HelperType() string { if p.Type == "string" { return p.fn.StrconvType() } return p.Type }
go
func (p *Param) HelperType() string { if p.Type == "string" { return p.fn.StrconvType() } return p.Type }
[ "func", "(", "p", "*", "Param", ")", "HelperType", "(", ")", "string", "{", "if", "p", ".", "Type", "==", "\"", "\"", "{", "return", "p", ".", "fn", ".", "StrconvType", "(", ")", "\n", "}", "\n", "return", "p", ".", "Type", "\n", "}" ]
// HelperType returns type of parameter p used in helper function.
[ "HelperType", "returns", "type", "of", "parameter", "p", "used", "in", "helper", "function", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L198-L203
150,718
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
join
func join(ps []*Param, fn func(*Param) string, sep string) string { if len(ps) == 0 { return "" } a := make([]string, 0) for _, p := range ps { a = append(a, fn(p)) } return strings.Join(a, sep) }
go
func join(ps []*Param, fn func(*Param) string, sep string) string { if len(ps) == 0 { return "" } a := make([]string, 0) for _, p := range ps { a = append(a, fn(p)) } return strings.Join(a, sep) }
[ "func", "join", "(", "ps", "[", "]", "*", "Param", ",", "fn", "func", "(", "*", "Param", ")", "string", ",", "sep", "string", ")", "string", "{", "if", "len", "(", "ps", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "a", ":=", ...
// join concatenates parameters ps into a string with sep separator. // Each parameter is converted into string by applying fn to it // before conversion.
[ "join", "concatenates", "parameters", "ps", "into", "a", "string", "with", "sep", "separator", ".", "Each", "parameter", "is", "converted", "into", "string", "by", "applying", "fn", "to", "it", "before", "conversion", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L208-L217
150,719
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ErrorVarName
func (r *Rets) ErrorVarName() string { if r.ReturnsError { return "err" } if r.Type == "error" { return r.Name } return "" }
go
func (r *Rets) ErrorVarName() string { if r.ReturnsError { return "err" } if r.Type == "error" { return r.Name } return "" }
[ "func", "(", "r", "*", "Rets", ")", "ErrorVarName", "(", ")", "string", "{", "if", "r", ".", "ReturnsError", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "r", ".", "Type", "==", "\"", "\"", "{", "return", "r", ".", "Name", "\n", "}", "\n",...
// ErrorVarName returns error variable name for r.
[ "ErrorVarName", "returns", "error", "variable", "name", "for", "r", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L228-L236
150,720
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
List
func (r *Rets) List() string { s := join(r.ToParams(), func(p *Param) string { return p.Name + " " + p.Type }, ", ") if len(s) > 0 { s = "(" + s + ")" } return s }
go
func (r *Rets) List() string { s := join(r.ToParams(), func(p *Param) string { return p.Name + " " + p.Type }, ", ") if len(s) > 0 { s = "(" + s + ")" } return s }
[ "func", "(", "r", "*", "Rets", ")", "List", "(", ")", "string", "{", "s", ":=", "join", "(", "r", ".", "ToParams", "(", ")", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", "."...
// List returns source code of syscall return parameters.
[ "List", "returns", "source", "code", "of", "syscall", "return", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L251-L257
150,721
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
PrintList
func (r *Rets) PrintList() string { return join(r.ToParams(), func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
go
func (r *Rets) PrintList() string { return join(r.ToParams(), func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
[ "func", "(", "r", "*", "Rets", ")", "PrintList", "(", ")", "string", "{", "return", "join", "(", "r", ".", "ToParams", "(", ")", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`\"%s=\", %s, `", ",", ...
// PrintList returns source code of trace printing part correspondent // to syscall return values.
[ "PrintList", "returns", "source", "code", "of", "trace", "printing", "part", "correspondent", "to", "syscall", "return", "values", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L261-L263
150,722
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SetReturnValuesCode
func (r *Rets) SetReturnValuesCode() string { if r.Name == "" && !r.ReturnsError { return "" } retvar := "r0" if r.Name == "" { retvar = "r1" } errvar := "_" if r.ReturnsError { errvar = "e1" } return fmt.Sprintf("%s, _, %s := ", retvar, errvar) }
go
func (r *Rets) SetReturnValuesCode() string { if r.Name == "" && !r.ReturnsError { return "" } retvar := "r0" if r.Name == "" { retvar = "r1" } errvar := "_" if r.ReturnsError { errvar = "e1" } return fmt.Sprintf("%s, _, %s := ", retvar, errvar) }
[ "func", "(", "r", "*", "Rets", ")", "SetReturnValuesCode", "(", ")", "string", "{", "if", "r", ".", "Name", "==", "\"", "\"", "&&", "!", "r", ".", "ReturnsError", "{", "return", "\"", "\"", "\n", "}", "\n", "retvar", ":=", "\"", "\"", "\n", "if",...
// SetReturnValuesCode returns source code that accepts syscall return values.
[ "SetReturnValuesCode", "returns", "source", "code", "that", "accepts", "syscall", "return", "values", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L266-L279
150,723
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SetErrorCode
func (r *Rets) SetErrorCode() string { const code = `if r0 != 0 { %s = %sErrno(r0) }` if r.Name == "" && !r.ReturnsError { return "" } if r.Name == "" { return r.useLongHandleErrorCode("r1") } if r.Type == "error" { return fmt.Sprintf(code, r.Name, syscalldot()) } s := "" switch { case r.Type[0] == '...
go
func (r *Rets) SetErrorCode() string { const code = `if r0 != 0 { %s = %sErrno(r0) }` if r.Name == "" && !r.ReturnsError { return "" } if r.Name == "" { return r.useLongHandleErrorCode("r1") } if r.Type == "error" { return fmt.Sprintf(code, r.Name, syscalldot()) } s := "" switch { case r.Type[0] == '...
[ "func", "(", "r", "*", "Rets", ")", "SetErrorCode", "(", ")", "string", "{", "const", "code", "=", "`if r0 != 0 {\n\t\t%s = %sErrno(r0)\n\t}`", "\n", "if", "r", ".", "Name", "==", "\"", "\"", "&&", "!", "r", ".", "ReturnsError", "{", "return", "\"", "\""...
// SetErrorCode returns source code that sets return parameters.
[ "SetErrorCode", "returns", "source", "code", "that", "sets", "return", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L297-L323
150,724
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
extractParams
func extractParams(s string, f *Fn) ([]*Param, error) { s = trim(s) if s == "" { return nil, nil } a := strings.Split(s, ",") ps := make([]*Param, len(a)) for i := range ps { s2 := trim(a[i]) b := strings.Split(s2, " ") if len(b) != 2 { b = strings.Split(s2, "\t") if len(b) != 2 { return nil, er...
go
func extractParams(s string, f *Fn) ([]*Param, error) { s = trim(s) if s == "" { return nil, nil } a := strings.Split(s, ",") ps := make([]*Param, len(a)) for i := range ps { s2 := trim(a[i]) b := strings.Split(s2, " ") if len(b) != 2 { b = strings.Split(s2, "\t") if len(b) != 2 { return nil, er...
[ "func", "extractParams", "(", "s", "string", ",", "f", "*", "Fn", ")", "(", "[", "]", "*", "Param", ",", "error", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "if", "s", "==", "\"", "\"", "{", "return", "nil", ",", "nil", "\n", "}", "\n...
// extractParams parses s to extract function parameters.
[ "extractParams", "parses", "s", "to", "extract", "function", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L339-L363
150,725
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
extractSection
func extractSection(s string, start, end rune) (prefix, body, suffix string, found bool) { s = trim(s) if strings.HasPrefix(s, string(start)) { // no prefix body = s[1:] } else { a := strings.SplitN(s, string(start), 2) if len(a) != 2 { return "", "", s, false } prefix = a[0] body = a[1] } a := st...
go
func extractSection(s string, start, end rune) (prefix, body, suffix string, found bool) { s = trim(s) if strings.HasPrefix(s, string(start)) { // no prefix body = s[1:] } else { a := strings.SplitN(s, string(start), 2) if len(a) != 2 { return "", "", s, false } prefix = a[0] body = a[1] } a := st...
[ "func", "extractSection", "(", "s", "string", ",", "start", ",", "end", "rune", ")", "(", "prefix", ",", "body", ",", "suffix", "string", ",", "found", "bool", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "if", "strings", ".", "HasPrefix", "(",...
// extractSection extracts text out of string s starting after start // and ending just before end. found return value will indicate success, // and prefix, body and suffix will contain correspondent parts of string s.
[ "extractSection", "extracts", "text", "out", "of", "string", "s", "starting", "after", "start", "and", "ending", "just", "before", "end", ".", "found", "return", "value", "will", "indicate", "success", "and", "prefix", "body", "and", "suffix", "will", "contain...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L368-L386
150,726
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
newFn
func newFn(s string) (*Fn, error) { s = trim(s) f := &Fn{ Rets: &Rets{}, src: s, PrintTrace: *printTraceFlag, } // function name and args prefix, body, s, found := extractSection(s, '(', ')') if !found || prefix == "" { return nil, errors.New("Could not extract function name and parameters fr...
go
func newFn(s string) (*Fn, error) { s = trim(s) f := &Fn{ Rets: &Rets{}, src: s, PrintTrace: *printTraceFlag, } // function name and args prefix, body, s, found := extractSection(s, '(', ')') if !found || prefix == "" { return nil, errors.New("Could not extract function name and parameters fr...
[ "func", "newFn", "(", "s", "string", ")", "(", "*", "Fn", ",", "error", ")", "{", "s", "=", "trim", "(", "s", ")", "\n", "f", ":=", "&", "Fn", "{", "Rets", ":", "&", "Rets", "{", "}", ",", "src", ":", "s", ",", "PrintTrace", ":", "*", "pr...
// newFn parses string s and return created function Fn.
[ "newFn", "parses", "string", "s", "and", "return", "created", "function", "Fn", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L389-L459
150,727
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
DLLFuncName
func (f *Fn) DLLFuncName() string { if f.dllfuncname == "" { return f.Name } return f.dllfuncname }
go
func (f *Fn) DLLFuncName() string { if f.dllfuncname == "" { return f.Name } return f.dllfuncname }
[ "func", "(", "f", "*", "Fn", ")", "DLLFuncName", "(", ")", "string", "{", "if", "f", ".", "dllfuncname", "==", "\"", "\"", "{", "return", "f", ".", "Name", "\n", "}", "\n", "return", "f", ".", "dllfuncname", "\n", "}" ]
// DLLName returns DLL function name for function f.
[ "DLLName", "returns", "DLL", "function", "name", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L470-L475
150,728
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamList
func (f *Fn) ParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.Type }, ", ") }
go
func (f *Fn) ParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.Type }, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "ParamList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", ".", "Type", "}...
// ParamList returns source code for function f parameters.
[ "ParamList", "returns", "source", "code", "for", "function", "f", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L478-L480
150,729
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperParamList
func (f *Fn) HelperParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.HelperType() }, ", ") }
go
func (f *Fn) HelperParamList() string { return join(f.Params, func(p *Param) string { return p.Name + " " + p.HelperType() }, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "HelperParamList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "p", ".", "Name", "+", "\"", "\"", "+", "p", ".", "Helpe...
// HelperParamList returns source code for helper function f parameters.
[ "HelperParamList", "returns", "source", "code", "for", "helper", "function", "f", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L483-L485
150,730
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamPrintList
func (f *Fn) ParamPrintList() string { return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
go
func (f *Fn) ParamPrintList() string { return join(f.Params, func(p *Param) string { return fmt.Sprintf(`"%s=", %s, `, p.Name, p.Name) }, `", ", `) }
[ "func", "(", "f", "*", "Fn", ")", "ParamPrintList", "(", ")", "string", "{", "return", "join", "(", "f", ".", "Params", ",", "func", "(", "p", "*", "Param", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`\"%s=\", %s, `", ",", "p", ".",...
// ParamPrintList returns source code of trace printing part correspondent // to syscall input parameters.
[ "ParamPrintList", "returns", "source", "code", "of", "trace", "printing", "part", "correspondent", "to", "syscall", "input", "parameters", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L489-L491
150,731
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParamCount
func (f *Fn) ParamCount() int { n := 0 for _, p := range f.Params { n += len(p.SyscallArgList()) } return n }
go
func (f *Fn) ParamCount() int { n := 0 for _, p := range f.Params { n += len(p.SyscallArgList()) } return n }
[ "func", "(", "f", "*", "Fn", ")", "ParamCount", "(", ")", "int", "{", "n", ":=", "0", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "n", "+=", "len", "(", "p", ".", "SyscallArgList", "(", ")", ")", "\n", "}", "\n", "re...
// ParamCount return number of syscall parameters for function f.
[ "ParamCount", "return", "number", "of", "syscall", "parameters", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L494-L500
150,732
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
Syscall
func (f *Fn) Syscall() string { c := f.SyscallParamCount() if c == 3 { return syscalldot() + "Syscall" } return syscalldot() + "Syscall" + strconv.Itoa(c) }
go
func (f *Fn) Syscall() string { c := f.SyscallParamCount() if c == 3 { return syscalldot() + "Syscall" } return syscalldot() + "Syscall" + strconv.Itoa(c) }
[ "func", "(", "f", "*", "Fn", ")", "Syscall", "(", ")", "string", "{", "c", ":=", "f", ".", "SyscallParamCount", "(", ")", "\n", "if", "c", "==", "3", "{", "return", "syscalldot", "(", ")", "+", "\"", "\"", "\n", "}", "\n", "return", "syscalldot",...
// Syscall determines which SyscallX function to use for function f.
[ "Syscall", "determines", "which", "SyscallX", "function", "to", "use", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L523-L529
150,733
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
SyscallParamList
func (f *Fn) SyscallParamList() string { a := make([]string, 0) for _, p := range f.Params { a = append(a, p.SyscallArgList()...) } for len(a) < f.SyscallParamCount() { a = append(a, "0") } return strings.Join(a, ", ") }
go
func (f *Fn) SyscallParamList() string { a := make([]string, 0) for _, p := range f.Params { a = append(a, p.SyscallArgList()...) } for len(a) < f.SyscallParamCount() { a = append(a, "0") } return strings.Join(a, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "SyscallParamList", "(", ")", "string", "{", "a", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "a", "=", "append", "(", "a", ",", ...
// SyscallParamList returns source code for SyscallX parameters for function f.
[ "SyscallParamList", "returns", "source", "code", "for", "SyscallX", "parameters", "for", "function", "f", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L532-L541
150,734
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperCallParamList
func (f *Fn) HelperCallParamList() string { a := make([]string, 0, len(f.Params)) for _, p := range f.Params { s := p.Name if p.Type == "string" { s = p.tmpVar() } a = append(a, s) } return strings.Join(a, ", ") }
go
func (f *Fn) HelperCallParamList() string { a := make([]string, 0, len(f.Params)) for _, p := range f.Params { s := p.Name if p.Type == "string" { s = p.tmpVar() } a = append(a, s) } return strings.Join(a, ", ") }
[ "func", "(", "f", "*", "Fn", ")", "HelperCallParamList", "(", ")", "string", "{", "a", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "f", ".", "Params", ")", ")", "\n", "for", "_", ",", "p", ":=", "range", "f", ".", "Param...
// HelperCallParamList returns source code of call into function f helper.
[ "HelperCallParamList", "returns", "source", "code", "of", "call", "into", "function", "f", "helper", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L544-L554
150,735
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HasStringParam
func (f *Fn) HasStringParam() bool { for _, p := range f.Params { if p.Type == "string" { return true } } return false }
go
func (f *Fn) HasStringParam() bool { for _, p := range f.Params { if p.Type == "string" { return true } } return false }
[ "func", "(", "f", "*", "Fn", ")", "HasStringParam", "(", ")", "bool", "{", "for", "_", ",", "p", ":=", "range", "f", ".", "Params", "{", "if", "p", ".", "Type", "==", "\"", "\"", "{", "return", "true", "\n", "}", "\n", "}", "\n", "return", "f...
// HasStringParam is true, if f has at least one string parameter. // Otherwise it is false.
[ "HasStringParam", "is", "true", "if", "f", "has", "at", "least", "one", "string", "parameter", ".", "Otherwise", "it", "is", "false", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L581-L588
150,736
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
HelperName
func (f *Fn) HelperName() string { if !f.HasStringParam() { return f.Name } return "_" + f.Name }
go
func (f *Fn) HelperName() string { if !f.HasStringParam() { return f.Name } return "_" + f.Name }
[ "func", "(", "f", "*", "Fn", ")", "HelperName", "(", ")", "string", "{", "if", "!", "f", ".", "HasStringParam", "(", ")", "{", "return", "f", ".", "Name", "\n", "}", "\n", "return", "\"", "\"", "+", "f", ".", "Name", "\n", "}" ]
// HelperName returns name of function f helper.
[ "HelperName", "returns", "name", "of", "function", "f", "helper", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L591-L596
150,737
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
DLLs
func (src *Source) DLLs() []string { uniq := make(map[string]bool) r := make([]string, 0) for _, f := range src.Funcs { name := f.DLLName() if _, found := uniq[name]; !found { uniq[name] = true r = append(r, name) } } return r }
go
func (src *Source) DLLs() []string { uniq := make(map[string]bool) r := make([]string, 0) for _, f := range src.Funcs { name := f.DLLName() if _, found := uniq[name]; !found { uniq[name] = true r = append(r, name) } } return r }
[ "func", "(", "src", "*", "Source", ")", "DLLs", "(", ")", "[", "]", "string", "{", "uniq", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "r", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "f...
// DLLs return dll names for a source set src.
[ "DLLs", "return", "dll", "names", "for", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L650-L661
150,738
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
ParseFile
func (src *Source) ParseFile(path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() s := bufio.NewScanner(file) for s.Scan() { t := trim(s.Text()) if len(t) < 7 { continue } if !strings.HasPrefix(t, "//sys") { continue } t = t[5:] if !(t[0] == ' ' ||...
go
func (src *Source) ParseFile(path string) error { file, err := os.Open(path) if err != nil { return err } defer file.Close() s := bufio.NewScanner(file) for s.Scan() { t := trim(s.Text()) if len(t) < 7 { continue } if !strings.HasPrefix(t, "//sys") { continue } t = t[5:] if !(t[0] == ' ' ||...
[ "func", "(", "src", "*", "Source", ")", "ParseFile", "(", "path", "string", ")", "error", "{", "file", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ...
// ParseFile adds additional file path to a source set src.
[ "ParseFile", "adds", "additional", "file", "path", "to", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L664-L708
150,739
Microsoft/go-winio
pkg/etw/mksyscall_windows.go
IsStdRepo
func (src *Source) IsStdRepo() (bool, error) { if len(src.Files) == 0 { return false, errors.New("no input files provided") } abspath, err := filepath.Abs(src.Files[0]) if err != nil { return false, err } goroot := runtime.GOROOT() if runtime.GOOS == "windows" { abspath = strings.ToLower(abspath) goroot ...
go
func (src *Source) IsStdRepo() (bool, error) { if len(src.Files) == 0 { return false, errors.New("no input files provided") } abspath, err := filepath.Abs(src.Files[0]) if err != nil { return false, err } goroot := runtime.GOROOT() if runtime.GOOS == "windows" { abspath = strings.ToLower(abspath) goroot ...
[ "func", "(", "src", "*", "Source", ")", "IsStdRepo", "(", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "src", ".", "Files", ")", "==", "0", "{", "return", "false", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n...
// IsStdRepo reports whether src is part of standard library.
[ "IsStdRepo", "reports", "whether", "src", "is", "part", "of", "standard", "library", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/mksyscall_windows.go#L711-L729
150,740
Microsoft/go-winio
file.go
makeWin32File
func makeWin32File(h syscall.Handle) (*win32File, error) { f := &win32File{handle: h} ioInitOnce.Do(initIo) _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) if err != nil { return nil, err } err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVEN...
go
func makeWin32File(h syscall.Handle) (*win32File, error) { f := &win32File{handle: h} ioInitOnce.Do(initIo) _, err := createIoCompletionPort(h, ioCompletionPort, 0, 0xffffffff) if err != nil { return nil, err } err = setFileCompletionNotificationModes(h, cFILE_SKIP_COMPLETION_PORT_ON_SUCCESS|cFILE_SKIP_SET_EVEN...
[ "func", "makeWin32File", "(", "h", "syscall", ".", "Handle", ")", "(", "*", "win32File", ",", "error", ")", "{", "f", ":=", "&", "win32File", "{", "handle", ":", "h", "}", "\n", "ioInitOnce", ".", "Do", "(", "initIo", ")", "\n", "_", ",", "err", ...
// makeWin32File makes a new win32File from an existing file handle
[ "makeWin32File", "makes", "a", "new", "win32File", "from", "an", "existing", "file", "handle" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L97-L111
150,741
Microsoft/go-winio
file.go
closeHandle
func (f *win32File) closeHandle() { f.wgLock.Lock() // Atomically set that we are closing, releasing the resources only once. if !f.closing.swap(true) { f.wgLock.Unlock() // cancel all IO and wait for it to complete cancelIoEx(f.handle, nil) f.wg.Wait() // at this point, no new IO can start syscall.Close...
go
func (f *win32File) closeHandle() { f.wgLock.Lock() // Atomically set that we are closing, releasing the resources only once. if !f.closing.swap(true) { f.wgLock.Unlock() // cancel all IO and wait for it to complete cancelIoEx(f.handle, nil) f.wg.Wait() // at this point, no new IO can start syscall.Close...
[ "func", "(", "f", "*", "win32File", ")", "closeHandle", "(", ")", "{", "f", ".", "wgLock", ".", "Lock", "(", ")", "\n", "// Atomically set that we are closing, releasing the resources only once.", "if", "!", "f", ".", "closing", ".", "swap", "(", "true", ")", ...
// closeHandle closes the resources associated with a Win32 handle
[ "closeHandle", "closes", "the", "resources", "associated", "with", "a", "Win32", "handle" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L118-L132
150,742
Microsoft/go-winio
file.go
ioCompletionProcessor
func ioCompletionProcessor(h syscall.Handle) { for { var bytes uint32 var key uintptr var op *ioOperation err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) if op == nil { panic(err) } op.ch <- ioResult{bytes, err} } }
go
func ioCompletionProcessor(h syscall.Handle) { for { var bytes uint32 var key uintptr var op *ioOperation err := getQueuedCompletionStatus(h, &bytes, &key, &op, syscall.INFINITE) if op == nil { panic(err) } op.ch <- ioResult{bytes, err} } }
[ "func", "ioCompletionProcessor", "(", "h", "syscall", ".", "Handle", ")", "{", "for", "{", "var", "bytes", "uint32", "\n", "var", "key", "uintptr", "\n", "var", "op", "*", "ioOperation", "\n", "err", ":=", "getQueuedCompletionStatus", "(", "h", ",", "&", ...
// ioCompletionProcessor processes completed async IOs forever
[ "ioCompletionProcessor", "processes", "completed", "async", "IOs", "forever" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L156-L167
150,743
Microsoft/go-winio
file.go
asyncIo
func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { if err != syscall.ERROR_IO_PENDING { return int(bytes), err } if f.closing.isSet() { cancelIoEx(f.handle, &c.o) } var timeout timeoutChan if d != nil { d.channelLock.Lock() timeout = d.channel d.cha...
go
func (f *win32File) asyncIo(c *ioOperation, d *deadlineHandler, bytes uint32, err error) (int, error) { if err != syscall.ERROR_IO_PENDING { return int(bytes), err } if f.closing.isSet() { cancelIoEx(f.handle, &c.o) } var timeout timeoutChan if d != nil { d.channelLock.Lock() timeout = d.channel d.cha...
[ "func", "(", "f", "*", "win32File", ")", "asyncIo", "(", "c", "*", "ioOperation", ",", "d", "*", "deadlineHandler", ",", "bytes", "uint32", ",", "err", "error", ")", "(", "int", ",", "error", ")", "{", "if", "err", "!=", "syscall", ".", "ERROR_IO_PEN...
// asyncIo processes the return value from ReadFile or WriteFile, blocking until // the operation has actually completed.
[ "asyncIo", "processes", "the", "return", "value", "from", "ReadFile", "or", "WriteFile", "blocking", "until", "the", "operation", "has", "actually", "completed", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L171-L214
150,744
Microsoft/go-winio
file.go
Read
func (f *win32File) Read(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.readDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.ReadFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.readDeadline, bytes, err) r...
go
func (f *win32File) Read(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.readDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.ReadFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.readDeadline, bytes, err) r...
[ "func", "(", "f", "*", "win32File", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "c", ",", "err", ":=", "f", ".", "prepareIo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\...
// Read reads from a file handle.
[ "Read", "reads", "from", "a", "file", "handle", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L217-L241
150,745
Microsoft/go-winio
file.go
Write
func (f *win32File) Write(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.writeDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.WriteFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.writeDeadline, bytes, err...
go
func (f *win32File) Write(b []byte) (int, error) { c, err := f.prepareIo() if err != nil { return 0, err } defer f.wg.Done() if f.writeDeadline.timedout.isSet() { return 0, ErrTimeout } var bytes uint32 err = syscall.WriteFile(f.handle, b, &bytes, &c.o) n, err := f.asyncIo(c, &f.writeDeadline, bytes, err...
[ "func", "(", "f", "*", "win32File", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "c", ",", "err", ":=", "f", ".", "prepareIo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "...
// Write writes to a file handle.
[ "Write", "writes", "to", "a", "file", "handle", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/file.go#L244-L260
150,746
Microsoft/go-winio
pkg/etw/eventdata.go
writeString
func (ed *eventData) writeString(data string) { ed.buffer.WriteString(data) ed.buffer.WriteByte(0) }
go
func (ed *eventData) writeString(data string) { ed.buffer.WriteString(data) ed.buffer.WriteByte(0) }
[ "func", "(", "ed", "*", "eventData", ")", "writeString", "(", "data", "string", ")", "{", "ed", ".", "buffer", ".", "WriteString", "(", "data", ")", "\n", "ed", ".", "buffer", ".", "WriteByte", "(", "0", ")", "\n", "}" ]
// writeString appends a string, including the null terminator, to the buffer.
[ "writeString", "appends", "a", "string", "including", "the", "null", "terminator", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L22-L25
150,747
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt8
func (ed *eventData) writeInt8(value int8) { ed.buffer.WriteByte(uint8(value)) }
go
func (ed *eventData) writeInt8(value int8) { ed.buffer.WriteByte(uint8(value)) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt8", "(", "value", "int8", ")", "{", "ed", ".", "buffer", ".", "WriteByte", "(", "uint8", "(", "value", ")", ")", "\n", "}" ]
// writeInt8 appends a int8 to the buffer.
[ "writeInt8", "appends", "a", "int8", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L28-L30
150,748
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt16
func (ed *eventData) writeInt16(value int16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt16(value int16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt16", "(", "value", "int16", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt16 appends a int16 to the buffer.
[ "writeInt16", "appends", "a", "int16", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L33-L35
150,749
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt32
func (ed *eventData) writeInt32(value int32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt32(value int32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt32", "(", "value", "int32", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt32 appends a int32 to the buffer.
[ "writeInt32", "appends", "a", "int32", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L38-L40
150,750
Microsoft/go-winio
pkg/etw/eventdata.go
writeInt64
func (ed *eventData) writeInt64(value int64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeInt64(value int64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeInt64", "(", "value", "int64", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeInt64 appends a int64 to the buffer.
[ "writeInt64", "appends", "a", "int64", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L43-L45
150,751
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint16
func (ed *eventData) writeUint16(value uint16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint16(value uint16) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint16", "(", "value", "uint16", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint16 appends a uint16 to the buffer.
[ "writeUint16", "appends", "a", "uint16", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L53-L55
150,752
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint32
func (ed *eventData) writeUint32(value uint32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint32(value uint32) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint32", "(", "value", "uint32", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint32 appends a uint32 to the buffer.
[ "writeUint32", "appends", "a", "uint32", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L58-L60
150,753
Microsoft/go-winio
pkg/etw/eventdata.go
writeUint64
func (ed *eventData) writeUint64(value uint64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
go
func (ed *eventData) writeUint64(value uint64) { binary.Write(&ed.buffer, binary.LittleEndian, value) }
[ "func", "(", "ed", "*", "eventData", ")", "writeUint64", "(", "value", "uint64", ")", "{", "binary", ".", "Write", "(", "&", "ed", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "value", ")", "\n", "}" ]
// writeUint64 appends a uint64 to the buffer.
[ "writeUint64", "appends", "a", "uint64", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventdata.go#L63-L65
150,754
Microsoft/go-winio
pkg/etw/eventopt.go
WithLevel
func WithLevel(level Level) EventOpt { return func(options *eventOptions) { options.descriptor.level = level } }
go
func WithLevel(level Level) EventOpt { return func(options *eventOptions) { options.descriptor.level = level } }
[ "func", "WithLevel", "(", "level", "Level", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "level", "=", "level", "\n", "}", "\n", "}" ]
// WithLevel specifies the level of the event to be written.
[ "WithLevel", "specifies", "the", "level", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L25-L29
150,755
Microsoft/go-winio
pkg/etw/eventopt.go
WithKeyword
func WithKeyword(keyword uint64) EventOpt { return func(options *eventOptions) { options.descriptor.keyword |= keyword } }
go
func WithKeyword(keyword uint64) EventOpt { return func(options *eventOptions) { options.descriptor.keyword |= keyword } }
[ "func", "WithKeyword", "(", "keyword", "uint64", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "keyword", "|=", "keyword", "\n", "}", "\n", "}" ]
// WithKeyword specifies the keywords of the event to be written. Multiple uses // of this option are OR'd together.
[ "WithKeyword", "specifies", "the", "keywords", "of", "the", "event", "to", "be", "written", ".", "Multiple", "uses", "of", "this", "option", "are", "OR", "d", "together", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L33-L37
150,756
Microsoft/go-winio
pkg/etw/eventopt.go
WithChannel
func WithChannel(channel Channel) EventOpt { return func(options *eventOptions) { options.descriptor.channel = channel } }
go
func WithChannel(channel Channel) EventOpt { return func(options *eventOptions) { options.descriptor.channel = channel } }
[ "func", "WithChannel", "(", "channel", "Channel", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "channel", "=", "channel", "\n", "}", "\n", "}" ]
// WithChannel specifies the channel of the event to be written.
[ "WithChannel", "specifies", "the", "channel", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L40-L44
150,757
Microsoft/go-winio
pkg/etw/eventopt.go
WithOpcode
func WithOpcode(opcode Opcode) EventOpt { return func(options *eventOptions) { options.descriptor.opcode = opcode } }
go
func WithOpcode(opcode Opcode) EventOpt { return func(options *eventOptions) { options.descriptor.opcode = opcode } }
[ "func", "WithOpcode", "(", "opcode", "Opcode", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "descriptor", ".", "opcode", "=", "opcode", "\n", "}", "\n", "}" ]
// WithOpcode specifies the opcode of the event to be written.
[ "WithOpcode", "specifies", "the", "opcode", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L47-L51
150,758
Microsoft/go-winio
pkg/etw/eventopt.go
WithActivityID
func WithActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.activityID = activityID } }
go
func WithActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.activityID = activityID } }
[ "func", "WithActivityID", "(", "activityID", "*", "guid", ".", "GUID", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "activityID", "=", "activityID", "\n", "}", "\n", "}" ]
// WithActivityID specifies the activity ID of the event to be written.
[ "WithActivityID", "specifies", "the", "activity", "ID", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L62-L66
150,759
Microsoft/go-winio
pkg/etw/eventopt.go
WithRelatedActivityID
func WithRelatedActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.relatedActivityID = activityID } }
go
func WithRelatedActivityID(activityID *guid.GUID) EventOpt { return func(options *eventOptions) { options.relatedActivityID = activityID } }
[ "func", "WithRelatedActivityID", "(", "activityID", "*", "guid", ".", "GUID", ")", "EventOpt", "{", "return", "func", "(", "options", "*", "eventOptions", ")", "{", "options", ".", "relatedActivityID", "=", "activityID", "\n", "}", "\n", "}" ]
// WithRelatedActivityID specifies the parent activity ID of the event to be written.
[ "WithRelatedActivityID", "specifies", "the", "parent", "activity", "ID", "of", "the", "event", "to", "be", "written", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventopt.go#L69-L73
150,760
Microsoft/go-winio
pkg/etw/newprovider_unsupported.go
NewProviderWithID
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { return nil, nil }
go
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { return nil, nil }
[ "func", "NewProviderWithID", "(", "name", "string", ",", "id", "*", "guid", ".", "GUID", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// NewProviderWithID returns a nil provider on unsupported platforms.
[ "NewProviderWithID", "returns", "a", "nil", "provider", "on", "unsupported", "platforms", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/newprovider_unsupported.go#L10-L12
150,761
Microsoft/go-winio
pkg/security/grantvmgroupaccess.go
generateDACLWithAcesAdded
func generateDACLWithAcesAdded(name string, isDir bool, origDACL uintptr) (uintptr, error) { // Generate pointers to the SIDs based on the string SIDs sid, err := syscall.StringToSid(sidVmGroup) if err != nil { return 0, errors.Wrapf(err, "%s syscall.StringToSid %s %s", gvmga, name, sidVmGroup) } inheritance :=...
go
func generateDACLWithAcesAdded(name string, isDir bool, origDACL uintptr) (uintptr, error) { // Generate pointers to the SIDs based on the string SIDs sid, err := syscall.StringToSid(sidVmGroup) if err != nil { return 0, errors.Wrapf(err, "%s syscall.StringToSid %s %s", gvmga, name, sidVmGroup) } inheritance :=...
[ "func", "generateDACLWithAcesAdded", "(", "name", "string", ",", "isDir", "bool", ",", "origDACL", "uintptr", ")", "(", "uintptr", ",", "error", ")", "{", "// Generate pointers to the SIDs based on the string SIDs", "sid", ",", "err", ":=", "syscall", ".", "StringTo...
// generateDACLWithAcesAdded generates a new DACL with the two needed ACEs added. // The caller is responsible for LocalFree of the returned DACL on success.
[ "generateDACLWithAcesAdded", "generates", "a", "new", "DACL", "with", "the", "two", "needed", "ACEs", "added", ".", "The", "caller", "is", "responsible", "for", "LocalFree", "of", "the", "returned", "DACL", "on", "success", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/grantvmgroupaccess.go#L128-L159
150,762
Microsoft/go-winio
pkg/etw/newprovider.go
NewProviderWithID
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { providerCallbackOnce.Do(func() { globalProviderCallback = windows.NewCallback(providerCallbackAdapter) }) provider = providers.newProvider() defer func(provider *Provider) { if err != nil { provider...
go
func NewProviderWithID(name string, id *guid.GUID, callback EnableCallback) (provider *Provider, err error) { providerCallbackOnce.Do(func() { globalProviderCallback = windows.NewCallback(providerCallbackAdapter) }) provider = providers.newProvider() defer func(provider *Provider) { if err != nil { provider...
[ "func", "NewProviderWithID", "(", "name", "string", ",", "id", "*", "guid", ".", "GUID", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "providerCallbackOnce", ".", "Do", "(", "func", "(", ")", "{...
// NewProviderWithID creates and registers a new ETW provider, allowing the // provider ID to be manually specified. This is most useful when there is an // existing provider ID that must be used to conform to existing diagnostic // infrastructure.
[ "NewProviderWithID", "creates", "and", "registers", "a", "new", "ETW", "provider", "allowing", "the", "provider", "ID", "to", "be", "manually", "specified", ".", "This", "is", "most", "useful", "when", "there", "is", "an", "existing", "provider", "ID", "that",...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/newprovider.go#L18-L53
150,763
Microsoft/go-winio
pkg/etw/provider.go
NewProvider
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) { return NewProviderWithID(name, providerIDFromName(name), callback) }
go
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) { return NewProviderWithID(name, providerIDFromName(name), callback) }
[ "func", "NewProvider", "(", "name", "string", ",", "callback", "EnableCallback", ")", "(", "provider", "*", "Provider", ",", "err", "error", ")", "{", "return", "NewProviderWithID", "(", "name", ",", "providerIDFromName", "(", "name", ")", ",", "callback", "...
// NewProvider creates and registers a new ETW provider. The provider ID is // generated based on the provider name.
[ "NewProvider", "creates", "and", "registers", "a", "new", "ETW", "provider", ".", "The", "provider", "ID", "is", "generated", "based", "on", "the", "provider", "name", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L121-L123
150,764
Microsoft/go-winio
pkg/etw/provider.go
Close
func (provider *Provider) Close() error { if provider == nil { return nil } providers.removeProvider(provider) return eventUnregister(provider.handle) }
go
func (provider *Provider) Close() error { if provider == nil { return nil } providers.removeProvider(provider) return eventUnregister(provider.handle) }
[ "func", "(", "provider", "*", "Provider", ")", "Close", "(", ")", "error", "{", "if", "provider", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "providers", ".", "removeProvider", "(", "provider", ")", "\n", "return", "eventUnregister", "(", "pro...
// Close unregisters the provider.
[ "Close", "unregisters", "the", "provider", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L126-L133
150,765
Microsoft/go-winio
pkg/etw/provider.go
IsEnabledForLevel
func (provider *Provider) IsEnabledForLevel(level Level) bool { return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0)) }
go
func (provider *Provider) IsEnabledForLevel(level Level) bool { return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0)) }
[ "func", "(", "provider", "*", "Provider", ")", "IsEnabledForLevel", "(", "level", "Level", ")", "bool", "{", "return", "provider", ".", "IsEnabledForLevelAndKeywords", "(", "level", ",", "^", "uint64", "(", "0", ")", ")", "\n", "}" ]
// IsEnabledForLevel calls IsEnabledForLevelAndKeywords with the specified level // and all keywords set.
[ "IsEnabledForLevel", "calls", "IsEnabledForLevelAndKeywords", "with", "the", "specified", "level", "and", "all", "keywords", "set", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L143-L145
150,766
Microsoft/go-winio
pkg/etw/provider.go
IsEnabledForLevelAndKeywords
func (provider *Provider) IsEnabledForLevelAndKeywords(level Level, keywords uint64) bool { if provider == nil { return false } if !provider.enabled { return false } // ETW automatically sets the level to 255 if it is specified as 0, so we // don't need to worry about the level=0 (all events) case. if leve...
go
func (provider *Provider) IsEnabledForLevelAndKeywords(level Level, keywords uint64) bool { if provider == nil { return false } if !provider.enabled { return false } // ETW automatically sets the level to 255 if it is specified as 0, so we // don't need to worry about the level=0 (all events) case. if leve...
[ "func", "(", "provider", "*", "Provider", ")", "IsEnabledForLevelAndKeywords", "(", "level", "Level", ",", "keywords", "uint64", ")", "bool", "{", "if", "provider", "==", "nil", "{", "return", "false", "\n", "}", "\n\n", "if", "!", "provider", ".", "enable...
// IsEnabledForLevelAndKeywords allows event producer code to check if there are // any event sessions that are interested in an event, based on the event level // and keywords. Although this check happens automatically in the ETW // infrastructure, it can be useful to check if an event will actually be // consumed bef...
[ "IsEnabledForLevelAndKeywords", "allows", "event", "producer", "code", "to", "check", "if", "there", "are", "any", "event", "sessions", "that", "are", "interested", "in", "an", "event", "based", "on", "the", "event", "level", "and", "keywords", ".", "Although", ...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L152-L172
150,767
Microsoft/go-winio
pkg/etw/provider.go
WriteEvent
func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpts []FieldOpt) error { if provider == nil { return nil } options := eventOptions{descriptor: newEventDescriptor()} em := &eventMetadata{} ed := &eventData{} // We need to evaluate the EventOpts first since they might change tags, a...
go
func (provider *Provider) WriteEvent(name string, eventOpts []EventOpt, fieldOpts []FieldOpt) error { if provider == nil { return nil } options := eventOptions{descriptor: newEventDescriptor()} em := &eventMetadata{} ed := &eventData{} // We need to evaluate the EventOpts first since they might change tags, a...
[ "func", "(", "provider", "*", "Provider", ")", "WriteEvent", "(", "name", "string", ",", "eventOpts", "[", "]", "EventOpt", ",", "fieldOpts", "[", "]", "FieldOpt", ")", "error", "{", "if", "provider", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n...
// WriteEvent writes a single ETW event from the provider. The event is // constructed based on the EventOpt and FieldOpt values that are passed as // opts.
[ "WriteEvent", "writes", "a", "single", "ETW", "event", "from", "the", "provider", ".", "The", "event", "is", "constructed", "based", "on", "the", "EventOpt", "and", "FieldOpt", "values", "that", "are", "passed", "as", "opts", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L177-L211
150,768
Microsoft/go-winio
pkg/etw/provider.go
writeEventRaw
func (provider *Provider) writeEventRaw( descriptor *eventDescriptor, activityID *guid.GUID, relatedActivityID *guid.GUID, metadataBlobs [][]byte, dataBlobs [][]byte) error { dataDescriptorCount := uint32(1 + len(metadataBlobs) + len(dataBlobs)) dataDescriptors := make([]eventDataDescriptor, 0, dataDescriptorCo...
go
func (provider *Provider) writeEventRaw( descriptor *eventDescriptor, activityID *guid.GUID, relatedActivityID *guid.GUID, metadataBlobs [][]byte, dataBlobs [][]byte) error { dataDescriptorCount := uint32(1 + len(metadataBlobs) + len(dataBlobs)) dataDescriptors := make([]eventDataDescriptor, 0, dataDescriptorCo...
[ "func", "(", "provider", "*", "Provider", ")", "writeEventRaw", "(", "descriptor", "*", "eventDescriptor", ",", "activityID", "*", "guid", ".", "GUID", ",", "relatedActivityID", "*", "guid", ".", "GUID", ",", "metadataBlobs", "[", "]", "[", "]", "byte", ",...
// writeEventRaw writes a single ETW event from the provider. This function is // less abstracted than WriteEvent, and presents a fairly direct interface to // the event writing functionality. It expects a series of event metadata and // event data blobs to be passed in, which must conform to the TraceLogging // schema...
[ "writeEventRaw", "writes", "a", "single", "ETW", "event", "from", "the", "provider", ".", "This", "function", "is", "less", "abstracted", "than", "WriteEvent", "and", "presents", "a", "fairly", "direct", "interface", "to", "the", "event", "writing", "functionali...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/provider.go#L220-L239
150,769
Microsoft/go-winio
archive/tar/writer.go
formatString
func (f *formatter) formatString(b []byte, s string) { if len(s) > len(b) { f.err = ErrFieldTooLong return } ascii := toASCII(s) copy(b, ascii) if len(ascii) < len(b) { b[len(ascii)] = 0 } }
go
func (f *formatter) formatString(b []byte, s string) { if len(s) > len(b) { f.err = ErrFieldTooLong return } ascii := toASCII(s) copy(b, ascii) if len(ascii) < len(b) { b[len(ascii)] = 0 } }
[ "func", "(", "f", "*", "formatter", ")", "formatString", "(", "b", "[", "]", "byte", ",", "s", "string", ")", "{", "if", "len", "(", "s", ")", ">", "len", "(", "b", ")", "{", "f", ".", "err", "=", "ErrFieldTooLong", "\n", "return", "\n", "}", ...
// Write s into b, terminating it with a NUL if there is room.
[ "Write", "s", "into", "b", "terminating", "it", "with", "a", "NUL", "if", "there", "is", "room", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L75-L85
150,770
Microsoft/go-winio
archive/tar/writer.go
formatOctal
func (f *formatter) formatOctal(b []byte, x int64) { s := strconv.FormatInt(x, 8) // leading zeros, but leave room for a NUL. for len(s)+1 < len(b) { s = "0" + s } f.formatString(b, s) }
go
func (f *formatter) formatOctal(b []byte, x int64) { s := strconv.FormatInt(x, 8) // leading zeros, but leave room for a NUL. for len(s)+1 < len(b) { s = "0" + s } f.formatString(b, s) }
[ "func", "(", "f", "*", "formatter", ")", "formatOctal", "(", "b", "[", "]", "byte", ",", "x", "int64", ")", "{", "s", ":=", "strconv", ".", "FormatInt", "(", "x", ",", "8", ")", "\n", "// leading zeros, but leave room for a NUL.", "for", "len", "(", "s...
// Encode x as an octal ASCII string and write it into b with leading zeros.
[ "Encode", "x", "as", "an", "octal", "ASCII", "string", "and", "write", "it", "into", "b", "with", "leading", "zeros", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L88-L95
150,771
Microsoft/go-winio
archive/tar/writer.go
Write
func (tw *Writer) Write(b []byte) (n int, err error) { if tw.closed { err = ErrWriteAfterClose return } overwrite := false if int64(len(b)) > tw.nb { b = b[0:tw.nb] overwrite = true } n, err = tw.w.Write(b) tw.nb -= int64(n) if err == nil && overwrite { err = ErrWriteTooLong return } tw.err = err ...
go
func (tw *Writer) Write(b []byte) (n int, err error) { if tw.closed { err = ErrWriteAfterClose return } overwrite := false if int64(len(b)) > tw.nb { b = b[0:tw.nb] overwrite = true } n, err = tw.w.Write(b) tw.nb -= int64(n) if err == nil && overwrite { err = ErrWriteTooLong return } tw.err = err ...
[ "func", "(", "tw", "*", "Writer", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "tw", ".", "closed", "{", "err", "=", "ErrWriteAfterClose", "\n", "return", "\n", "}", "\n", "overwrite", ":=",...
// Write writes to the current entry in the tar archive. // Write returns the error ErrWriteTooLong if more than // hdr.Size bytes are written after WriteHeader.
[ "Write", "writes", "to", "the", "current", "entry", "in", "the", "tar", "archive", ".", "Write", "returns", "the", "error", "ErrWriteTooLong", "if", "more", "than", "hdr", ".", "Size", "bytes", "are", "written", "after", "WriteHeader", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L404-L422
150,772
Microsoft/go-winio
archive/tar/writer.go
Close
func (tw *Writer) Close() error { if tw.err != nil || tw.closed { return tw.err } tw.Flush() tw.closed = true if tw.err != nil { return tw.err } // trailer: two zero blocks for i := 0; i < 2; i++ { _, tw.err = tw.w.Write(zeroBlock) if tw.err != nil { break } } return tw.err }
go
func (tw *Writer) Close() error { if tw.err != nil || tw.closed { return tw.err } tw.Flush() tw.closed = true if tw.err != nil { return tw.err } // trailer: two zero blocks for i := 0; i < 2; i++ { _, tw.err = tw.w.Write(zeroBlock) if tw.err != nil { break } } return tw.err }
[ "func", "(", "tw", "*", "Writer", ")", "Close", "(", ")", "error", "{", "if", "tw", ".", "err", "!=", "nil", "||", "tw", ".", "closed", "{", "return", "tw", ".", "err", "\n", "}", "\n", "tw", ".", "Flush", "(", ")", "\n", "tw", ".", "closed",...
// Close closes the tar archive, flushing any unwritten // data to the underlying writer.
[ "Close", "closes", "the", "tar", "archive", "flushing", "any", "unwritten", "data", "to", "the", "underlying", "writer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/archive/tar/writer.go#L426-L444
150,773
Microsoft/go-winio
fileinfo.go
GetFileBasicInfo
func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { bi := &FileBasicInfo{} if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: e...
go
func GetFileBasicInfo(f *os.File) (*FileBasicInfo, error) { bi := &FileBasicInfo{} if err := getFileInformationByHandleEx(syscall.Handle(f.Fd()), fileBasicInfo, (*byte)(unsafe.Pointer(bi)), uint32(unsafe.Sizeof(*bi))); err != nil { return nil, &os.PathError{Op: "GetFileInformationByHandleEx", Path: f.Name(), Err: e...
[ "func", "GetFileBasicInfo", "(", "f", "*", "os", ".", "File", ")", "(", "*", "FileBasicInfo", ",", "error", ")", "{", "bi", ":=", "&", "FileBasicInfo", "{", "}", "\n", "if", "err", ":=", "getFileInformationByHandleEx", "(", "syscall", ".", "Handle", "(",...
// GetFileBasicInfo retrieves times and attributes for a file.
[ "GetFileBasicInfo", "retrieves", "times", "and", "attributes", "for", "a", "file", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/fileinfo.go#L28-L35
150,774
Microsoft/go-winio
pkg/etw/eventmetadata.go
bytes
func (em *eventMetadata) bytes() []byte { // Finalize the event metadata buffer by filling in the buffer length at the // beginning. binary.LittleEndian.PutUint16(em.buffer.Bytes(), uint16(em.buffer.Len())) return em.buffer.Bytes() }
go
func (em *eventMetadata) bytes() []byte { // Finalize the event metadata buffer by filling in the buffer length at the // beginning. binary.LittleEndian.PutUint16(em.buffer.Bytes(), uint16(em.buffer.Len())) return em.buffer.Bytes() }
[ "func", "(", "em", "*", "eventMetadata", ")", "bytes", "(", ")", "[", "]", "byte", "{", "// Finalize the event metadata buffer by filling in the buffer length at the", "// beginning.", "binary", ".", "LittleEndian", ".", "PutUint16", "(", "em", ".", "buffer", ".", "...
// bytes returns the raw binary data containing the event metadata. Before being // returned, the current size of the buffer is written to the start of the // buffer. The returned value is not copied from the internal buffer, so it can // be mutated by the eventMetadata object after it is returned.
[ "bytes", "returns", "the", "raw", "binary", "data", "containing", "the", "event", "metadata", ".", "Before", "being", "returned", "the", "current", "size", "of", "the", "buffer", "is", "written", "to", "the", "start", "of", "the", "buffer", ".", "The", "re...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L88-L93
150,775
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeEventHeader
func (em *eventMetadata) writeEventHeader(name string, tags uint32) { binary.Write(&em.buffer, binary.LittleEndian, uint16(0)) // Length placeholder em.writeTags(tags) em.buffer.WriteString(name) em.buffer.WriteByte(0) // Null terminator for name }
go
func (em *eventMetadata) writeEventHeader(name string, tags uint32) { binary.Write(&em.buffer, binary.LittleEndian, uint16(0)) // Length placeholder em.writeTags(tags) em.buffer.WriteString(name) em.buffer.WriteByte(0) // Null terminator for name }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeEventHeader", "(", "name", "string", ",", "tags", "uint32", ")", "{", "binary", ".", "Write", "(", "&", "em", ".", "buffer", ",", "binary", ".", "LittleEndian", ",", "uint16", "(", "0", ")", ")", "/...
// writeEventHeader writes the metadata for the start of an event to the buffer. // This specifies the event name and tags.
[ "writeEventHeader", "writes", "the", "metadata", "for", "the", "start", "of", "an", "event", "to", "the", "buffer", ".", "This", "specifies", "the", "event", "name", "and", "tags", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L97-L102
150,776
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeField
func (em *eventMetadata) writeField(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType, outType, tags, 0) }
go
func (em *eventMetadata) writeField(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType, outType, tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeField", "(", "name", "string", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType", ",", "outType", ",", "tags",...
// writeField writes the metadata for a simple field to the buffer.
[ "writeField", "writes", "the", "metadata", "for", "a", "simple", "field", "to", "the", "buffer", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L154-L156
150,777
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeArray
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0) }
go
func (em *eventMetadata) writeArray(name string, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeArray, outType, tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeArray", "(", "name", "string", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType", "|", "inTypeArray", ",", "ou...
// writeArray writes the metadata for an array field to the buffer. The number // of elements in the array must be written as a uint16 in the event data, // immediately preceeding the event data.
[ "writeArray", "writes", "the", "metadata", "for", "an", "array", "field", "to", "the", "buffer", ".", "The", "number", "of", "elements", "in", "the", "array", "must", "be", "written", "as", "a", "uint16", "in", "the", "event", "data", "immediately", "prece...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L161-L163
150,778
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeCountedArray
func (em *eventMetadata) writeCountedArray(name string, count uint16, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeCountedArray, outType, tags, count) }
go
func (em *eventMetadata) writeCountedArray(name string, count uint16, inType inType, outType outType, tags uint32) { em.writeFieldInner(name, inType|inTypeCountedArray, outType, tags, count) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeCountedArray", "(", "name", "string", ",", "count", "uint16", ",", "inType", "inType", ",", "outType", "outType", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inType",...
// writeCountedArray writes the metadata for an array field to the buffer. The // size of a counted array is fixed, and the size is written into the metadata // directly.
[ "writeCountedArray", "writes", "the", "metadata", "for", "an", "array", "field", "to", "the", "buffer", ".", "The", "size", "of", "a", "counted", "array", "is", "fixed", "and", "the", "size", "is", "written", "into", "the", "metadata", "directly", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L168-L170
150,779
Microsoft/go-winio
pkg/etw/eventmetadata.go
writeStruct
func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) { em.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0) }
go
func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) { em.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0) }
[ "func", "(", "em", "*", "eventMetadata", ")", "writeStruct", "(", "name", "string", ",", "fieldCount", "uint8", ",", "tags", "uint32", ")", "{", "em", ".", "writeFieldInner", "(", "name", ",", "inTypeStruct", ",", "outType", "(", "fieldCount", ")", ",", ...
// writeStruct writes the metadata for a nested struct to the buffer. The struct // contains the next N fields in the metadata, where N is specified by the // fieldCount argument.
[ "writeStruct", "writes", "the", "metadata", "for", "a", "nested", "struct", "to", "the", "buffer", ".", "The", "struct", "contains", "the", "next", "N", "fields", "in", "the", "metadata", "where", "N", "is", "specified", "by", "the", "fieldCount", "argument"...
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/etw/eventmetadata.go#L175-L177
150,780
Microsoft/go-winio
pkg/security/mksyscall_windows.go
IsNotDuplicate
func (f *Fn) IsNotDuplicate() bool { funcName := f.DLLFuncName() if uniqDllFuncName[funcName] == false { uniqDllFuncName[funcName] = true return true } return false }
go
func (f *Fn) IsNotDuplicate() bool { funcName := f.DLLFuncName() if uniqDllFuncName[funcName] == false { uniqDllFuncName[funcName] = true return true } return false }
[ "func", "(", "f", "*", "Fn", ")", "IsNotDuplicate", "(", ")", "bool", "{", "funcName", ":=", "f", ".", "DLLFuncName", "(", ")", "\n", "if", "uniqDllFuncName", "[", "funcName", "]", "==", "false", "{", "uniqDllFuncName", "[", "funcName", "]", "=", "true...
// IsNotDuplicate is true if f is not a duplicated function
[ "IsNotDuplicate", "is", "true", "if", "f", "is", "not", "a", "duplicated", "function" ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/mksyscall_windows.go#L612-L619
150,781
Microsoft/go-winio
pkg/security/mksyscall_windows.go
Generate
func (src *Source) Generate(w io.Writer) error { const ( pkgStd = iota // any package in std library pkgXSysWindows // x/sys/windows package pkgOther ) isStdRepo, err := src.IsStdRepo() if err != nil { return err } var pkgtype int switch { case isStdRepo: pkgtype = pkgStd case packageN...
go
func (src *Source) Generate(w io.Writer) error { const ( pkgStd = iota // any package in std library pkgXSysWindows // x/sys/windows package pkgOther ) isStdRepo, err := src.IsStdRepo() if err != nil { return err } var pkgtype int switch { case isStdRepo: pkgtype = pkgStd case packageN...
[ "func", "(", "src", "*", "Source", ")", "Generate", "(", "w", "io", ".", "Writer", ")", "error", "{", "const", "(", "pkgStd", "=", "iota", "// any package in std library", "\n", "pkgXSysWindows", "// x/sys/windows package", "\n", "pkgOther", "\n", ")", "\n", ...
// Generate output source file from a source set src.
[ "Generate", "output", "source", "file", "from", "a", "source", "set", "src", "." ]
3fe4fa31662f6ede2353d913e93907b8e096e0b6
https://github.com/Microsoft/go-winio/blob/3fe4fa31662f6ede2353d913e93907b8e096e0b6/pkg/security/mksyscall_windows.go#L750-L812
150,782
godbus/dbus
decoder.go
newDecoder
func newDecoder(in io.Reader, order binary.ByteOrder) *decoder { dec := new(decoder) dec.in = in dec.order = order return dec }
go
func newDecoder(in io.Reader, order binary.ByteOrder) *decoder { dec := new(decoder) dec.in = in dec.order = order return dec }
[ "func", "newDecoder", "(", "in", "io", ".", "Reader", ",", "order", "binary", ".", "ByteOrder", ")", "*", "decoder", "{", "dec", ":=", "new", "(", "decoder", ")", "\n", "dec", ".", "in", "=", "in", "\n", "dec", ".", "order", "=", "order", "\n", "...
// newDecoder returns a new decoder that reads values from in. The input is // expected to be in the given byte order.
[ "newDecoder", "returns", "a", "new", "decoder", "that", "reads", "values", "from", "in", ".", "The", "input", "is", "expected", "to", "be", "in", "the", "given", "byte", "order", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L17-L22
150,783
godbus/dbus
decoder.go
align
func (dec *decoder) align(n int) { if dec.pos%n != 0 { newpos := (dec.pos + n - 1) & ^(n - 1) empty := make([]byte, newpos-dec.pos) if _, err := io.ReadFull(dec.in, empty); err != nil { panic(err) } dec.pos = newpos } }
go
func (dec *decoder) align(n int) { if dec.pos%n != 0 { newpos := (dec.pos + n - 1) & ^(n - 1) empty := make([]byte, newpos-dec.pos) if _, err := io.ReadFull(dec.in, empty); err != nil { panic(err) } dec.pos = newpos } }
[ "func", "(", "dec", "*", "decoder", ")", "align", "(", "n", "int", ")", "{", "if", "dec", ".", "pos", "%", "n", "!=", "0", "{", "newpos", ":=", "(", "dec", ".", "pos", "+", "n", "-", "1", ")", "&", "^", "(", "n", "-", "1", ")", "\n", "e...
// align aligns the input to the given boundary and panics on error.
[ "align", "aligns", "the", "input", "to", "the", "given", "boundary", "and", "panics", "on", "error", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L25-L34
150,784
godbus/dbus
decoder.go
sigByteSize
func sigByteSize(sig string) int { var total int for offset := 0; offset < len(sig); { switch sig[offset] { case 'y': total += 1 offset += 1 case 'n', 'q': total += 2 offset += 1 case 'b', 'i', 'u', 'h': total += 4 offset += 1 case 'x', 't', 'd': total += 8 offset += 1 case '(': ...
go
func sigByteSize(sig string) int { var total int for offset := 0; offset < len(sig); { switch sig[offset] { case 'y': total += 1 offset += 1 case 'n', 'q': total += 2 offset += 1 case 'b', 'i', 'u', 'h': total += 4 offset += 1 case 'x', 't', 'd': total += 8 offset += 1 case '(': ...
[ "func", "sigByteSize", "(", "sig", "string", ")", "int", "{", "var", "total", "int", "\n", "for", "offset", ":=", "0", ";", "offset", "<", "len", "(", "sig", ")", ";", "{", "switch", "sig", "[", "offset", "]", "{", "case", "'y'", ":", "total", "+...
// sigByteSize tries to calculates size of the given signature in bytes. // // It returns zero when it can't, for example when it contains non-fixed size // types such as strings, maps and arrays that require reading of the transmitted // data, for that we would need to implement the unread method for Decoder first.
[ "sigByteSize", "tries", "to", "calculates", "size", "of", "the", "given", "signature", "in", "bytes", ".", "It", "returns", "zero", "when", "it", "can", "t", "for", "example", "when", "it", "contains", "non", "-", "fixed", "size", "types", "such", "as", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/decoder.go#L241-L279
150,785
godbus/dbus
auth.go
authReadLine
func authReadLine(in *bufio.Reader) ([][]byte, error) { data, err := in.ReadBytes('\n') if err != nil { return nil, err } data = bytes.TrimSuffix(data, []byte("\r\n")) return bytes.Split(data, []byte{' '}), nil }
go
func authReadLine(in *bufio.Reader) ([][]byte, error) { data, err := in.ReadBytes('\n') if err != nil { return nil, err } data = bytes.TrimSuffix(data, []byte("\r\n")) return bytes.Split(data, []byte{' '}), nil }
[ "func", "authReadLine", "(", "in", "*", "bufio", ".", "Reader", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "data", ",", "err", ":=", "in", ".", "ReadBytes", "(", "'\\n'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "n...
// authReadLine reads a line and separates it into its fields.
[ "authReadLine", "reads", "a", "line", "and", "separates", "it", "into", "its", "fields", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/auth.go#L223-L230
150,786
godbus/dbus
sig.go
SignatureOf
func SignatureOf(vs ...interface{}) Signature { var s string for _, v := range vs { s += getSignature(reflect.TypeOf(v)) } return Signature{s} }
go
func SignatureOf(vs ...interface{}) Signature { var s string for _, v := range vs { s += getSignature(reflect.TypeOf(v)) } return Signature{s} }
[ "func", "SignatureOf", "(", "vs", "...", "interface", "{", "}", ")", "Signature", "{", "var", "s", "string", "\n", "for", "_", ",", "v", ":=", "range", "vs", "{", "s", "+=", "getSignature", "(", "reflect", ".", "TypeOf", "(", "v", ")", ")", "\n", ...
// SignatureOf returns the concatenation of all the signatures of the given // values. It panics if one of them is not representable in D-Bus.
[ "SignatureOf", "returns", "the", "concatenation", "of", "all", "the", "signatures", "of", "the", "given", "values", ".", "It", "panics", "if", "one", "of", "them", "is", "not", "representable", "in", "D", "-", "Bus", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L34-L40
150,787
godbus/dbus
sig.go
getSignature
func getSignature(t reflect.Type) string { // handle simple types first switch t.Kind() { case reflect.Uint8: return "y" case reflect.Bool: return "b" case reflect.Int16: return "n" case reflect.Uint16: return "q" case reflect.Int, reflect.Int32: if t == unixFDType { return "h" } return "i" cas...
go
func getSignature(t reflect.Type) string { // handle simple types first switch t.Kind() { case reflect.Uint8: return "y" case reflect.Bool: return "b" case reflect.Int16: return "n" case reflect.Uint16: return "q" case reflect.Int, reflect.Int32: if t == unixFDType { return "h" } return "i" cas...
[ "func", "getSignature", "(", "t", "reflect", ".", "Type", ")", "string", "{", "// handle simple types first", "switch", "t", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Uint8", ":", "return", "\"", "\"", "\n", "case", "reflect", ".", "Bool", ":"...
// getSignature returns the signature of the given type and panics on unknown types.
[ "getSignature", "returns", "the", "signature", "of", "the", "given", "type", "and", "panics", "on", "unknown", "types", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L49-L108
150,788
godbus/dbus
sig.go
ParseSignature
func ParseSignature(s string) (sig Signature, err error) { if len(s) == 0 { return } if len(s) > 255 { return Signature{""}, SignatureError{s, "too long"} } sig.str = s for err == nil && len(s) != 0 { err, s = validSingle(s, 0) } if err != nil { sig = Signature{""} } return }
go
func ParseSignature(s string) (sig Signature, err error) { if len(s) == 0 { return } if len(s) > 255 { return Signature{""}, SignatureError{s, "too long"} } sig.str = s for err == nil && len(s) != 0 { err, s = validSingle(s, 0) } if err != nil { sig = Signature{""} } return }
[ "func", "ParseSignature", "(", "s", "string", ")", "(", "sig", "Signature", ",", "err", "error", ")", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "\n", "}", "\n", "if", "len", "(", "s", ")", ">", "255", "{", "return", "Signature", ...
// ParseSignature returns the signature represented by this string, or a // SignatureError if the string is not a valid signature.
[ "ParseSignature", "returns", "the", "signature", "represented", "by", "this", "string", "or", "a", "SignatureError", "if", "the", "string", "is", "not", "a", "valid", "signature", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L112-L128
150,789
godbus/dbus
sig.go
ParseSignatureMust
func ParseSignatureMust(s string) Signature { sig, err := ParseSignature(s) if err != nil { panic(err) } return sig }
go
func ParseSignatureMust(s string) Signature { sig, err := ParseSignature(s) if err != nil { panic(err) } return sig }
[ "func", "ParseSignatureMust", "(", "s", "string", ")", "Signature", "{", "sig", ",", "err", ":=", "ParseSignature", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "return", "sig", "\n", "}" ]
// ParseSignatureMust behaves like ParseSignature, except that it panics if s // is not valid.
[ "ParseSignatureMust", "behaves", "like", "ParseSignature", "except", "that", "it", "panics", "if", "s", "is", "not", "valid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L132-L138
150,790
godbus/dbus
sig.go
Single
func (s Signature) Single() bool { err, r := validSingle(s.str, 0) return err != nil && r == "" }
go
func (s Signature) Single() bool { err, r := validSingle(s.str, 0) return err != nil && r == "" }
[ "func", "(", "s", "Signature", ")", "Single", "(", ")", "bool", "{", "err", ",", "r", ":=", "validSingle", "(", "s", ".", "str", ",", "0", ")", "\n", "return", "err", "!=", "nil", "&&", "r", "==", "\"", "\"", "\n", "}" ]
// Single returns whether the signature represents a single, complete type.
[ "Single", "returns", "whether", "the", "signature", "represents", "a", "single", "complete", "type", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L146-L149
150,791
godbus/dbus
sig.go
validSingle
func validSingle(s string, depth int) (err error, rem string) { if s == "" { return SignatureError{Sig: s, Reason: "empty signature"}, "" } if depth > 64 { return SignatureError{Sig: s, Reason: "container nesting too deep"}, "" } switch s[0] { case 'y', 'b', 'n', 'q', 'i', 'u', 'x', 't', 'd', 's', 'g', 'o', '...
go
func validSingle(s string, depth int) (err error, rem string) { if s == "" { return SignatureError{Sig: s, Reason: "empty signature"}, "" } if depth > 64 { return SignatureError{Sig: s, Reason: "container nesting too deep"}, "" } switch s[0] { case 'y', 'b', 'n', 'q', 'i', 'u', 'x', 't', 'd', 's', 'g', 'o', '...
[ "func", "validSingle", "(", "s", "string", ",", "depth", "int", ")", "(", "err", "error", ",", "rem", "string", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "SignatureError", "{", "Sig", ":", "s", ",", "Reason", ":", "\"", "\"", "}", ","...
// Try to read a single type from this string. If it was successful, err is nil // and rem is the remaining unparsed part. Otherwise, err is a non-nil // SignatureError and rem is "". depth is the current recursion depth which may // not be greater than 64 and should be given as 0 on the first call.
[ "Try", "to", "read", "a", "single", "type", "from", "this", "string", ".", "If", "it", "was", "successful", "err", "is", "nil", "and", "rem", "is", "the", "remaining", "unparsed", "part", ".", "Otherwise", "err", "is", "a", "non", "-", "nil", "Signatur...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L171-L219
150,792
godbus/dbus
sig.go
typeFor
func typeFor(s string) (t reflect.Type) { err, _ := validSingle(s, 0) if err != nil { panic(err) } if t, ok := sigToType[s[0]]; ok { return t } switch s[0] { case 'a': if s[1] == '{' { i := strings.LastIndex(s, "}") t = reflect.MapOf(sigToType[s[2]], typeFor(s[3:i])) } else { t = reflect.SliceO...
go
func typeFor(s string) (t reflect.Type) { err, _ := validSingle(s, 0) if err != nil { panic(err) } if t, ok := sigToType[s[0]]; ok { return t } switch s[0] { case 'a': if s[1] == '{' { i := strings.LastIndex(s, "}") t = reflect.MapOf(sigToType[s[2]], typeFor(s[3:i])) } else { t = reflect.SliceO...
[ "func", "typeFor", "(", "s", "string", ")", "(", "t", "reflect", ".", "Type", ")", "{", "err", ",", "_", ":=", "validSingle", "(", "s", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n\n", "if", "t"...
// typeFor returns the type of the given signature. It ignores any left over // characters and panics if s doesn't start with a valid type signature.
[ "typeFor", "returns", "the", "type", "of", "the", "given", "signature", ".", "It", "ignores", "any", "left", "over", "characters", "and", "panics", "if", "s", "doesn", "t", "start", "with", "a", "valid", "type", "signature", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/sig.go#L238-L259
150,793
godbus/dbus
prop/prop.go
Export
func Export( conn *dbus.Conn, path dbus.ObjectPath, props map[string]map[string]*Prop, ) (*Properties, error) { p := &Properties{m: props, conn: conn, path: path} if err := conn.Export(p, path, "org.freedesktop.DBus.Properties"); err != nil { return nil, err } return p, nil }
go
func Export( conn *dbus.Conn, path dbus.ObjectPath, props map[string]map[string]*Prop, ) (*Properties, error) { p := &Properties{m: props, conn: conn, path: path} if err := conn.Export(p, path, "org.freedesktop.DBus.Properties"); err != nil { return nil, err } return p, nil }
[ "func", "Export", "(", "conn", "*", "dbus", ".", "Conn", ",", "path", "dbus", ".", "ObjectPath", ",", "props", "map", "[", "string", "]", "map", "[", "string", "]", "*", "Prop", ",", ")", "(", "*", "Properties", ",", "error", ")", "{", "p", ":=",...
// Export returns a new Properties structure that manages the given properties. // The key for the first-level map of props is the name of the interface; the // second-level key is the name of the property. The returned structure will be // exported as org.freedesktop.DBus.Properties on path.
[ "Export", "returns", "a", "new", "Properties", "structure", "that", "manages", "the", "given", "properties", ".", "The", "key", "for", "the", "first", "-", "level", "map", "of", "props", "is", "the", "name", "of", "the", "interface", ";", "the", "second", ...
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L160-L168
150,794
godbus/dbus
prop/prop.go
Get
func (p *Properties) Get(iface, property string) (dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return dbus.Variant{}, ErrIfaceNotFound } prop, ok := m[property] if !ok { return dbus.Variant{}, ErrPropNotFound } return dbus.MakeVariant(prop.Value), nil }
go
func (p *Properties) Get(iface, property string) (dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return dbus.Variant{}, ErrIfaceNotFound } prop, ok := m[property] if !ok { return dbus.Variant{}, ErrPropNotFound } return dbus.MakeVariant(prop.Value), nil }
[ "func", "(", "p", "*", "Properties", ")", "Get", "(", "iface", ",", "property", "string", ")", "(", "dbus", ".", "Variant", ",", "*", "dbus", ".", "Error", ")", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", ...
// Get implements org.freedesktop.DBus.Properties.Get.
[ "Get", "implements", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "Get", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L171-L183
150,795
godbus/dbus
prop/prop.go
GetAll
func (p *Properties) GetAll(iface string) (map[string]dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return nil, ErrIfaceNotFound } rm := make(map[string]dbus.Variant, len(m)) for k, v := range m { rm[k] = dbus.MakeVariant(v.Value) } return rm, nil }
go
func (p *Properties) GetAll(iface string) (map[string]dbus.Variant, *dbus.Error) { p.mut.RLock() defer p.mut.RUnlock() m, ok := p.m[iface] if !ok { return nil, ErrIfaceNotFound } rm := make(map[string]dbus.Variant, len(m)) for k, v := range m { rm[k] = dbus.MakeVariant(v.Value) } return rm, nil }
[ "func", "(", "p", "*", "Properties", ")", "GetAll", "(", "iface", "string", ")", "(", "map", "[", "string", "]", "dbus", ".", "Variant", ",", "*", "dbus", ".", "Error", ")", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".",...
// GetAll implements org.freedesktop.DBus.Properties.GetAll.
[ "GetAll", "implements", "org", ".", "freedesktop", ".", "DBus", ".", "Properties", ".", "GetAll", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L186-L198
150,796
godbus/dbus
prop/prop.go
GetMust
func (p *Properties) GetMust(iface, property string) interface{} { p.mut.RLock() defer p.mut.RUnlock() return p.m[iface][property].Value }
go
func (p *Properties) GetMust(iface, property string) interface{} { p.mut.RLock() defer p.mut.RUnlock() return p.m[iface][property].Value }
[ "func", "(", "p", "*", "Properties", ")", "GetMust", "(", "iface", ",", "property", "string", ")", "interface", "{", "}", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "RUnlock", "(", ")", "\n", "return", "p",...
// GetMust returns the value of the given property and panics if either the // interface or the property name are invalid.
[ "GetMust", "returns", "the", "value", "of", "the", "given", "property", "and", "panics", "if", "either", "the", "interface", "or", "the", "property", "name", "are", "invalid", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L202-L206
150,797
godbus/dbus
prop/prop.go
Introspection
func (p *Properties) Introspection(iface string) []introspect.Property { p.mut.RLock() defer p.mut.RUnlock() m := p.m[iface] s := make([]introspect.Property, 0, len(m)) for k, v := range m { p := introspect.Property{Name: k, Type: dbus.SignatureOf(v.Value).String()} if v.Writable { p.Access = "readwrite" ...
go
func (p *Properties) Introspection(iface string) []introspect.Property { p.mut.RLock() defer p.mut.RUnlock() m := p.m[iface] s := make([]introspect.Property, 0, len(m)) for k, v := range m { p := introspect.Property{Name: k, Type: dbus.SignatureOf(v.Value).String()} if v.Writable { p.Access = "readwrite" ...
[ "func", "(", "p", "*", "Properties", ")", "Introspection", "(", "iface", "string", ")", "[", "]", "introspect", ".", "Property", "{", "p", ".", "mut", ".", "RLock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "RUnlock", "(", ")", "\n", "m", ":...
// Introspection returns the introspection data that represents the properties // of iface.
[ "Introspection", "returns", "the", "introspection", "data", "that", "represents", "the", "properties", "of", "iface", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L210-L225
150,798
godbus/dbus
prop/prop.go
set
func (p *Properties) set(iface, property string, v interface{}) error { prop := p.m[iface][property] prop.Value = v switch prop.Emit { case EmitFalse: return nil // do nothing case EmitInvalidates: return p.conn.Emit(p.path, "org.freedesktop.DBus.Properties.PropertiesChanged", iface, map[string]dbus.Variant...
go
func (p *Properties) set(iface, property string, v interface{}) error { prop := p.m[iface][property] prop.Value = v switch prop.Emit { case EmitFalse: return nil // do nothing case EmitInvalidates: return p.conn.Emit(p.path, "org.freedesktop.DBus.Properties.PropertiesChanged", iface, map[string]dbus.Variant...
[ "func", "(", "p", "*", "Properties", ")", "set", "(", "iface", ",", "property", "string", ",", "v", "interface", "{", "}", ")", "error", "{", "prop", ":=", "p", ".", "m", "[", "iface", "]", "[", "property", "]", "\n", "prop", ".", "Value", "=", ...
// set sets the given property and emits PropertyChanged if appropiate. p.mut // must already be locked.
[ "set", "sets", "the", "given", "property", "and", "emits", "PropertyChanged", "if", "appropiate", ".", "p", ".", "mut", "must", "already", "be", "locked", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L229-L245
150,799
godbus/dbus
prop/prop.go
Set
func (p *Properties) Set(iface, property string, newv dbus.Variant) *dbus.Error { p.mut.Lock() defer p.mut.Unlock() m, ok := p.m[iface] if !ok { return ErrIfaceNotFound } prop, ok := m[property] if !ok { return ErrPropNotFound } if !prop.Writable { return ErrReadOnly } if newv.Signature() != dbus.Signa...
go
func (p *Properties) Set(iface, property string, newv dbus.Variant) *dbus.Error { p.mut.Lock() defer p.mut.Unlock() m, ok := p.m[iface] if !ok { return ErrIfaceNotFound } prop, ok := m[property] if !ok { return ErrPropNotFound } if !prop.Writable { return ErrReadOnly } if newv.Signature() != dbus.Signa...
[ "func", "(", "p", "*", "Properties", ")", "Set", "(", "iface", ",", "property", "string", ",", "newv", "dbus", ".", "Variant", ")", "*", "dbus", ".", "Error", "{", "p", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mut", ".", "Un...
// Set implements org.freedesktop.Properties.Set.
[ "Set", "implements", "org", ".", "freedesktop", ".", "Properties", ".", "Set", "." ]
ade71ed3457e1a2d0edc32a59e718cc523e73b21
https://github.com/godbus/dbus/blob/ade71ed3457e1a2d0edc32a59e718cc523e73b21/prop/prop.go#L248-L275