Skip to content

Commit 703406b

Browse files
committed
doc: libltpswap: Add kerneldoc
Link: https://lore.kernel.org/ltp/[email protected]/ Reviewed-by: Li Wang <[email protected]> Reviewed-by: Andrea Cervesato <[email protected]> Signed-off-by: Petr Vorel <[email protected]>
1 parent b0343ad commit 703406b

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

doc/developers/api_c_tests.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ Capabilities
3131
------------
3232

3333
.. kernel-doc:: ../../include/tst_capability.h
34+
35+
libltpswap
36+
----------
37+
.. kernel-doc:: ../../include/libswap.h

include/libswap.h

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
/*
33
* Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
4+
* Copyright (c) Linux Test Project, 2021-2024
45
* Author: Stanislav Kholmanskikh <[email protected]>
56
*/
67

78
/*
8-
* Contains common content for all swapon/swapoff tests
9+
* Contains common content for all swapon/swapoff tests.
910
*/
1011

1112
#ifndef __LIBSWAP_H__
@@ -27,60 +28,96 @@ int make_swapfile(const char *file, const int lineno,
2728
#define MINIMAL_SWAP_SIZE_MB 1
2829

2930
/**
30-
* Macro to create minimal swapfile.
31+
* MAKE_SMALL_SWAPFILE - create small swap file.
32+
*
33+
* Macro to create small swap file. Size defined with MINIMAL_SWAP_SIZE_MB.
34+
*
35+
* @swapfile: swap filename.
3136
*/
3237
#define MAKE_SMALL_SWAPFILE(swapfile) \
3338
make_swapfile(__FILE__, __LINE__, swapfile, MINIMAL_SWAP_SIZE_MB, 0, \
3439
SWAPFILE_BY_SIZE)
3540

3641
/**
37-
* Macro to create minimal swapfile.
42+
* SAFE_MAKE_SMALL_SWAPFILE - create small swap file (safe version).
43+
*
44+
* Macro to create small swap file. Size defined with MINIMAL_SWAP_SIZE_MB.
3845
* Includes safety checks to handle potential errors.
46+
*
47+
* @swapfile: swap filename.
3948
*/
4049
#define SAFE_MAKE_SMALL_SWAPFILE(swapfile) \
4150
make_swapfile(__FILE__, __LINE__, swapfile, MINIMAL_SWAP_SIZE_MB, 1, \
4251
SWAPFILE_BY_SIZE)
4352

4453
/**
45-
* Macro to create swapfile size in megabytes (MB).
54+
* MAKE_SWAPFILE_SIZE - create swap file (MB).
55+
*
56+
* Macro to create swap file, size specified in megabytes (MB).
57+
*
58+
* @swapfile: swap filename.
59+
* @size: swap size in MB.
4660
*/
4761
#define MAKE_SWAPFILE_SIZE(swapfile, size) \
4862
make_swapfile(__FILE__, __LINE__, swapfile, size, 0, SWAPFILE_BY_SIZE)
4963

5064
/**
51-
* Macro to create swapfile size in block numbers.
65+
* MAKE_SWAPFILE_BLKS - create swap file (blocks).
66+
*
67+
* Macro to create swap file, size specified in block numbers.
68+
*
69+
* @swapfile: swap filename.
70+
* @blocks: number of blocks.
5271
*/
5372
#define MAKE_SWAPFILE_BLKS(swapfile, blocks) \
5473
make_swapfile(__FILE__, __LINE__, swapfile, blocks, 0, SWAPFILE_BY_BLKS)
5574

5675
/**
57-
* Macro to safely create swapfile size in megabytes (MB).
76+
* SAFE_MAKE_SWAPFILE_SIZE - create swap file (MB, safe version).
77+
*
78+
* Macro to safely create swap file, size specified in megabytes (MB).
5879
* Includes safety checks to handle potential errors.
80+
*
81+
* @swapfile: swap file name.
82+
* @size: swap size in MB.
5983
*/
6084
#define SAFE_MAKE_SWAPFILE_SIZE(swapfile, size) \
6185
make_swapfile(__FILE__, __LINE__, swapfile, size, 1, SWAPFILE_BY_SIZE)
6286

6387
/**
64-
* Macro to safely create swapfile size in block numbers.
88+
* SAFE_MAKE_SWAPFILE_BLKS - create swap file (block, safe version)
89+
*
90+
* Macro to safely create swap file, size specified in block numbers.
6591
* Includes safety checks to handle potential errors.
92+
*
93+
* @swapfile: swap file name.
94+
* @blocks: number of blocks.
6695
*/
6796
#define SAFE_MAKE_SWAPFILE_BLKS(swapfile, blocks) \
6897
make_swapfile(__FILE__, __LINE__, swapfile, blocks, 1, SWAPFILE_BY_BLKS)
6998

70-
/*
99+
/**
100+
* is_swap_supported() - Check swapon/swapoff support.
101+
*
71102
* Check swapon/swapoff support status of filesystems or files
72103
* we are testing on.
104+
*
105+
* @filename: swap file name.
106+
* Return: true if swap is supported, false if not.
73107
*/
74108
bool is_swap_supported(const char *filename);
75109

76-
/*
77-
* Get kernel constant MAX_SWAPFILES value.
110+
/**
111+
* tst_max_swapfiles() - Get kernel constant MAX_SWAPFILES value.
78112
*
113+
* Return: MAX_SWAPFILES value.
79114
*/
80115
int tst_max_swapfiles(void);
81116

82-
/*
83-
* Get the used swapfiles number.
117+
/**
118+
* tst_count_swaps() - Get the used swapfiles number.
119+
*
120+
* Return: used swapfiles number.
84121
*/
85122
int tst_count_swaps(void);
86123

0 commit comments

Comments
 (0)