Skip to content

Commit d1194fb

Browse files
committed
added misc snippets
1 parent 3d13f97 commit d1194fb

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.vscode/quick-snips.code-snippets

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Place your bpf-snippets workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
// "Print to console": {
10+
// "scope": "javascript,typescript",
11+
// "prefix": "log",
12+
// "body": [
13+
// "console.log('$1');",
14+
// "$2"
15+
// ],
16+
// "description": "Log output to console"
17+
// }
18+
"add doc link": {
19+
"scope": "snippets",
20+
"prefix": "snip-add-inline-docs",
21+
"body": "\"\\${${1:idx}| ,// ${2|Refer,Usage|}: ${3:link}|}\","
22+
}
23+
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
{
3636
"language": "c",
3737
"path": "./snippets/progs-network.code-snippets"
38+
},
39+
{
40+
"language": "c",
41+
"path": "./snippets/misc.code-snippets"
3842
}
3943
]
4044
},

snippets/misc.code-snippets

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"create kernel config": {
3+
"scope": "c",
4+
"prefix": "bpf-misc-kconfig",
5+
"body": [
6+
"${2| ,// Refer: https://docs.ebpf.io/ebpf-library/libbpf/ebpf/__kconfig/|}",
7+
"extern unsigned ${1:CONFIG_HZ} __kconfig __weak;"
8+
]
9+
},
10+
"create linux version variable": {
11+
"scope": "c",
12+
"prefix": "bpf-misc-kernel-version",
13+
"body": [
14+
"${1| ,// Refer: https://docs.ebpf.io/ebpf-library/libbpf/ebpf/KERNEL_VERSION/|}",
15+
"extern int LINUX_KERNEL_VERSION __kconfig;"
16+
]
17+
},
18+
}

0 commit comments

Comments
 (0)