Add bcachefs label and UUID reading (!123)
Add reading of the bcachefs file system label, not the per device label, and the external UUID. These match what blkid reports. Example without a label: # bcachefs format /dev/sdb1 # bcachefs show-super /dev/sdb1 | egrep -i 'Label:|UUID:|Device:' External UUID: 3316bc9a-d129-42b6-a80e-9649874bca73 Internal UUID: 656eebe5-10a9-4f12-94c8-aab2fdc54732 Label: Device: 0 Label: (none) UUID: cd436a8d-82eb-4993-a317-b39ea0d6bd2e # blkid /dev/sdb1 /dev/sdb1: UUID="3316bc9a-d129-42b6-a80e-9649874bca73" BLOCK_SIZE="512" UUID_SUB="cd436a8d-82eb-4993-a317-b39ea0d6bd2e" TYPE="bcachefs" PARTUUID="7962e584-34c9-4088-8a00-a651af517089" Example with a label: # bcachefs format --force -L 'test label' /dev/sdb1 # bcachefs show-super /dev/sdb1 | egrep -i 'Label:|UUID:|Device:' External UUID: 3d7bdabe-2616-4545-affc-1aba0f8fb4a7 Internal UUID: 9cc95d3e-7991-4f78-9dd0-850cb9749e34 Label: test label Device: 0 Label: (none) UUID: 784d1bd0-5769-4fbb-ad32-07894d381bba # blkid /dev/sdb1 /dev/sdb1: UUID="3d7bdabe-2616-4545-affc-1aba0f8fb4a7" LABEL="test label" BLOCK_SIZE="512" UUID_SUB="784d1bd0-5769-4fbb-ad32-07894d381bba" TYPE="bcachefs" PARTUUID="7962e584-34c9-4088-8a00-a651af517089" Closes !123 - Add support for bcachefs, single device file systems only
This commit is contained in:
parent
14aab8a26f
commit
a7f9ce3fc7
|
@ -34,6 +34,8 @@ public:
|
|||
FS get_filesystem_support();
|
||||
void set_used_sectors(Partition& partition);
|
||||
bool create(const Partition& new_partition, OperationDetail& operationdetail);
|
||||
void read_label(Partition& partition);
|
||||
void read_uuid(Partition& partition);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ FS bcachefs::get_filesystem_support()
|
|||
fs.online_read = FS::EXTERNAL;
|
||||
fs.create = FS::EXTERNAL;
|
||||
fs.create_with_label = FS::EXTERNAL;
|
||||
fs.read_label = FS::EXTERNAL;
|
||||
fs.read_uuid = FS::EXTERNAL;
|
||||
}
|
||||
|
||||
fs_limits.min_size = 32 * MEBIBYTE;
|
||||
|
@ -95,4 +97,38 @@ bool bcachefs::create(const Partition& new_partition, OperationDetail& operation
|
|||
}
|
||||
|
||||
|
||||
void bcachefs::read_label(Partition& partition)
|
||||
{
|
||||
exit_status = Utils::execute_command("bcachefs show-super " + Glib::shell_quote(partition.get_path()),
|
||||
output, error, true);
|
||||
if (exit_status != 0)
|
||||
{
|
||||
if (! output.empty())
|
||||
partition.push_back_message(output);
|
||||
if (! error.empty())
|
||||
partition.push_back_message(error);
|
||||
return;
|
||||
}
|
||||
|
||||
partition.set_filesystem_label(Utils::regexp_label(output, "^Label:[[:blank:]]*(.*)$"));
|
||||
}
|
||||
|
||||
|
||||
void bcachefs::read_uuid(Partition& partition)
|
||||
{
|
||||
exit_status = Utils::execute_command("bcachefs show-super " + Glib::shell_quote(partition.get_path()),
|
||||
output, error, true);
|
||||
if (exit_status != 0)
|
||||
{
|
||||
if (! output.empty())
|
||||
partition.push_back_message(output);
|
||||
if (! error.empty())
|
||||
partition.push_back_message(error);
|
||||
return;
|
||||
}
|
||||
|
||||
partition.uuid = Utils::regexp_label(output, "^External UUID: *(" RFC4122_NONE_NIL_UUID_REGEXP ")");
|
||||
}
|
||||
|
||||
|
||||
} //GParted
|
||||
|
|
Loading…
Reference in New Issue