($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] doc: libltpswap: Add kerneldoc
Date: Fri, 26 Apr 2024 06:28:51 +0200	[thread overview]
Message-ID: <20240426042851.333269-1-pvorel@suse.cz> (raw)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/developers/api_c_tests.rst |  4 +++
 include/libswap.h              | 61 +++++++++++++++++++++++++++-------
 2 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/doc/developers/api_c_tests.rst b/doc/developers/api_c_tests.rst
index 2c0c8419d..ec53ab33c 100644
--- a/doc/developers/api_c_tests.rst
+++ b/doc/developers/api_c_tests.rst
@@ -31,3 +31,7 @@ Capabilities
 ------------
 
 .. kernel-doc:: ../../include/tst_capability.h
+
+libltpswap
+----------
+.. kernel-doc:: ../../include/libswap.h
diff --git a/include/libswap.h b/include/libswap.h
index f757073cc..681849166 100644
--- a/include/libswap.h
+++ b/include/libswap.h
@@ -1,11 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
+ * Copyright (c) Linux Test Project, 2021-2024
  * Author: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
  */
 
 /*
- * Contains common content for all swapon/swapoff tests
+ * Contains common content for all swapon/swapoff tests.
  */
 
 #ifndef __LIBSWAP_H__
@@ -27,60 +28,96 @@ int make_swapfile(const char *file, const int lineno,
 #define MINIMAL_SWAP_SIZE_MB 1
 
 /**
- * Macro to create minimal swapfile.
+ * MAKE_SMALL_SWAPFILE - create small swap file.
+ *
+ * Macro to create small small swap file. Size defined with MINIMAL_SWAP_SIZE_MB.
+ *
+ * @swapfile: swap filename.
  */
 #define MAKE_SMALL_SWAPFILE(swapfile) \
     make_swapfile(__FILE__, __LINE__, swapfile, MINIMAL_SWAP_SIZE_MB, 0, \
 		  SWAPFILE_BY_SIZE)
 
 /**
- * Macro to create minimal swapfile.
+ * SAFE_MAKE_SMALL_SWAPFILE - create small swap file (safe version).
+ *
+ * Macro to create small small swap file. Size defined with MINIMAL_SWAP_SIZE_MB.
  * Includes safety checks to handle potential errors.
+ *
+ * @swapfile: swap filename.
  */
 #define SAFE_MAKE_SMALL_SWAPFILE(swapfile) \
     make_swapfile(__FILE__, __LINE__, swapfile, MINIMAL_SWAP_SIZE_MB, 1, \
 		  SWAPFILE_BY_SIZE)
 
 /**
- * Macro to create swapfile size in megabytes (MB).
+ * MAKE_SWAPFILE_SIZE - create swap file (MB).
+ *
+ * Macro to create swap file, size specified in megabytes (MB).
+ *
+ * @swapfile: swap filename.
+ * @size: swap size in MB.
  */
 #define MAKE_SWAPFILE_SIZE(swapfile, size) \
     make_swapfile(__FILE__, __LINE__, swapfile, size, 0, SWAPFILE_BY_SIZE)
 
 /**
- * Macro to create swapfile size in block numbers.
+ * MAKE_SWAPFILE_BLKS - create swap file (blocks).
+ *
+ * Macro to create swap file, size specified in block numbers.
+ *
+ * @swapfile: swap filename.
+ * @blocks: number of blocks.
  */
 #define MAKE_SWAPFILE_BLKS(swapfile, blocks) \
     make_swapfile(__FILE__, __LINE__, swapfile, blocks, 0, SWAPFILE_BY_BLKS)
 
 /**
- * Macro to safely create swapfile size in megabytes (MB).
+ * SAFE_MAKE_SWAPFILE_SIZE - create swap file (MB, safe version).
+ *
+ * Macro to safely create swap file, size specified in megabytes (MB).
  * Includes safety checks to handle potential errors.
+ *
+ * @swapfile: swap file name.
+ * @size: swap size in MB.
  */
 #define SAFE_MAKE_SWAPFILE_SIZE(swapfile, size) \
     make_swapfile(__FILE__, __LINE__, swapfile, size, 1, SWAPFILE_BY_SIZE)
 
 /**
- * Macro to safely create swapfile size in block numbers.
+ * SAFE_MAKE_SWAPFILE_BLKS - create swap file (block, safe version)
+ *
+ * Macro to safely create swap file, size specified in block numbers.
  * Includes safety checks to handle potential errors.
+ *
+ * @swapfile: swap file name.
+ * @blocks: number of blocks.
  */
 #define SAFE_MAKE_SWAPFILE_BLKS(swapfile, blocks) \
     make_swapfile(__FILE__, __LINE__, swapfile, blocks, 1, SWAPFILE_BY_BLKS)
 
-/*
+/**
+ * is_swap_supported() - Check swapon/swapoff support.
+ *
  * Check swapon/swapoff support status of filesystems or files
  * we are testing on.
+ *
+ * @filename: swap file name.
+ * Return: true if swap is supported, false if not.
  */
 bool is_swap_supported(const char *filename);
 
-/*
- * Get kernel constant MAX_SWAPFILES value.
+/**
+ * tst_max_swapfiles() - Get kernel constant MAX_SWAPFILES value.
  *
+ * Return: MAX_SWAPFILES value.
  */
 int tst_max_swapfiles(void);
 
-/*
- * Get the used swapfiles number.
+/**
+ * tst_count_swaps() - Get the used swapfiles number.
+ *
+ * Return: used swapfiles number.
  */
 int tst_count_swaps(void);
 
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2024-04-26  4:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  4:28 Petr Vorel [this message]
2024-04-26  7:43 ` [LTP] [PATCH 1/1] doc: libltpswap: Add kerneldoc Andrea Cervesato via ltp
2024-04-26  8:30   ` Li Wang
2024-04-26 18:25     ` Petr Vorel
2024-05-07  8:28       ` Andrea Cervesato via ltp
2024-05-07  8:31         ` Petr Vorel
2024-04-26 18:28   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240426042851.333269-1-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).