@@ -21,12 +21,12 @@ libnvme:
2121## Build from source
2222
2323nvme-cli uses meson as its build system. There is more than one way to configure and
24- build the project in order to mitigate meson dependency on the build environment .
24+ build the project to accommodate environments with an older version of meson .
2525
2626If you build on a relatively modern system, either use meson directly or the
2727Makefile wrapper.
2828
29- Older distros might ship a too old version of meson. In this case, it's possible
29+ Older distros may ship an outdated version of meson. In this case, it's possible
3030to build the project using [ samurai] ( https://github.com/michaelforney/samurai )
3131and [ muon] ( https://github.com/annacrombie/muon ) . Both build tools have only a
3232minimal dependency on the build environment. To ease this step, there is a build
@@ -52,22 +52,30 @@ built as part of nvme-cli.
5252No special configuration is required for libnvme, as it is now part of the
5353nvme-cli source tree. Simply run:
5454
55- $ meson setup .build
55+ ``` shell
56+ $ meson setup .build
57+ ```
5658
57- With meson's --wrap-mode argument it's possible to control if additional
59+ With meson's ` --wrap-mode ` argument it's possible to control if additional
5860dependencies should be resolved. The options are:
5961
60- --wrap-mode {default,nofallback,nodownload,forcefallback,nopromote}
62+ ```
63+ --wrap-mode {default,nofallback,nodownload,forcefallback,nopromote}
64+ ```
6165
6266Note for nvme-cli the 'default' is set to nofallback.
6367
6468#### Building
6569
66- $ meson compile -C .build
70+ ``` shell
71+ $ meson compile -C .build
72+ ```
6773
6874#### Installing
6975
70- # meson install -C .build
76+ ``` shell
77+ # meson install -C .build
78+ ```
7179
7280### Build with build.sh wrapper
7381
@@ -79,11 +87,15 @@ default configuration (meson, gcc and defaults)
7987
8088It's possible to change the compiler to clang
8189
82- ` scripts/build.sh -c clang `
90+ ``` shell
91+ scripts/build.sh -c clang
92+ ```
8393
8494or enable all the fallbacks
8595
86- ` scripts/build.sh fallback `
96+ ``` shell
97+ scripts/build.sh fallback
98+ ```
8799
88100### Minimal static build with muon
89101
@@ -100,59 +112,77 @@ Furthermore, this configuration will produce a static binary.
100112
101113There is a Makefile wrapper for meson for backwards compatibility
102114
103- $ make
104- # make install
115+ ``` shell
116+ $ make
117+ # make install
118+ ```
105119
106120Note: In previous versions, libnvme needed to be installed by hand.
107121This is no longer required in nvme-cli 3.x and later.
108122
109123RPM build support via Makefile that uses meson
110124
111- $ make rpm
125+ ``` shell
126+ $ make rpm
127+ ```
112128
113129Static binary (no dependency) build support via Makefile that uses meson
114130
115- $ make static
131+ ``` shell
132+ $ make static
133+ ```
116134
117135If you are not sure how to use it, find the top-level documentation with:
118136
119- $ man nvme
137+ ``` shell
138+ $ man nvme
139+ ```
120140
121141Or find a short summary with:
122142
123- $ nvme help
143+ ``` shell
144+ $ nvme help
145+ ```
124146
125147### Building with specific plugins
126148
127149By default, all vendor plugins are built. To build only specific plugins, use the ` plugins ` option:
128150
129- $ meson setup .build -Dplugins=intel,wdc,ocp
130- $ meson compile -C .build
151+ ``` shell
152+ $ meson setup .build -Dplugins=intel,wdc,ocp
153+ $ meson compile -C .build
154+ ```
131155
132156Or with the Makefile wrapper:
133157
134- $ make PLUGINS="intel,wdc,ocp"
158+ ``` shell
159+ $ make PLUGINS=" intel,wdc,ocp"
160+ ```
135161
136162When ` PLUGINS ` is not used, the value defaults to ` all ` , which selects all plugins:
137163
138- $ make PLUGINS="all"
164+ ``` shell
165+ $ make PLUGINS=" all"
166+ ```
139167
140168To build without any vendor plugins:
141169
142- $ make PLUGINS=""
170+ ``` shell
171+ $ make PLUGINS=" "
172+ ```
143173
144174## Distro Support
145175
146176It is available on many popular distributions (Alpine, Arch, Debian, Fedora,
147177FreeBSD, Gentoo, Ubuntu, Nix(OS), openSUSE, ...) and the usual package name is
148178nvme-cli.
149179
150- #### OpenEmbedded/Yocto
180+ ### OpenEmbedded/Yocto
151181
152182An [ nvme-cli recipe] ( https://layers.openembedded.org/layerindex/recipe/88631/ )
153183is available as part of the ` meta-openembedded ` layer collection.
154184
155- #### Buildroot
185+ ### Buildroot
156186
157187` nvme-cli ` is available as a [ buildroot] ( https://buildroot.org ) package. The
158188package is named ` nvme ` .
@@ -201,7 +231,7 @@ to get going using the macros. To start, first create a header file
201231to define your plugin. This is where you will give your plugin a name,
202232description, and define all the sub-commands your plugin implements.
203233
204- There is a very important order on how to define the plugin . The following
234+ The macros must appear in a specific order within the header file . The following
205235is a basic example on how to start this:
206236
207237File: foo-plugin.h
@@ -218,7 +248,7 @@ PLUGIN(NAME("foo", "Foo plugin"),
218248 COMMAND_LIST(
219249 ENTRY("bar", "foo bar", bar)
220250 ENTRY("baz", "foo baz", baz)
221- ENTRY("qux", "foo quz ", qux)
251+ ENTRY("qux", "foo qux ", qux)
222252 )
223253);
224254
@@ -245,12 +275,11 @@ File: foo-plugin.c
245275After that, you just need to implement the functions you defined in each
246276ENTRY, then append the object file name to the meson.build "sources".
247277
248-
249278### Updating the libnvme accessor functions
250279
251280libnvme exposes a set of getter and setter functions (accessors) for its core
252- internal structs (` nvme_path ` , ` nvme_ns ` , ` nvme_ctrl ` , ` nvme_subsystem ` ,
253- ` nvme_host ` , ` nvme_fabric_options ` ). These are generated from the struct
281+ internal structs (` libnvme_path ` , ` libnvme_ns ` , ` libnvme_ctrl ` , ` libnvme_subsystem ` ,
282+ ` libnvme_host ` , ` libnvme_fabric_options ` ). These are generated from the struct
254283definitions in ` libnvme/src/nvme/private.h ` by the tool
255284` libnvme/src/nvme/generate-accessors.c ` .
256285
@@ -308,8 +337,8 @@ When `make update-accessors` detects that the symbol list has drifted from
308337WARNING: accessors.ld needs manual attention.
309338
310339 Symbols to ADD (place in a new version section, e.g. LIBNVME_ACCESSORS_X_Y):
311- nvme_ctrl_get_new_field
312- nvme_ctrl_set_new_field
340+ libnvme_ctrl_get_new_field
341+ libnvme_ctrl_set_new_field
313342```
314343
315344New symbols must be added to a ** new** version section that chains the
@@ -319,8 +348,8 @@ previous one. For example, if the current latest section is
319348```
320349LIBNVME_ACCESSORS_3_1 {
321350 global:
322- nvme_ctrl_get_new_field ;
323- nvme_ctrl_set_new_field ;
351+ libnvme_ctrl_get_new_field ;
352+ libnvme_ctrl_set_new_field ;
324353} LIBNVME_ACCESSORS_3_0;
325354```
326355
@@ -335,23 +364,21 @@ drifts silently.
335364
336365## Dependency
337366
338- libnvme depends on the /sys/class/nvme-subsystem interface which was
339- introduced in the Linux kernel release v4.15. Hence nvme-cli 2.x only works on
340- kernels >= v4.15. For older kernels nvme-cli 1.x is recommended to be used.
367+ libnvme depends on the ` /sys/class/nvme-subsystem ` interface which was
368+ introduced in Linux kernel v4.15. nvme-cli requires kernel v4.15 or later.
341369
342370## How to contribute
343371
344372There are two ways to send code changes to the project. The first one
345373is by sending the changes to
[email protected] . The
346374second one is by posting a pull request on Github. In both cases
347375please follow the Linux contributions guidelines as documented in
348-
349- https://docs.kernel.org/process/submitting-patches.html#
376+ [ Submitting patches] ( https://docs.kernel.org/process/submitting-patches.html ) .
350377
351378That means the changes should be a clean series (no merges should be
352379present in a Github PR for example) and every commit should build.
353380
354- See also https://opensource.com/article/19/7/create-pull-request-github
381+ See also [ How to create a pull request on GitHub ] ( https://opensource.com/article/19/7/create-pull-request-github ) .
355382
356383### How to clean up your series before creating a PR
357384
@@ -386,7 +413,7 @@ $ git rebase master
386413$ git push -u origin fix-something
387414```
388415
389- ## Persistent, volatile configuration
416+ ## Persistent and volatile configuration
390417
391418Persistent configurations can be stored in two different locations: either in
392419the file ` /etc/nvme/discovery.conf ` using the old style, or in the file
@@ -432,15 +459,13 @@ For example, a `blktests` volatile configuration could look like:
432459Note when updating the volatile configuration during runtime, it should be done
433460in an atomic way. For example, create a temporary file without the ` .json ` file
434461extension in ` /run/nvme ` and write the contents to this file. When finished, use
435- ` rename ` to add the ` ' .json' ` file name extension. This ensures nvme-cli only
462+ ` rename ` to add the ` .json ` file name extension. This ensures nvme-cli only
436463sees the complete file.
437464
438465## Testing
439466
440467For testing purposes, an x86_64 static build from the current HEAD is available
441- here:
442-
443- https://monom.org/linux-nvme/upload/nvme-cli-latest-x86_64
468+ [ here] ( https://monom.org/linux-nvme/upload/nvme-cli-latest-x86_64 ) .
444469
445470## Container-Based Debugging and CI Build Reproduction
446471
@@ -449,16 +474,16 @@ reproduce GitHub Actions builds for debugging and development. These containers
449474mirror the environments used in the official CI workflows.
450475
451476CI Containers Repository:
452- https://github.com/linux-nvme/ci-containers
477+ [ linux-nvme/ci-containers ] ( https://github.com/linux-nvme/ci-containers )
453478
454479CI Build Workflow Reference:
455- https://github.com/linux-nvme/nvme-cli/blob/master/.github/workflows/libnvme-build.yml
480+ [ libnvme-build.yml ] ( https://github.com/linux-nvme/nvme-cli/blob/master/.github/workflows/libnvme-build.yml )
456481
457482### 1. Pull a CI Container
458483
459484All CI containers are published as OCI/Docker images.
460485
461- Example: Ubuntu latest CI image:
486+ Example: Debian latest CI image:
462487
463488``` bash
464489docker pull ghcr.io/linux-nvme/debian:latest
@@ -501,7 +526,7 @@ git clone https://github.com/linux-nvme/nvme-cli.git
501526cd nvme-cli
502527```
503528
504- (Optional) Checkout a specific branch or pull request:
529+ (Optional) Check out a specific branch or pull request:
505530
506531``` bash
507532git checkout < branch-or-commit>
0 commit comments