1
" glusterfs.vim: GNU Vim Syntax file for GlusterFS .vol specification
2
" Copyright (c) 2007777777Red Hat, Inc. <http://www.redhat.com>
3
" This file is part of GlusterFS.
5
" This file is licensed to you under your choice of the GNU Lesser
6
" General Public License, version 3 or any later version (LGPLv3 or
7
" later), or the GNU General Public License, version 2 (GPLv2), in all
8
" cases as published by the Free Software Foundation.
10
" Last Modified: Wed Aug 1 00:47:10 IST 2007
24
"************************************************************************
25
" Initially, consider everything an error. Then start eliminating one
26
" field after the other. Whatever is not eliminated (due to defined
27
" properties) is an error - Multiples Values for a key
28
"************************************************************************
29
syn match glusterfsError /[^ ]\+/ skipwhite
30
syn match glusterfsComment "#.*" contains=glusterfsTodo
32
syn keyword glusterfsTodo contained TODO FIXME NOTE
34
"------------------------------------------------------------------------
36
"------------------------------------------------------------------------
37
" Handle all the 'Type' keys and values. Here, a '/' is used to separate
38
" the key-value pair, they are clubbed together for convenience
39
syn match glusterfsType "^\s*type\s\+" skipwhite nextgroup=glusterfsTypeKeyVal
41
syn match glusterfsTypeKeyVal contained "\<protocol/\(client\|server\)\>"
42
syn match glusterfsTypeKeyVal contained "\<cluster/\(unify\|afr\|stripe\)\>"
43
syn match glusterfsTypeKeyVal contained "\<debug/\(trace\)\>"
44
syn match glusterfsTypeKeyVal contained "\<encryption/\(rot-13\)\>"
45
syn match glusterfsTypeKeyVal contained "\<storage/\(posix\)\>"
46
"syn match glusterfsTypeKeyVal contained "\<features/\(trash\)\>"
47
syn match glusterfsTypeKeyVal contained "\<features/\(trash\|posix-locks\|fixed-id\|filter\)\>"
48
syn match glusterfsTypeKeyVal contained "\<performance/\(io-threads\|write-behind\|io-cache\|read-ahead\)\>"
49
"------------------------------------------------------------------------
51
"------------------------------------------------------------------------
54
"************************************************************************
56
"------------------------------------------------------------------------
58
"------------------------------------------------------------------------
59
" NOTE 1: Only one volume name allowed after 'volume' keyword
60
" NOTE 2: Multiple volumes allowed after 'subvolumes'
61
" NOTE 3: Some other options (like remote-subvolume, namespace etc) use
63
syn match glusterfsVol "^\s*volume\s\+" nextgroup=glusterfsVolName
64
syn match glusterfsVolName "\<\k\+" contained
66
syn match glusterfsVol "^\s*subvolumes\s\+" skipwhite nextgroup=glusterfsSubVolName
67
syn match glusterfsSubVolName "\<\k\+\>" skipwhite contained nextgroup=glusterfsSubVolName
69
syn match glusterfsVol "^\s*end-volume\>"
70
"------------------------------------------------------------------------
72
"------------------------------------------------------------------------
78
"------------------------------------------------------------------------
80
"------------------------------------------------------------------------
81
syn match glusterfsOpt "^\s*option\s\+" nextgroup=glusterfsOptKey
84
syn keyword glusterfsOptKey contained transport-type skipwhite nextgroup=glusterfsOptValTransportType
85
syn match glusterfsOptValTransportType contained "\<\(tcp\|ib\-verbs\|ib-sdp\)/\(client\|server\)\>"
87
syn keyword glusterfsOptKey contained remote-subvolume skipwhite nextgroup=glusterfsVolName
89
syn keyword glusterfsOptKey contained auth.addr.ra8.allow auth.addr.ra7.allow auth.addr.ra6.allow auth.addr.ra5.allow auth.addr.ra4.allow auth.addr.ra3.allow auth.addr.ra2.allow auth.addr.ra1.allow auth.addr.brick-ns.allow skipwhite nextgroup=glusterfsOptVal
91
syn keyword glusterfsOptKey contained client-volume-filename directory trash-dir skipwhite nextgroup=glusterfsOpt_Path
92
syn match glusterfsOpt_Path contained "\s\+\f\+\>"
94
syn keyword glusterfsOptKey contained debug self-heal encrypt-write decrypt-read mandatory nextgroup=glusterfsOpt_OnOff
95
syn match glusterfsOpt_OnOff contained "\s\+\(on\|off\)\>"
97
syn keyword glusterfsOptKey contained flush-behind non-blocking-connect nextgroup=glusterfsOpt_OnOffNoYes
98
syn keyword glusterfsOpt_OnOffNoYes contained on off no yes
100
syn keyword glusterfsOptKey contained page-size cache-size nextgroup=glusterfsOpt_Size
102
syn keyword glusterfsOptKey contained fixed-gid fixed-uid cache-seconds page-count thread-count aggregate-size listen-port remote-port transport-timeout inode-lru-limit nextgroup=glusterfsOpt_Number
104
syn keyword glusterfsOptKey contained alu.disk-usage.entry-threshold alu.disk-usage.exit-threshold nextgroup=glusterfsOpt_Size
106
syn keyword glusterfsOptKey contained alu.order skipwhite nextgroup=glusterfsOptValAluOrder
107
syn match glusterfsOptValAluOrder contained "\s\+\(\(disk-usage\|write-usage\|read-usage\|open-files-usage\|disk-speed\):\)*\(disk-usage\|write-usage\|read-usage\|open-files-usage\|disk-speed\)\>"
109
syn keyword glusterfsOptKey contained alu.open-files-usage.entry-threshold alu.open-files-usage.exit-threshold alu.limits.max-open-files rr.refresh-interval random.refresh-interval nufa.refresh-interval nextgroup=glusterfsOpt_Number
111
syn keyword glusterfsOptKey contained nufa.local-volume-name skipwhite nextgroup=glusterfsVolName
113
syn keyword glusterfsOptKey contained ib-verbs-work-request-send-size ib-verbs-work-request-recv-size nextgroup=glusterfsOpt_Size
114
syn match glusterfsOpt_Size contained "\s\+\d\+\([gGmMkK][bB]\)\=\>"
116
syn keyword glusterfsOptKey contained ib-verbs-work-request-send-count ib-verbs-work-request-recv-count ib-verbs-port nextgroup=glusterfsOpt_Number
118
syn keyword glusterfsOptKey contained ib-verbs-mtu nextgroup=glusterfsOptValIBVerbsMtu
119
syn match glusterfsOptValIBVerbsMtu "\s\+\(256\|512\|1024\|2048\|4096\)\>" contained
121
syn keyword glusterfsOptKey contained ib-verbs-device-name nextgroup=glusterfsOptVal
123
syn match glusterfsOpt_Number contained "\s\+\d\+\>"
125
syn keyword glusterfsOptKey contained scheduler skipwhite nextgroup=glusterfsOptValScheduler
126
syn keyword glusterfsOptValScheduler contained rr alu random nufa
128
syn keyword glusterfsOptKey contained namespace skipwhite nextgroup=glusterfsVolName
130
syn keyword glusterfsOptKey contained lock-node skipwhite nextgroup=glusterfsVolName
134
syn keyword glusterfsOptKey contained alu.write-usage.entry-threshold alu.write-usage.exit-threshold alu.read-usage.entry-threshold alu.read-usage.exit-threshold alu.limits.min-free-disk nextgroup=glusterfsOpt_Percentage
136
syn keyword glusterfsOptKey contained random.limits.min-free-disk nextgroup=glusterfsOpt_Percentage
137
syn keyword glusterfsOptKey contained rr.limits.min-disk-free nextgroup=glusterfsOpt_Size
139
syn keyword glusterfsOptKey contained nufa.limits.min-free-disk nextgroup=glusterfsOpt_Percentage
141
syn match glusterfsOpt_Percentage contained "\s\+\d\+%\=\>"
151
syn keyword glusterfsOptKey contained remote-host bind-address nextgroup=glusterfsOpt_IP,glusterfsOpt_Domain
152
syn match glusterfsOpt_IP contained "\s\+\d\d\=\d\=\.\d\d\=\d\=\.\d\d\=\d\=\.\d\d\=\d\=\>"
153
syn match glusterfsOpt_Domain contained "\s\+\a[a-zA-Z0-9_-]*\(\.\a\+\)*\>"
155
syn match glusterfsVolNames "\s*\<\S\+\>" contained skipwhite nextgroup=glusterfsVolNames
157
syn keyword glusterfsOptKey contained block-size replicate skipwhite nextgroup=glusterfsOpt_Pattern
159
syn match glusterfsOpt_Pattern contained "\s\+\k\+\>"
160
syn match glusterfsOptVal contained "\s\+\S\+\>"
166
hi link glusterfsError Error
167
hi link glusterfsComment Comment
169
hi link glusterfsVol keyword
171
hi link glusterfsVolName function
172
hi link glusterfsSubVolName function
174
hi link glusterfsType Keyword
175
hi link glusterfsTypeKeyVal String
177
hi link glusterfsOpt Keyword
179
hi link glusterfsOptKey Special
180
hi link glusterfsOptVal Normal
182
hi link glusterfsOptValTransportType String
183
hi link glusterfsOptValScheduler String
184
hi link glusterfsOptValAluOrder String
185
hi link glusterfsOptValIBVerbsMtu String
187
hi link glusterfsOpt_OnOff String
188
hi link glusterfsOpt_OnOffNoYes String
191
" Options that require
192
hi link glusterfsOpt_Size PreProc
193
hi link glusterfsOpt_Domain PreProc
194
hi link glusterfsOpt_Percentage PreProc
195
hi link glusterfsOpt_IP PreProc
196
hi link glusterfsOpt_Pattern PreProc
197
hi link glusterfsOpt_Number Preproc
198
hi link glusterfsOpt_Path Preproc
202
let b:current_syntax = "glusterfs"