2
2
3
3
[ TOC]
4
4
5
+ ## General note on this document
6
+
7
+ This document is "descriptive/post-factual" in that it documents pratices that
8
+ are in use; it is not "definitive/pre-factual" in prescribing practices.
9
+
10
+ This means that when a procedure changes, it is agreed upon, then put into
11
+ practice, and then documented here. If this document doesn't match reality,
12
+ it's the document that needs to be updated, not reality.
13
+
14
+
5
15
## Git Structure
6
16
7
17
The master Git for PROJECT resides on Github at
@@ -10,20 +20,21 @@ The master Git for PROJECT resides on Github at
10
20
![ git branches continually merging to the left from 3 lanes; float-right] (doc/git_branches.svg
11
21
"git branch mechanics")
12
22
13
- There are 3 main branches for development and a release branch for each
23
+ There is one main branch for development and a release branch for each
14
24
major release.
15
25
16
- New contributions are done against the head of the Develop branch. The CI
26
+ New contributions are done against the head of the master branch. The CI
17
27
systems will pick up the Github Pull Requests or the new patch from
18
- Patchwork, run some basic build and functional tests and will merge them
19
- into the branch automatically on success.
20
-
21
- Code on the develop branch will then be further tested and reviewed by the
22
- community and merged to master on a regular interval.
28
+ Patchwork, run some basic build and functional tests.
23
29
24
30
For each major release (1.0, 1.1 etc) a new release branch is created based
25
31
on the master.
26
32
33
+ There was an attempt to use a "develop" branch automatically maintained by
34
+ the CI system. This is not currently in active use, though the system is
35
+ operational. If the "develop" branch is in active use and this paragraph
36
+ is still here, this document obviously wasn't updated.
37
+
27
38
28
39
## Programming language, Tools and Libraries
29
40
@@ -250,16 +261,72 @@ Portions:
250
261
251
262
### Code styling / format
252
263
253
- GNU coding standards apply. Indentation follows the result of invoking GNU
254
- indent (as of 2.2.8a) with the ` -nut -nfc1 ` arguments.
264
+ Coding style standards in FRR vary depending on location. Pre-existing
265
+ code uses GNU coding standards. New code may use Linux kernel coding style.
266
+
267
+ GNU coding style apply to the following parts:
268
+
269
+ * lib/
270
+ * zebra/
271
+ * bgpd/
272
+ * ospfd/
273
+ * ospf6d/
274
+ * isisd/
275
+ * ripd/
276
+ * ripngd/
277
+ * vtysh/
278
+
279
+ Linux kernel coding style applies to:
280
+
281
+ * nhrpd/
282
+ * watchfrr/
283
+ * pimd/
284
+ * lib/{checksum,hook,imsg-buffer,imsg,libfrr,md5,module,monotime,queue}.[ ch]
285
+
286
+ BSD coding style applies to:
287
+
288
+ * ldpd/
289
+
290
+ ** Whitespace changes in untouched parts of the code are not acceptable in
291
+ patches that change actual code.** To change/fix formatting issues, please
292
+ create a separate patch that only does formatting changes and nothing else.
293
+
294
+ It is acceptable to rewrap entire files to Linux kernel style, but this
295
+ ** MUST** come as a separate patch that does nothing other than this
296
+ reformatting.
297
+
298
+
299
+ #### GNU style
300
+
301
+ For GNU coding style, Indentation follows the result of invoking GNU indent:
255
302
256
303
```
257
304
indent -nut -nfc1 file_for_submission.c
258
305
```
259
306
260
- Please don’t reformat existing files (or only sections modified by your
261
- changes), even if they don’t follow the standard. This makes it very hard to
262
- highlight the changes
307
+ Originally, tabs were used instead of spaces, with tabs are every 8 columns.
308
+ However, tab interoperability issues mean space characters are now preferred for
309
+ new changes. We generally only clean up whitespace when code is unmaintainable
310
+ due to whitespace issues, to minimise merging conflicts.
311
+
312
+
313
+ #### Linux kernel & BSD style
314
+
315
+ These styles are documented externally:
316
+
317
+ * [ https://www.kernel.org/doc/Documentation/CodingStyle ] ( https://www.kernel.org/doc/Documentation/CodingStyle ) .
318
+ * [ http://man.openbsd.org/style ] ( http://man.openbsd.org/style )
319
+
320
+ They are relatively similar but differ in details.
321
+
322
+ pimd deviates from Linux kernel style in using 2 spaces for indentation, with
323
+ Tabs replacing 8 spaces, as well as adding a line break between ` } ` and ` else ` .
324
+ It is acceptable to convert indentation in pimd/ to Linux kernel style, but
325
+ please convert an entire file at a time. (Rationale: apart from 2-space
326
+ indentation, the styles are sufficiently close to not upset when mixed.)
327
+
328
+ Unlike GNU style, these styles use tabs, not spaces.
329
+
263
330
264
331
### Compile-Time conditional code
265
332
@@ -307,4 +374,4 @@ of their debugs.
307
374
CLI's are a complicated ugly beast. Additions or changes to the CLI
308
375
should use a DEFUN to encapsulate one setting as much as is possible.
309
376
Additionally as new DEFUN's are added to the system, documentation
310
- should be provided for the new commands.
377
+ should be provided for the new commands.
0 commit comments