mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-09-13 21:21:12 +00:00
5d86c616a8
Make (format as) bcache backing device (-B) and cache device (-C) and implicitly attach the backing device to the cache to enable caching, all in one. # bcache make -B /dev/sdb1 -C /dev/sdc1 # bcache show Name Type State Bname AttachToDev /dev/sdb1 1 (data) clean(running) bcache0 /dev/sdc1 /dev/sdc1 3 (cache) active N/A N/A After experimenting with 'bcache unregister', 'bcache register' and stracing 'bcache show' the bcache kernel module creates the sysfs directory /sys/block/DEV[/PTN]/bcache and it's contents only when the bcache device is registered with the kernel (bcache component is active). Use this to identify whether any bcache device (component) should be displayed as active or not in GParted. # ls -ld /sys/block/sd?/sd?1/bcache drwxr-xr-x. 6 root root 0 Jan 7 10:08 /sys/block/sdb/sdb1/bcache drwxr-xr-x. 2 root root 0 Jan 7 10:08 /sys/block/sdc/sdc1/bcache Closes #183 - Basic support for bcache
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
/* Copyright (C) 2022 Mike Fleetwood
|
|
*
|
|
* 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
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
/* BCache_Info
|
|
*
|
|
* Simple module to query very basic information about bcache devices
|
|
* (components). No caching is performed by this module.
|
|
*/
|
|
|
|
#ifndef GPARTED_BCACHE_INFO_H
|
|
#define GPARTED_BCACHE_INFO_H
|
|
|
|
|
|
#include <glibmm/ustring.h>
|
|
|
|
|
|
namespace GParted
|
|
{
|
|
|
|
|
|
class BCache_Info
|
|
{
|
|
public:
|
|
static bool is_active(const Glib::ustring& device_path, const Glib::ustring& partition_path);
|
|
};
|
|
|
|
|
|
} //GParted
|
|
|
|
#endif /* GPARTED_BCACHE_INFO_H */
|