aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCyril Hrubis <chrubis@suse.cz>2019-08-16 14:24:20 +0200
committerCyril Hrubis <chrubis@suse.cz>2019-09-02 14:23:01 +0200
commit2c56551ca69ca6fa04c036ff6721820b4c2ed0e9 (patch)
treefca096056d9bd9748d589ae5436869254cdfe49a /include
parentf5de447bc059f7208084b7017d7774409d8da69b (diff)
downloadplatform_external_ltp-2c56551ca69ca6fa04c036ff6721820b4c2ed0e9.tar.gz
platform_external_ltp-2c56551ca69ca6fa04c036ff6721820b4c2ed0e9.tar.bz2
platform_external_ltp-2c56551ca69ca6fa04c036ff6721820b4c2ed0e9.zip
lib/tst_device: Export more functions.
Export tst_attach_device() and tst_deteach_device() which will be later on used by a kernel netlink uevent tests. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Reviewed-by: Clemens Famulla-Conrad <cfamullaconrad@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/tst_device.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/include/tst_device.h b/include/tst_device.h
index f0ddc3e93..56835e712 100644
--- a/include/tst_device.h
+++ b/include/tst_device.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) 2016-2019 Cyril Hrubis <chrubis@suse.cz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,6 +50,24 @@ int tst_clear_device(const char *dev);
*
*/
int tst_find_free_loopdev(const char *path, size_t path_len);
+
+/*
+ * Attaches a file to a loop device.
+ *
+ * @dev_path Path to the loop device e.g. /dev/loop0
+ * @file_path Path to a file e.g. disk.img
+ * @return Zero on success, non-zero otherwise.
+ */
+int tst_attach_device(const char *dev_path, const char *file_path);
+
+/*
+ * Detaches a file from a loop device.
+ *
+ * @dev_path Path to the loop device e.g. /dev/loop0
+ * @return Zero on succes, non-zero otherwise.
+ */
+int tst_detach_device(const char *dev_path);
+
/*
* Reads test block device stat file and returns the bytes written since the
* last call of this function.