2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2020-08-20 22:42:19 +02:00
|
|
|
*
|
2020-05-30 16:15:03 +02:00
|
|
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
2020-08-20 22:42:19 +02:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2019-06-19 12:14:49 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2019-06-19 12:14:49 +02:00
|
|
|
*
|
2020-05-30 16:15:03 +02:00
|
|
|
*
|
2019-06-19 12:14:49 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PARTITION_SYNC_H
|
|
|
|
#define PARTITION_SYNC_H
|
|
|
|
|
2020-12-22 16:03:51 +01:00
|
|
|
#include "DllMacro.h"
|
|
|
|
|
2019-06-19 12:14:49 +02:00
|
|
|
namespace CalamaresUtils
|
|
|
|
{
|
|
|
|
namespace Partition
|
|
|
|
{
|
|
|
|
|
|
|
|
/** @brief Run "udevadm settle" or other disk-sync mechanism.
|
|
|
|
*
|
|
|
|
* Call this after mounting, unmount, toggling swap, or other functions
|
|
|
|
* that might cause the disk to be "busy" for other disk-modifying
|
|
|
|
* actions (in particular, KPMcore actions with the sfdisk backend
|
|
|
|
* are sensitive, and systemd tends to keep disks busy after a change
|
|
|
|
* for a while).
|
|
|
|
*/
|
2020-12-22 16:03:51 +01:00
|
|
|
DLLEXPORT void sync();
|
2019-06-19 12:14:49 +02:00
|
|
|
|
|
|
|
/** @brief RAII class for calling sync() */
|
2020-12-22 16:03:51 +01:00
|
|
|
struct DLLEXPORT Syncer
|
2019-06-19 12:14:49 +02:00
|
|
|
{
|
2019-06-20 13:53:02 +02:00
|
|
|
~Syncer() { sync(); }
|
2019-06-19 12:14:49 +02:00
|
|
|
};
|
|
|
|
|
2019-06-20 13:53:02 +02:00
|
|
|
} // namespace Partition
|
|
|
|
} // namespace CalamaresUtils
|
2019-06-19 12:14:49 +02:00
|
|
|
|
|
|
|
#endif
|