In data martedì 30 giugno 2015 19:23:08, Chen Hanxiao ha scritto:
btrfs-progs v4.1 add support to change uuid of btrfs fs.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
[...]
+# Setting btrfs UUID
+eval {
+ $g->set_uuid ("/dev/sda1",
"12345678-1234-1234-1234-123456789012");
+};
+
+my $err = $g->last_errno ();
+
+if ($@) {
$@ contains the last Perl error, so it's better to check for it right
after the eval block, otherwise other functions might change it.
Also, $err can be moved in the if block.
+ if ($err == Errno::ENOTSUP()) {
+ warn "$0: skipping test for btrfs UUID change feature is not
available";
+ } elsif ($err) {
"else" is enough here, as $err will surely be different than zero here
(otherwise we wouldn't be in this block).
Thanks,
--
Pino Toscano