summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBrett Holman <bpholman5@gmail.com>2021-07-05 23:44:37 -0600
committerBrett Holman <bpholman5@gmail.com>2021-07-06 00:15:44 -0600
commitb916af97dd82b3321e54e34a92fe72909db6c6a8 (patch)
tree0c9dfe2f21d6e7ebf4de19953ac7c4e899548695 /doc
parent07ec713e056a73337bc0f53f5910f5179537b2c2 (diff)
Switched documentation from asciidoc to rst, added doc autogeneration code for options
Diffstat (limited to 'doc')
-rw-r--r--doc/autogen/bcachefs.5.rst (renamed from doc/bcachefs.5.txt)46
-rw-r--r--doc/autogen/gen.h18
-rwxr-xr-xdoc/autogen/gen.sh15
3 files changed, 61 insertions, 18 deletions
diff --git a/doc/bcachefs.5.txt b/doc/autogen/bcachefs.5.rst
index 291e2e35..6ba763b7 100644
--- a/doc/bcachefs.5.txt
+++ b/doc/autogen/bcachefs.5.rst
@@ -1,21 +1,23 @@
-BCACHEFS(5)
-===========
+========
+bcachefs
+========
-NAME
-----
-bcachefs - bcachefs overview, user's manual and configuration
+--------------------------------------------------
+bcachefs overview, user's manual and configuration
+--------------------------------------------------
+:Manual section: 5
DESCRIPTION
-----------
Bcachefs is a multi device copy on write filesystem that supports
- Checksumming
- Compression
- Encryption
- Reflink
- Caching
- Replication
- Erasure coding (reed-solomon)
+- Checksumming
+- Compression
+- Encryption
+- Reflink
+- Caching
+- Replication
+- Erasure coding (reed-solomon)
And more. This document is intended to be an overview of the various features
and use cases.
@@ -31,8 +33,10 @@ set on individual files and directories, via the bcachefs setattr command (which
internally mostly works via the extended attribute interface, but the setattr
command takes care to propagate options to children correctly).
- * TODO: include master list of options from opts.h
-#include "opts.mdwn"
+.. csv-table:: Options
+ :file: gen.csv
+ :header-rows: 1
+ :delim: ;
Device management
-----------------
@@ -58,6 +62,8 @@ group.
For example, given disks formatted with these labels:
+.. code-block:: bash
+
bcachefs format -g controller1.hdd.hdd1 /dev/sda \
-g controller1.hdd.hdd2 /dev/sdb \
-g controller1.ssd.ssd1 /dev/sdc \
@@ -73,9 +79,9 @@ Data placement, caching
The following options control which disks data is written to:
- * foreground_target
- * background_target
- * promote_target
+- foreground_target
+- background_target
+- promote_target
The foreground_target option is used to direct writes from applications. The
background_target option, if set, will cause data to be moved to that target in
@@ -86,7 +92,9 @@ a cached copy of the data being read to that target, if it doesn't exist.
Together, these options can be used for writeback caching, like so:
- foregroud_target=ssd
+.. code-block:: bash
+
+ foreground_target=ssd
background_target=hdd
promote_target=ssd
@@ -97,6 +105,8 @@ per-file options. This is done by setting the device's durability to 0.
These options can all be set on individual files or directories. They can also
be used to pin a specific file or directory to a specific device or target:
+.. code-block:: bash
+
foreground_target=ssd
background_target=
promote_target=
diff --git a/doc/autogen/gen.h b/doc/autogen/gen.h
new file mode 100644
index 00000000..2a7e5001
--- /dev/null
+++ b/doc/autogen/gen.h
@@ -0,0 +1,18 @@
+#include "../../libbcachefs/opts.h"
+
+/**
+ * generate tables from definitions in opt.h
+ */
+
+#define NULL (null)
+
+FMT_START_SECTION
+
+FMT_START_LINE Name ; Data Type ; Type Description ; Description ; Usage Flag FMT_END_LINE
+
+#define x(_name, _shortopt, _type, _in_mem_type, _mode, _sb_opt, _idk1, _idk2)\
+ FMT_START_LINE _name ; _shortopt ; _idk1 ; _idk2 ; _type FMT_END_LINE
+ BCH_OPTS()
+#undef x
+
+FMT_END_SECTION
diff --git a/doc/autogen/gen.sh b/doc/autogen/gen.sh
new file mode 100755
index 00000000..ff9e64fe
--- /dev/null
+++ b/doc/autogen/gen.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Pull options from opts.h into a csv file for generating documentation
+
+$CC doc/autogen/gen.h -I libbcachefs -I include -E 2>/dev/null \
+ | sed -n '/FMT_START_SECTION/,/FMT_END_SECTION/p' \
+ | tr '\n' ' ' \
+ | sed -e 's/FMT_START_LINE/\n/g;' \
+ -e 's/FMT_END_LINE//g;' \
+ -e 's|\\n||g;' \
+ -e 's/"//g;' \
+ -e 's/OPT_//g;' \
+ -e 's/[ \t]*$//g' \
+ | grep -v -e FMT_START_SECTION -e FMT_END_SECTION \
+ > doc/autogen/gen.csv
+