Skip to content

Commit

Permalink
doc: remove unnecessary macros
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 17, 2023
1 parent 1d3c908 commit 96a31d0
Show file tree
Hide file tree
Showing 21 changed files with 182 additions and 401 deletions.
2 changes: 1 addition & 1 deletion doc/README
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ In addition, for testing purposes ../utils/md2man.sh will generate a
preprocessed markdown file with the headers stripped off if the TESTOPTS
variable is set. For example:

$ export TESTOPTS="-DWIN32 -UFREEBSD -UWEB"
$ export TESTOPTS="-UWEB"
$ ../utils/md2man.sh libpmemobj/libpmemobj.7.md x libpmemobj.7.win.md

will generate a version of the libpmemobj.7 man page for Windows in markdown
Expand Down
27 changes: 12 additions & 15 deletions doc/libpmem/libpmem.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,18 @@ header: "pmem API version 1.1"
cc ... -lpmem
```

_UNICODE()

##### Library API versioning: #####

```c
_UWFUNC(pmem_check_version, =q=
const char *pmem_check_version(
unsigned major_required,
unsigned minor_required=e=)
unsigned minor_required);
```
##### Error handling: #####
```c
_UWFUNC(pmem_errormsg, void)
const char *pmem_errormsg(void);
```

##### Other library functions: #####
Expand Down Expand Up @@ -98,15 +96,14 @@ resources associated with that thread might not be cleaned up properly.
This section describes how the library API is versioned, allowing
applications to work with an evolving API.

The _UW(pmem_check_version) function is used to determine whether the installed
The **pmem_check_version**() function is used to determine whether the installed
**libpmem** supports the version of the library API required by an
application. The easiest way to do this is for the application to supply
the compile-time version information, supplied by defines in
**\<libpmem.h\>**, like this:

```c
reason = _U(pmem_check_version)(PMEM_MAJOR_VERSION,
PMEM_MINOR_VERSION);
reason = pmem_check_version(PMEM_MAJOR_VERSION, PMEM_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
Expand All @@ -124,10 +121,10 @@ in version 1.0 of the library. Interfaces added after version 1.0 will
contain the text *introduced in version x.y* in the section of this
manual describing the feature.

When the version check performed by _UW(pmem_check_version) is
When the version check performed by **pmem_check_version**() is
successful, the return value is NULL. Otherwise the return value is a
static string describing the reason for failing the version check. The
string returned by _UW(pmem_check_version) must not be modified or
string returned by **pmem_check_version**() must not be modified or
freed.

# ENVIRONMENT #
Expand Down Expand Up @@ -209,7 +206,7 @@ This variable is intended for use during library testing.
+ **PMEM_MMAP_HINT**=*val*

This environment variable allows overriding
the hint address used by _UW(pmem_map_file). If set, it also disables
the hint address used by **pmem_map_file**(). If set, it also disables
mapping address randomization. This variable is intended for use during
library testing and debugging. Setting it to some fairly large value
(i.e. 0x10000000000) will very likely result in mapping the file at the
Expand All @@ -230,7 +227,7 @@ place the mapping.

If an error is detected during the call to a **libpmem** function, the
application may retrieve an error message describing the reason of the failure
from _UW(pmem_errormsg). This function returns a pointer to a static buffer
from **pmem_errormsg**(). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
Expand Down Expand Up @@ -264,7 +261,7 @@ No log messages are emitted at this level.

+ **1** - Additional details on any errors detected are logged, in addition
to returning the *errno*-based errors as usual. The same information
may be retrieved using _UW(pmem_errormsg).
may be retrieved using **pmem_errormsg**().

+ **2** - A trace of basic operations is logged.

Expand Down Expand Up @@ -320,9 +317,9 @@ main(int argc, char *argv[])

/* create a pmem file and memory map it */

if ((pmemaddr = _U(pmem_map_file)(PATH, PMEM_LEN, PMEM_FILE_CREATE,
if ((pmemaddr = pmem_map_file(PATH, PMEM_LEN, PMEM_FILE_CREATE,
0666, &mapped_len, &is_pmem)) == NULL) {
perror("_U(pmem_map_file)");
perror("pmem_map_file");
exit(1);
}

Expand Down
2 changes: 0 additions & 2 deletions doc/libpmem/pmem_flush.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ else
/* ... */
```

_WINUX(,=q=
>WARNING:
On Linux, **pmem_msync**() and **msync**(2) have no effect on memory ranges
mapped from Device DAX. In case of memory ranges where **pmem_is_pmem**(3)
returns true use **pmem_persist**() to force the changes to be stored durably
in persistent memory.
=e=)

The **pmem_flush**() and **pmem_drain**() functions provide
partial versions of the **pmem_persist**() function.
Expand Down
26 changes: 12 additions & 14 deletions doc/libpmem/pmem_is_pmem.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ header: "pmem API version 1.1"

# NAME #

**pmem_is_pmem**(), _UW(pmem_map_file),
**pmem_is_pmem**(), **pmem_map_file**(),
**pmem_unmap**() - check persistency, create and delete mappings

# SYNOPSIS #
Expand All @@ -33,13 +33,11 @@ header: "pmem API version 1.1"
#include <libpmem.h>

int pmem_is_pmem(const void *addr, size_t len);
_UWFUNCR1(void, *pmem_map_file, *path, =q=size_t len, int flags,
mode_t mode, size_t *mapped_lenp, int *is_pmemp=e=)
void *pmem_map_file(const char *path, size_t len, int flags,
mode_t mode, size_t *mapped_lenp, int *is_pmemp);
int pmem_unmap(void *addr, size_t len);
```
_UNICODE()
# DESCRIPTION #
Most pmem-aware applications will take advantage of higher level
Expand All @@ -61,14 +59,14 @@ save the result, and use the saved result to determine whether
persistence. Calling **pmem_is_pmem**() each time changes are flushed to
persistence will not perform well.
The _UW(pmem_map_file) function creates a new read/write mapping for a
The **pmem_map_file**() function creates a new read/write mapping for a
file. If **PMEM_FILE_CREATE** is not specified in *flags*, the entire existing
file *path* is mapped, *len* must be zero, and *mode* is ignored. Otherwise,
*path* is opened or created as specified by *flags* and *mode*, and *len*
must be non-zero. _UW(pmem_map_file) maps the file using **mmap**(2), but it
must be non-zero. **pmem_map_file**() maps the file using **mmap**(2), but it
also takes extra steps to make large page mappings more likely.
On success, _UW(pmem_map_file) returns a pointer to the mapped area. If
On success, **pmem_map_file**() returns a pointer to the mapped area. If
*mapped_lenp* is not NULL, the length of the mapping is stored into
\**mapped_lenp*. If *is_pmemp* is not NULL, a flag indicating whether the
mapped file is actual pmem, or if **msync**() must be used to flush writes
Expand All @@ -85,11 +83,11 @@ following file creation flags:
*mode* specifies the mode to use in case a new file is created (see
**creat**(2)).
The remaining flags modify the behavior of _UW(pmem_map_file) when
The remaining flags modify the behavior of **pmem_map_file**() when
**PMEM_FILE_CREATE** is specified.
+ **PMEM_FILE_EXCL** - If specified in conjunction with **PMEM_FILE_CREATE**,
and *path* already exists, then _UW(pmem_map_file) will fail with **EEXIST**.
and *path* already exists, then **pmem_map_file**() will fail with **EEXIST**.
Otherwise, has the same meaning as **O_EXCL** on **open**(2), which is
generally undefined.
Expand All @@ -112,7 +110,7 @@ The *path* can point to a Device DAX. In this case only the
both ignored. For Device DAX mappings, *len* must be equal to
either 0 or the exact size of the device.
To delete mappings created with _UW(pmem_map_file), use **pmem_unmap**().
To delete mappings created with **pmem_map_file**(), use **pmem_unmap**().
The **pmem_unmap**() function deletes all the mappings for the
specified address range, and causes further references to addresses
Expand All @@ -129,7 +127,7 @@ from **pmem_is_pmem**() means it is safe to use **pmem_persist**(3)
and the related functions to make changes durable for that memory
range. See also **CAVEATS**.
On success, _UW(pmem_map_file) returns a pointer to the memory-mapped region
On success, **pmem_map_file**() returns a pointer to the memory-mapped region
and sets \**mapped_lenp* and \**is_pmemp* if they are not NULL.
On error, it returns NULL, sets *errno* appropriately, and does not modify
\**mapped_lenp* or \**is_pmemp*.
Expand All @@ -147,11 +145,11 @@ on Filesystem DAX.
# CAVEATS #
The result of **pmem_is_pmem**() query is only valid for the mappings
created using _UW(pmem_map_file). For other memory regions, in particular
created using **pmem_map_file**(). For other memory regions, in particular
those created by a direct call to **mmap**(2), **pmem_is_pmem**() always
returns false, even if the queried range is entirely persistent memory.
Not all file systems support **posix_fallocate**(3). _UW(pmem_map_file) will
Not all file systems support **posix_fallocate**(3). **pmem_map_file**() will
fail if **PMEM_FILE_CREATE** is specified without **PMEM_FILE_SPARSE** and
the underlying file system does not support **posix_fallocate**(3).
Expand Down
2 changes: 1 addition & 1 deletion doc/libpmem2/libpmem2.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ No log messages are emitted at this level.

+ **1** - Additional details on any errors detected are logged, in addition
to returning the *errno*-based errors as usual. The same information
may be retrieved using _UW(pmem2_errormsg).
may be retrieved using **pmem2_errormsg**().

+ **2** - A trace of basic operations is logged.

Expand Down
10 changes: 4 additions & 6 deletions doc/libpmem2/pmem2_errormsg.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,21 @@ header: "pmem2 API version 1.0"

# NAME #

_UW(pmem2_errormsg) - returns last error message
**pmem2_errormsg**() - returns last error message

# SYNOPSIS #

```c
#include <libpmem2.h>

_UWFUNC(pmem2_errormsg, void)
const char *pmem2_errormsg(void);
```
_UNICODE()
# DESCRIPTION #
If an error is detected during the call to a **libpmem2**(7) function, the
application may retrieve an error message describing the reason of the failure
from _UW(pmem2_errormsg). The error message buffer is thread-local;
from **pmem2_errormsg**(). The error message buffer is thread-local;
errors encountered in one thread do not affect its value in
other threads. The buffer is never cleared by any library function; its
content is significant only when the return value of the immediately preceding
Expand All @@ -47,7 +45,7 @@ Subsequent calls to other library functions may modify the previous message.
# RETURN VALUE #
The _UW(pmem2_errormsg) function returns a pointer to a static buffer
The **pmem2_errormsg**() function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3).
Expand Down
12 changes: 5 additions & 7 deletions doc/libpmem2/pmem2_perror.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,24 @@ header: "pmem2 API version 1.0"

# NAME #

_UW(pmem2_perror) - prints a descriptive error message to stderr
**pmem2_perror**() - prints a descriptive error message to stderr

# SYNOPSIS #

```c
#include <libpmem2.h>

_UWFUNCR1(void, pmem2_perror, *format, ...)
void pmem2_perror(const char *format, ...);
```
_UNICODE()
# DESCRIPTION #
The _UW(pmem2_perror) function produces a message on standard error stream describing
The **pmem2_perror**() function produces a message on standard error stream describing
the last error encountered during library call.
_UW(pmem2_perror) takes a variable number of arguments. First, the argument string
**pmem2_perror**() takes a variable number of arguments. First, the argument string
*format* is printed - similarly to the **printf**(3), followed by a colon and a blank.
Then an error message retrieved from the _UW(pmem2_errormsg), and a new-line. To see
Then an error message retrieved from the **pmem2_errormsg**(), and a new-line. To see
how the error message is generated, please see **pmem2_errormsg**(3).
# SEE ALSO #
Expand Down
26 changes: 12 additions & 14 deletions doc/libpmemobj/libpmemobj.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,15 @@ header: "pmemobj API version 2.3"

```c
#include <libpmemobj.h>
cc _WINUX(,-std=gnu99) ... -lpmemobj -lpmem
cc -std=gnu99 ... -lpmemobj -lpmem
```
_UNICODE()

##### Library API versioning: #####

```c
_UWFUNC(pmemobj_check_version, =q=
const char *pmemobj_check_version(
unsigned major_required,
unsigned minor_required=e=)
unsigned minor_required);
```
##### Managing library behavior: #####
Expand All @@ -56,7 +55,7 @@ void pmemobj_set_funcs(
##### Error handling: #####

```c
_UWFUNC(pmemobj_errormsg, void)
const char *pmemobj_errormsg(void);
```
##### Other library functions: #####
Expand Down Expand Up @@ -106,8 +105,8 @@ builds on this type of memory mapped file using the low-level pmem support
provided by **libpmem**(7), handling the transactional updates, flushing
changes to persistence, and managing recovery for the application.
_WINUX(,=q=**libpmemobj** requires the **-std=gnu99** compilation flag to
build properly.=e=)
**libpmemobj** requires the **-std=gnu99** compilation flag to
build properly.
**libpmemobj** is one of a collection of persistent memory libraries available.
The other is **libpmem**(7), low-level persistent memory support.
Expand All @@ -122,15 +121,14 @@ below.
This section describes how the library API is versioned,
allowing applications to work with an evolving API.
The _UW(pmemobj_check_version) function is used to see if the installed
The **pmemobj_check_version**() function is used to see if the installed
**libpmemobj** supports the version of the library API required by an
application. The easiest way to do this is for the application to supply
the compile-time version information, supplied by defines in
**\<libpmemobj.h\>**, like this:
```c
reason = _U(pmemobj_check_version)(PMEMOBJ_MAJOR_VERSION,
PMEMOBJ_MINOR_VERSION);
reason = pmemobj_check_version(PMEMOBJ_MAJOR_VERSION, PMEMOBJ_MINOR_VERSION);
if (reason != NULL) {
/* version check failed, reason string tells you why */
}
Expand All @@ -147,9 +145,9 @@ interfaces described here are available in version 1.0 of the library. Interface
added after version 1.0 will contain the text *introduced in version x.y* in
the section of this manual describing the feature.

On success, _UW(pmemobj_check_version) returns NULL. Otherwise, the return
On success, **pmemobj_check_version**() returns NULL. Otherwise, the return
value is a static string describing the reason the version check failed. The
string returned by _UW(pmemobj_check_version) must not be modified or freed.
string returned by **pmemobj_check_version**() must not be modified or freed.

# MANAGING LIBRARY BEHAVIOR #

Expand All @@ -168,7 +166,7 @@ desired limit.

If an error is detected during the call to a **libpmemobj** function, the
application may retrieve an error message describing the reason for the failure
from _UW(pmemobj_errormsg). This function returns a pointer to a static buffer
from **pmemobj_errormsg**(). This function returns a pointer to a static buffer
containing the last error message logged for the current thread. If *errno*
was set, the error message may include a description of the corresponding
error code as returned by **strerror**(3). The error message buffer is
Expand Down Expand Up @@ -202,7 +200,7 @@ No log messages are emitted at this level.

+ **1** - Additional details on any errors detected are logged,
in addition to returning the *errno*-based errors as usual.
The same information may be retrieved using _UW(pmemobj_errormsg).
The same information may be retrieved using **pmemobj_errormsg**().

+ **2** - A trace of basic operations is logged.

Expand Down
6 changes: 2 additions & 4 deletions doc/libpmemobj/oid_is_null.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ header: "pmemobj API version 2.3"
[SYNOPSIS](#synopsis)<br />
[DESCRIPTION](#description)<br />
[RETURN VALUE](#return-value)<br />
_WINUX(,[NOTES](#notes)<br />)
[NOTES](#notes)<br />
[SEE ALSO](#see-also)<br />

# NAME #
Expand Down Expand Up @@ -148,14 +148,12 @@ contains the object represented by *oid*. If the pool is not open or
The **pmemobj_pool_by_ptr**() function returns a handle to the pool that
contains the address, or NULL if the address does not belong to any open pool.
_WINUX(,=q=
# NOTES #
For performance reasons the **pmemobj_direct**() function is inlined by default.
To use the non-inlined variant of **pmemobj_direct**(),
define **PMEMOBJ_DIRECT_NON_INLINE** prior to the *\#include* of **\<libpmemobj.h\>**,
either with *\#define* or with the *\-D* option to the compiler.=e=)
either with *\#define* or with the *\-D* option to the compiler.
# EXAMPLES #
Expand Down
Loading

0 comments on commit 96a31d0

Please sign in to comment.