Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2022-05-09 18:43:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Mon May 9 18:43:35 2022 rev:164 rq:975335 version:4.5.10 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2022-05-05 23:05:57.237524385 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.1538/libstorage-ng.changes 2022-05-09 18:43:49.236187568 +0200 @@ -1,0 +2,8 @@ +Fri May 6 07:10:16 UTC 2022 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#874 +- added support for nilfs2 +- coding style +- 4.5.10 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.5.9.tar.xz New: ---- libstorage-ng-4.5.10.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.dFMzWm/_old 2022-05-09 18:43:49.828188262 +0200 +++ /var/tmp/diff_new_pack.dFMzWm/_new 2022-05-09 18:43:49.832188267 +0200 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.5.9 +Version: 4.5.10 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.5.9.tar.xz -> libstorage-ng-4.5.10.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/LIBVERSION new/libstorage-ng-4.5.10/LIBVERSION --- old/libstorage-ng-4.5.9/LIBVERSION 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/LIBVERSION 2022-05-06 09:10:16.000000000 +0200 @@ -1 +1 @@ -1.74.0 +1.75.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/VERSION new/libstorage-ng-4.5.10/VERSION --- old/libstorage-ng-4.5.9/VERSION 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/VERSION 2022-05-06 09:10:16.000000000 +0200 @@ -1 +1 @@ -4.5.9 +4.5.10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/bindings/storage-catches.i new/libstorage-ng-4.5.10/bindings/storage-catches.i --- old/libstorage-ng-4.5.9/bindings/storage-catches.i 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/bindings/storage-catches.i 2022-05-06 09:10:16.000000000 +0200 @@ -81,6 +81,7 @@ %catches(storage::NullPointerException) storage::is_msdos(const Device *device); %catches(storage::NullPointerException) storage::is_multipath(const Device *device); %catches(storage::NullPointerException) storage::is_nfs(const Device *device); +%catches(storage::NullPointerException) storage::is_nilfs2(const Device *device); %catches(storage::NullPointerException) storage::is_ntfs(const Device *device); %catches(storage::NullPointerException) storage::is_partition(const Device *device); %catches(storage::NullPointerException) storage::is_partition_table(const Device *device); @@ -179,6 +180,8 @@ %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_multipath(const Device *device); %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_nfs(Device *device); %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_nfs(const Device *device); +%catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_nilfs2(Device *device); +%catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_nilfs2(const Device *device); %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_ntfs(Device *device); %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_ntfs(const Device *device); %catches(storage::DeviceHasWrongType, storage::NullPointerException) storage::to_partition(Device *device); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/bindings/storage-downcast.i new/libstorage-ng-4.5.10/bindings/storage-downcast.i --- old/libstorage-ng-4.5.9/bindings/storage-downcast.i 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/bindings/storage-downcast.i 2022-05-06 09:10:16.000000000 +0200 @@ -46,6 +46,7 @@ storage::F2fs, storage::Iso9660, storage::Jfs, + storage::Nilfs2, storage::Ntfs, storage::Reiserfs, storage::Swap, @@ -97,6 +98,7 @@ const storage::F2fs, const storage::Iso9660, const storage::Jfs, + const storage::Nilfs2, const storage::Ntfs, const storage::Reiserfs, const storage::Swap, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/bindings/storage.deps new/libstorage-ng-4.5.10/bindings/storage.deps --- old/libstorage-ng-4.5.9/bindings/storage.deps 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/bindings/storage.deps 2022-05-06 09:10:16.000000000 +0200 @@ -54,6 +54,7 @@ ${top_srcdir}/storage/Filesystems/Ext3.h \ ${top_srcdir}/storage/Filesystems/Ext4.h \ ${top_srcdir}/storage/Filesystems/F2fs.h \ + ${top_srcdir}/storage/Filesystems/Nilfs2.h \ ${top_srcdir}/storage/Filesystems/Filesystem.h \ ${top_srcdir}/storage/Filesystems/Iso9660.h \ ${top_srcdir}/storage/Filesystems/Jfs.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/bindings/storage.i new/libstorage-ng-4.5.10/bindings/storage.i --- old/libstorage-ng-4.5.9/bindings/storage.i 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/bindings/storage.i 2022-05-06 09:10:16.000000000 +0200 @@ -83,6 +83,7 @@ #include "storage/Filesystems/Xfs.h" #include "storage/Filesystems/Jfs.h" #include "storage/Filesystems/F2fs.h" +#include "storage/Filesystems/Nilfs2.h" #include "storage/Filesystems/Swap.h" #include "storage/Filesystems/Iso9660.h" #include "storage/Filesystems/Udf.h" @@ -180,6 +181,7 @@ %include "../../storage/Filesystems/Xfs.h" %include "../../storage/Filesystems/Jfs.h" %include "../../storage/Filesystems/F2fs.h" +%include "../../storage/Filesystems/Nilfs2.h" %include "../../storage/Filesystems/Swap.h" %include "../../storage/Filesystems/Iso9660.h" %include "../../storage/Filesystems/Udf.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/doc/autodocs/doxygen.conf new/libstorage-ng-4.5.10/doc/autodocs/doxygen.conf --- old/libstorage-ng-4.5.9/doc/autodocs/doxygen.conf 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/doc/autodocs/doxygen.conf 2022-05-06 09:10:16.000000000 +0200 @@ -27,7 +27,7 @@ FILE_PATTERNS += Bitlocker.h BlkFilesystem.h Btrfs.h BtrfsSubvolume.h \ BtrfsQgroup.h BtrfsSubvolume.h Exfat.h Ext2.h Ext3.h Ext4.h Ext.h \ F2fs.h Filesystem.h Iso9660.h Jfs.h Mountable.h MountPoint.h Nfs.h \ - Ntfs.h Reiserfs.h Swap.h Tmpfs.h Udf.h Vfat.h Xfs.h + Nilfs2.h Ntfs.h Reiserfs.h Swap.h Tmpfs.h Udf.h Vfat.h Xfs.h INPUT += ../../storage/Holders FILE_PATTERNS += BtrfsQgroupRelation.h FilesystemUser.h Holder.h MdSubdevice.h \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/doc/status.md new/libstorage-ng-4.5.10/doc/status.md --- old/libstorage-ng-4.5.9/doc/status.md 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/doc/status.md 2022-05-06 09:10:16.000000000 +0200 @@ -138,8 +138,9 @@ Implemented: * For btrfs, ext2, ext3, ext4, ReiserFS, NTFS, VFat, ExFat, XFS, JFS, - swap, F2FS, ISO9660, UDF, NFS and tmpfs the most important operations - (probing, creating, deleting, resizing, mounting and unmounting). + swap, F2FS, NILFS2 (excluding checkpoints), ISO9660, UDF, NFS and + tmpfs the most important operations (probing, creating, deleting, + resizing, mounting and unmounting). * Handling of /etc/fstab. * Handling different mount-by options. * btrfs subvolumes, btrfs multiple-device, quota and qgroup support. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/integration-tests/filesystems/create-nilfs2.py new/libstorage-ng-4.5.10/integration-tests/filesystems/create-nilfs2.py --- old/libstorage-ng-4.5.9/integration-tests/filesystems/create-nilfs2.py 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.10/integration-tests/filesystems/create-nilfs2.py 2022-05-06 09:10:16.000000000 +0200 @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +# requirements: disk /dev/sdc with partition /dev/sdc1 + + +from storage import * +from storageitu import * + + +set_logger(get_logfile_logger()) + +environment = Environment(False) + +storage = Storage(environment) +storage.probe() + +staging = storage.get_staging() + +print(staging) + +partition = Partition.find_by_name(staging, "/dev/sdc1") +partition.set_id(ID_LINUX) + +nilfs2 = partition.create_blk_filesystem(FsType_NILFS2) +nilfs2.set_label("TEST") + +mount_point = nilfs2.create_mount_point("/test") + +print(staging) + +commit(storage) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystem.cc new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystem.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystem.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystem.cc 2022-05-06 09:10:16.000000000 +0200 @@ -24,7 +24,6 @@ #include "storage/Utils/StorageTmpl.h" #include "storage/Filesystems/BlkFilesystemImpl.h" #include "storage/Devicegraph.h" -#include "storage/Action.h" #include "storage/FindBy.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystem.h new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystem.h --- old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystem.h 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystem.h 2022-05-06 09:10:16.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2014-2015] Novell, Inc. - * Copyright (c) [2016-2021] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -69,7 +69,8 @@ const std::string& get_label() const; /** - * Set the filesystem label. + * Set the filesystem label. May not work if the filesystem is mounted (e.g. for + * swap). */ void set_label(const std::string& label); @@ -84,9 +85,9 @@ const std::string& get_uuid() const; /** - * Set the filesystem UUID. Only supported for btrfs, xfs, ext, reiserfs, jfs, udf - * and swap. In general the UUID is only set when creating a new filesystem on - * disk. + * Set the filesystem UUID. Only supported for btrfs, xfs, ext, reiserfs, jfs, + * udf, nilfs2 and swap. In general the UUID is only set when creating a new + * filesystem on disk. May not work if the filesystem is mounted (e.g. for swap). */ void set_uuid(const std::string& uuid); @@ -115,9 +116,9 @@ /** * Set extra options for the filesystem tune command. The * options are injected as-is to the command so must be - * properly quoted. + * properly quoted. May not work if the filesystem is mounted. * - * Only supported on Ext and Reiserfs. + * Only supported on Ext, Reiserfs and Nilfs2. */ void set_tune_options(const std::string& tune_options); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystemImpl.cc new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystemImpl.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/BlkFilesystemImpl.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/BlkFilesystemImpl.cc 2022-05-06 09:10:16.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2014-2015] Novell, Inc. - * Copyright (c) [2016-2021] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -192,7 +192,8 @@ fs_type != FsType::BTRFS && fs_type != FsType::REISERFS && fs_type != FsType::XFS && fs_type != FsType::SWAP && fs_type != FsType::NTFS && fs_type != FsType::VFAT && fs_type != FsType::ISO9660 && fs_type != FsType::UDF && fs_type != FsType::JFS && - fs_type != FsType::F2FS && fs_type != FsType::EXFAT && fs_type != FsType::BITLOCKER) + fs_type != FsType::F2FS && fs_type != FsType::NILFS2 &&fs_type != FsType::EXFAT && + fs_type != FsType::BITLOCKER) { y2err("detected unsupported filesystem " << toString(fs_type) << " on " << blk_device->get_name()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/BtrfsImpl.cc new/libstorage-ng-4.5.10/storage/Filesystems/BtrfsImpl.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/BtrfsImpl.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/BtrfsImpl.cc 2022-05-06 09:10:16.000000000 +0200 @@ -64,17 +64,14 @@ Btrfs::Impl::Impl() - : BlkFilesystem::Impl(), configure_snapper(false), snapper_config(nullptr), - metadata_raid_level(BtrfsRaidLevel::DEFAULT), data_raid_level(BtrfsRaidLevel::DEFAULT), - multi_device_resize_info() + : BlkFilesystem::Impl(), metadata_raid_level(BtrfsRaidLevel::DEFAULT), + data_raid_level(BtrfsRaidLevel::DEFAULT) { } Btrfs::Impl::Impl(const xmlNode* node) - : BlkFilesystem::Impl(node), configure_snapper(false), snapper_config(nullptr), - metadata_raid_level(BtrfsRaidLevel::UNKNOWN), data_raid_level(BtrfsRaidLevel::UNKNOWN), - multi_device_resize_info() + : BlkFilesystem::Impl(node) { string tmp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/BtrfsImpl.h new/libstorage-ng-4.5.10/storage/Filesystems/BtrfsImpl.h --- old/libstorage-ng-4.5.9/storage/Filesystems/BtrfsImpl.h 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/BtrfsImpl.h 2022-05-06 09:10:16.000000000 +0200 @@ -186,11 +186,11 @@ private: - bool configure_snapper; - SnapperConfig * snapper_config; + bool configure_snapper = false; + SnapperConfig* snapper_config = nullptr; - BtrfsRaidLevel metadata_raid_level; - BtrfsRaidLevel data_raid_level; + BtrfsRaidLevel metadata_raid_level = BtrfsRaidLevel::UNKNOWN; + BtrfsRaidLevel data_raid_level = BtrfsRaidLevel::UNKNOWN; bool quota = false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/ExtImpl.cc new/libstorage-ng-4.5.10/storage/Filesystems/ExtImpl.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/ExtImpl.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/ExtImpl.cc 2022-05-06 09:10:16.000000000 +0200 @@ -135,7 +135,7 @@ { const BlkDevice* blk_device = get_blk_device(); - string cmd_line = MKFS_EXT2_BIN " -t " + toString(get_type()) + " -v -F " + + string cmd_line = MKFS_EXT2_BIN " -v -t " + toString(get_type()) + " -v -F " + get_mkfs_options() + " " + quote(blk_device->get_name()); wait_for_devices(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/F2fs.cc new/libstorage-ng-4.5.10/storage/Filesystems/F2fs.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/F2fs.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/F2fs.cc 2022-05-06 09:10:16.000000000 +0200 @@ -22,7 +22,6 @@ #include "storage/Filesystems/F2fsImpl.h" #include "storage/Devicegraph.h" -#include "storage/Action.h" namespace storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Jfs.cc new/libstorage-ng-4.5.10/storage/Filesystems/Jfs.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/Jfs.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Jfs.cc 2022-05-06 09:10:16.000000000 +0200 @@ -22,7 +22,6 @@ #include "storage/Filesystems/JfsImpl.h" #include "storage/Devicegraph.h" -#include "storage/Action.h" namespace storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Makefile.am new/libstorage-ng-4.5.10/storage/Filesystems/Makefile.am --- old/libstorage-ng-4.5.9/storage/Filesystems/Makefile.am 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Makefile.am 2022-05-06 09:10:16.000000000 +0200 @@ -51,6 +51,8 @@ TmpfsImpl.h TmpfsImpl.cc \ F2fs.h F2fs.cc \ F2fsImpl.h F2fsImpl.cc \ + Nilfs2.h Nilfs2.cc \ + Nilfs2Impl.h Nilfs2Impl.cc \ Bitlocker.h Bitlocker.cc \ BitlockerImpl.h BitlockerImpl.cc @@ -80,5 +82,6 @@ Nfs.h \ Tmpfs.h \ F2fs.h \ + Nilfs2.h \ Bitlocker.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2.cc new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2.cc 2022-05-06 09:10:16.000000000 +0200 @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2022 SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#include "storage/Filesystems/Nilfs2Impl.h" +#include "storage/Devicegraph.h" + + +namespace storage +{ + + using namespace std; + + + Nilfs2* + Nilfs2::create(Devicegraph* devicegraph) + { + Nilfs2* ret = new Nilfs2(new Nilfs2::Impl()); + ret->Device::create(devicegraph); + return ret; + } + + + Nilfs2* + Nilfs2::load(Devicegraph* devicegraph, const xmlNode* node) + { + Nilfs2* ret = new Nilfs2(new Nilfs2::Impl(node)); + ret->Device::load(devicegraph); + return ret; + } + + + Nilfs2::Nilfs2(Impl* impl) + : BlkFilesystem(impl) + { + } + + + Nilfs2* + Nilfs2::clone() const + { + return new Nilfs2(get_impl().clone()); + } + + + Nilfs2::Impl& + Nilfs2::get_impl() + { + return dynamic_cast<Impl&>(Device::get_impl()); + } + + + const Nilfs2::Impl& + Nilfs2::get_impl() const + { + return dynamic_cast<const Impl&>(Device::get_impl()); + } + + + bool + is_nilfs2(const Device* device) + { + return is_device_of_type<const Nilfs2>(device); + } + + + Nilfs2* + to_nilfs2(Device* device) + { + return to_device_of_type<Nilfs2>(device); + } + + + const Nilfs2* + to_nilfs2(const Device* device) + { + return to_device_of_type<const Nilfs2>(device); + } + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2.h new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2.h --- old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2.h 2022-05-06 09:10:16.000000000 +0200 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#ifndef STORAGE_NILFS2_H +#define STORAGE_NILFS2_H + + +#include "storage/Filesystems/BlkFilesystem.h" + + +namespace storage +{ + + /** + * Class to represent a NILFS2 (https://en.wikipedia.org/wiki/NILFS2) + * in the devicegraph. + */ + class Nilfs2 : public BlkFilesystem + { + public: + + /** + * Create a device of type Nilfs2. Usually this function is not called + * directly. Instead BlkDevice::create_blk_filesystem() is called. + * + * @see Device::create(Devicegraph*) + */ + static Nilfs2* create(Devicegraph* devicegraph); + + static Nilfs2* load(Devicegraph* devicegraph, const xmlNode* node); + + public: + + class Impl; + + Impl& get_impl(); + const Impl& get_impl() const; + + virtual Nilfs2* clone() const override; + + protected: + + Nilfs2(Impl* impl); + + }; + + + /** + * Checks whether device points to a Nilfs2. + * + * @throw NullPointerException + */ + bool is_nilfs2(const Device* device); + + /** + * Converts pointer to Device to pointer to Nilfs2. + * + * @return Pointer to Nilfs2. + * @throw DeviceHasWrongType, NullPointerException + */ + Nilfs2* to_nilfs2(Device* device); + + /** + * @copydoc to_nilfs2(Device*) + */ + const Nilfs2* to_nilfs2(const Device* device); + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2Impl.cc new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2Impl.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2Impl.cc 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2Impl.cc 2022-05-06 09:10:16.000000000 +0200 @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2022 SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#include "storage/Devices/BlkDeviceImpl.h" +#include "storage/Filesystems/Nilfs2Impl.h" +#include "storage/Devicegraph.h" +#include "storage/Utils/StorageDefines.h" +#include "storage/Utils/SystemCmd.h" +#include "storage/UsedFeatures.h" + + +namespace storage +{ + + using namespace std; + + + const char* DeviceTraits<Nilfs2>::classname = "Nilfs2"; + + + Nilfs2::Impl::Impl(const xmlNode* node) + : BlkFilesystem::Impl(node) + { + } + + + string + Nilfs2::Impl::get_pretty_classname() const + { + // TRANSLATORS: name of object + return _("NILFS2").translated; + } + + + void + Nilfs2::Impl::do_create() + { + const BlkDevice* blk_device = get_blk_device(); + + string cmd_line = MKFS_NILFS2_BIN " -v " + get_mkfs_options() + " " + quote(blk_device->get_name()); + + wait_for_devices(); + + SystemCmd cmd(cmd_line, SystemCmd::DoThrow); + + if (get_uuid().empty()) + { + probe_uuid(); + } + } + + + void + Nilfs2::Impl::do_set_label() const + { + const BlkDevice* blk_device = get_blk_device(); + + string cmd_line = NILFS_TUNE_BIN " -L " + quote(get_label()) + " " + quote(blk_device->get_name()); + + SystemCmd cmd(cmd_line, SystemCmd::DoThrow); + } + + + void + Nilfs2::Impl::do_set_uuid() const + { + const BlkDevice* blk_device = get_blk_device(); + + string cmd_line = NILFS_TUNE_BIN " -U " + quote(get_uuid()) + " " + quote(blk_device->get_name()); + + SystemCmd cmd(cmd_line, SystemCmd::DoThrow); + } + + + void + Nilfs2::Impl::do_set_tune_options() const + { + const BlkDevice* blk_device = get_blk_device(); + + string cmd_line = NILFS_TUNE_BIN " " + get_tune_options() + " " + quote(blk_device->get_name()); + + SystemCmd cmd(cmd_line, SystemCmd::DoThrow); + } + + + void + Nilfs2::Impl::do_resize(const CommitData& commit_data, const Action::Resize* action) const + { + const Nilfs2* nilfs2_rhs = to_nilfs2(action->get_device(commit_data.actiongraph, RHS)); + + const BlkDevice* blk_device_rhs = nilfs2_rhs->get_impl().get_blk_device(); + + EnsureMounted ensure_mounted(get_filesystem(), false); + + string cmd_line = NILFS_RESIZE_BIN " --yes " + quote(action->blk_device->get_name()); + if (action->resize_mode == ResizeMode::SHRINK) + cmd_line += " " + to_string(blk_device_rhs->get_size() / KiB) + "K"; + + wait_for_devices(); + + SystemCmd cmd(cmd_line, SystemCmd::DoThrow); + } + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2Impl.h new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2Impl.h --- old/libstorage-ng-4.5.9/storage/Filesystems/Nilfs2Impl.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Nilfs2Impl.h 2022-05-06 09:10:16.000000000 +0200 @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2022 SUSE LLC + * + * All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as published + * by the Free Software Foundation. + * + * 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, contact Novell, Inc. + * + * To contact Novell about this file by physical or electronic mail, you may + * find current contact information at www.novell.com. + */ + + +#ifndef STORAGE_NILFS2_IMPL_H +#define STORAGE_NILFS2_IMPL_H + + +#include "storage/Filesystems/Nilfs2.h" +#include "storage/Filesystems/BlkFilesystemImpl.h" +#include "storage/Utils/HumanString.h" + + +namespace storage +{ + + using namespace std; + + + template <> struct DeviceTraits<Nilfs2> { static const char* classname; }; + + + class Nilfs2::Impl : public BlkFilesystem::Impl + { + + public: + + virtual unsigned long long min_size() const override { return 129 * MiB; } + virtual unsigned long long max_size() const override { return 8 * EiB - 1 * B; } + + virtual bool supports_tune_options() const override { return true; } + + virtual bool supports_mounted_shrink() const override { return true; } + virtual bool supports_mounted_grow() const override { return true; } + + virtual bool supports_unmounted_shrink() const override { return false; } + virtual bool supports_unmounted_grow() const override { return false; } + + virtual bool supports_label() const override { return true; } + virtual bool supports_modify_label() const override { return true; } + virtual unsigned int max_labelsize() const override { return 80; } + + virtual bool supports_uuid() const override { return true; } + virtual bool supports_modify_uuid() const override { return true; } + + public: + + Impl() + : BlkFilesystem::Impl() {} + + Impl(const xmlNode* node); + + virtual FsType get_type() const override { return FsType::NILFS2; } + + virtual const char* get_classname() const override { return DeviceTraits<Nilfs2>::classname; } + + virtual string get_pretty_classname() const override; + + virtual string get_displayname() const override { return "nilfs2"; } + + virtual Impl* clone() const override { return new Impl(*this); } + + virtual uf_t used_features_pure() const override { return UF_NILFS2; } + + virtual void do_create() override; + + virtual void do_set_label() const override; + + virtual void do_set_uuid() const override; + + virtual void do_set_tune_options() const override; + + virtual void do_resize(const CommitData& commit_data, const Action::Resize* action) const override; + + }; + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Swap.cc new/libstorage-ng-4.5.10/storage/Filesystems/Swap.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/Swap.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Swap.cc 2022-05-06 09:10:16.000000000 +0200 @@ -22,7 +22,6 @@ #include "storage/Filesystems/SwapImpl.h" #include "storage/Devicegraph.h" -#include "storage/Action.h" namespace storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Filesystems/Xfs.cc new/libstorage-ng-4.5.10/storage/Filesystems/Xfs.cc --- old/libstorage-ng-4.5.9/storage/Filesystems/Xfs.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Filesystems/Xfs.cc 2022-05-06 09:10:16.000000000 +0200 @@ -22,7 +22,6 @@ #include "storage/Filesystems/XfsImpl.h" #include "storage/Devicegraph.h" -#include "storage/Action.h" namespace storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Registries.cc new/libstorage-ng-4.5.10/storage/Registries.cc --- old/libstorage-ng-4.5.9/storage/Registries.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Registries.cc 2022-05-06 09:10:16.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2014-2015] Novell, Inc. - * Copyright (c) [2016-2020] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -58,6 +58,7 @@ #include "storage/Filesystems/Xfs.h" #include "storage/Filesystems/Jfs.h" #include "storage/Filesystems/F2fs.h" +#include "storage/Filesystems/Nilfs2.h" #include "storage/Filesystems/Swap.h" #include "storage/Filesystems/Iso9660.h" #include "storage/Filesystems/Udf.h" @@ -78,84 +79,86 @@ { const map<string, device_load_fnc> device_load_registry = { - { "Disk", &Disk::load }, + { "Bcache", &Bcache::load }, + { "BcacheCset", &BcacheCset::load }, + { "Bitlocker", &Bitlocker::load }, + { "Btrfs", &Btrfs::load }, + { "BtrfsQgroup", &BtrfsQgroup::load }, + { "BtrfsSubvolume", &BtrfsSubvolume::load }, { "Dasd", &Dasd::load }, - { "Multipath", &Multipath::load }, + { "DasdPt", &DasdPt::load }, + { "Disk", &Disk::load }, { "DmRaid", &DmRaid::load }, + { "Encryption", &Encryption::load }, + { "Exfat", &Exfat::load }, + { "Ext2", &Ext2::load }, + { "Ext3", &Ext3::load }, + { "Ext4", &Ext4::load }, + { "F2fs", &F2fs::load }, + { "Gpt", &Gpt::load }, + { "ImplicitPt", &ImplicitPt::load }, + { "Iso9660", &Iso9660::load }, + { "Jfs", &Jfs::load }, + { "Luks", &Luks::load }, + { "LvmLv", &LvmLv::load }, + { "LvmPv", &LvmPv::load }, + { "LvmVg", &LvmVg::load }, { "Md", &Md::load }, { "MdContainer", &MdContainer::load }, { "MdMember", &MdMember::load }, + { "MountPoint", &MountPoint::load }, { "Msdos", &Msdos::load }, - { "Gpt", &Gpt::load }, - { "DasdPt", &DasdPt::load }, - { "ImplicitPt", &ImplicitPt::load }, + { "Multipath", &Multipath::load }, + { "Nfs", &Nfs::load }, + { "Nilfs2", &Nilfs2::load }, + { "Ntfs", &Ntfs::load }, { "Partition", &Partition::load }, - { "StrayBlkDevice", &StrayBlkDevice::load }, - { "LvmPv", &LvmPv::load }, - { "LvmVg", &LvmVg::load }, - { "LvmLv", &LvmLv::load }, - { "Encryption", &Encryption::load }, { "PlainEncryption", &PlainEncryption::load }, - { "Luks", &Luks::load }, - { "Bcache", &Bcache::load }, - { "BcacheCset", &BcacheCset::load }, - { "Ext2", &Ext2::load }, - { "Ext3", &Ext3::load }, - { "Ext4", &Ext4::load }, - { "Ntfs", &Ntfs::load }, - { "Vfat", &Vfat::load }, - { "Exfat", &Exfat::load }, - { "Btrfs", &Btrfs::load }, - { "BtrfsSubvolume", &BtrfsSubvolume::load }, - { "BtrfsQgroup", &BtrfsQgroup::load }, { "Reiserfs", &Reiserfs::load }, - { "Xfs", &Xfs::load }, - { "Jfs", &Jfs::load }, - { "F2fs", &F2fs::load }, + { "StrayBlkDevice", &StrayBlkDevice::load }, { "Swap", &Swap::load }, - { "Iso9660", &Iso9660::load }, - { "Udf", &Udf::load }, - { "Bitlocker", &Bitlocker::load }, - { "Nfs", &Nfs::load }, { "Tmpfs", &Tmpfs::load }, - { "MountPoint", &MountPoint::load } + { "Udf", &Udf::load }, + { "Vfat", &Vfat::load }, + { "Xfs", &Xfs::load } }; const map<string, holder_load_fnc> holder_load_registry = { - { "User", &User::load }, - { "MdUser", &MdUser::load }, + { "BtrfsQgroupRelation", &BtrfsQgroupRelation::load }, { "FilesystemUser", &FilesystemUser::load }, - { "Subdevice", &Subdevice::load }, { "MdSubdevice", &MdSubdevice::load }, + { "MdUser", &MdUser::load }, { "Snapshot", &Snapshot::load }, - { "BtrfsQgroupRelation", &BtrfsQgroupRelation::load } + { "Subdevice", &Subdevice::load }, + { "User", &User::load } }; const map<FsType, blk_filesystem_create_fnc> blk_filesystem_create_registry = { + { FsType::BITLOCKER, &Bitlocker::create }, { FsType::BTRFS, &Btrfs::create }, + { FsType::EXFAT, &Exfat::create }, { FsType::EXT2, &Ext2::create }, { FsType::EXT3, &Ext3::create }, { FsType::EXT4, &Ext4::create }, + { FsType::F2FS, &F2fs::create }, { FsType::ISO9660, &Iso9660::create }, + { FsType::JFS, &Jfs::create }, + { FsType::NILFS2, &Nilfs2::create }, { FsType::NTFS, &Ntfs::create }, { FsType::REISERFS, &Reiserfs::create }, { FsType::SWAP, &Swap::create }, { FsType::UDF, &Udf::create }, { FsType::VFAT, &Vfat::create }, - { FsType::EXFAT, &Exfat::create }, - { FsType::XFS, &Xfs::create }, - { FsType::JFS, &Jfs::create }, - { FsType::F2FS, &F2fs::create }, - { FsType::BITLOCKER, &Bitlocker::create } + { FsType::XFS, &Xfs::create } }; const map<EncryptionType, encryption_create_fnc> encryption_create_registry = { - { EncryptionType::PLAIN, &PlainEncryption::create }, { EncryptionType::LUKS1, &Luks::create }, - { EncryptionType::LUKS2, &Luks::create } + { EncryptionType::LUKS2, &Luks::create }, + { EncryptionType::PLAIN, &PlainEncryption::create } }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/UsedFeatures.cc new/libstorage-ng-4.5.10/storage/UsedFeatures.cc --- old/libstorage-ng-4.5.9/storage/UsedFeatures.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/UsedFeatures.cc 2022-05-06 09:10:16.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 SUSE LLC + * Copyright (c) [2020-2022] SUSE LLC * * All Rights Reserved. * @@ -42,7 +42,7 @@ "multipath", "bcache", "iscsi", "fcoe", "fc", "dasd", "quota", "snapshot", "f2fs", "exfat", "udf", "plain-encryption", "bitlocker", "nvme", - "pmem" }; + "pmem", "nilfs2" }; vector<string> tmp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/UsedFeatures.h new/libstorage-ng-4.5.10/storage/UsedFeatures.h --- old/libstorage-ng-4.5.9/storage/UsedFeatures.h 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/UsedFeatures.h 2022-05-06 09:10:16.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) [2016-2020] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -69,6 +69,7 @@ UF_NFS = 1 << 9, UF_JFS = 1 << 10, UF_F2FS = 1 << 23, + UF_NILFS2 = 1 << 30, UF_EXFAT = 1 << 24, UF_UDF = 1 << 25, UF_BITLOCKER = 1 << 27, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Utils/Logger.cc new/libstorage-ng-4.5.10/storage/Utils/Logger.cc --- old/libstorage-ng-4.5.9/storage/Utils/Logger.cc 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Utils/Logger.cc 2022-05-06 09:10:16.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) 2015 Novell, Inc. - * Copyright (c) [2016-2018] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -125,20 +125,21 @@ int line, const string& function, const string& content) { int fd = open(filename.c_str(), O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, permissions); + if (fd < 0) + return; - if (fd >= 0) + FILE* f = fdopen(fd, "ae"); + if (!f) { - FILE* f = fdopen(fd, "ae"); + close(fd); + return; + } - if (f) - { - fprintf(f, "%s <%d> [%s] %s(%s):%d %s\n", datetime(time(nullptr)).c_str(), - static_cast<log_level_underlying_type>(log_level), component.c_str(), - file.c_str(), function.c_str(), line, content.c_str()); + fprintf(f, "%s <%d> [%s] %s(%s):%d %s\n", datetime(time(nullptr)).c_str(), + static_cast<log_level_underlying_type>(log_level), component.c_str(), + file.c_str(), function.c_str(), line, content.c_str()); - fclose(f); - } - } + fclose(f); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Utils/Logger.h new/libstorage-ng-4.5.10/storage/Utils/Logger.h --- old/libstorage-ng-4.5.9/storage/Utils/Logger.h 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Utils/Logger.h 2022-05-06 09:10:16.000000000 +0200 @@ -87,8 +87,8 @@ * ("/var/log/libstorage.log") or to a given file. Do not use this * function for production code but only for examples and test-cases. * - * Note that this method only uses the given filename the first time that - * is called. + * Note that this method only uses the given filename the first time + * it is called. */ Logger* get_logfile_logger(const std::string& filename = "/var/log/libstorage.log"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.5.9/storage/Utils/StorageDefines.h new/libstorage-ng-4.5.10/storage/Utils/StorageDefines.h --- old/libstorage-ng-4.5.9/storage/Utils/StorageDefines.h 2022-05-04 15:57:19.000000000 +0200 +++ new/libstorage-ng-4.5.10/storage/Utils/StorageDefines.h 2022-05-06 09:10:16.000000000 +0200 @@ -1,6 +1,6 @@ /* * Copyright (c) [2004-2015] Novell, Inc. - * Copyright (c) [2016-2021] SUSE LLC + * Copyright (c) [2016-2022] SUSE LLC * * All Rights Reserved. * @@ -127,6 +127,7 @@ #define REISERFSRESIZE_BIN "/sbin/resize_reiserfs" #define RESIZE2FS_BIN "/usr/sbin/resize2fs" #define FATRESIZE_BIN "/usr/sbin/fatresize" +#define NILFS_RESIZE_BIN "/usr/sbin/nilfs-resize" #define TUNE2FS_BIN "/sbin/tune2fs" #define TUNEREISERFS_BIN "/sbin/reiserfstune" @@ -136,6 +137,7 @@ #define FATLABEL_BIN "/usr/sbin/fatlabel" #define SWAPLABEL_BIN "/sbin/swaplabel" #define EXFATLABEL_BIN "/usr/sbin/exfatlabel" +#define NILFS_TUNE_BIN "/usr/sbin/nilfs-tune" #define DUMPE2FS_BIN "/sbin/dumpe2fs" @@ -148,6 +150,7 @@ #define MKFS_EXT2_BIN "/sbin/mke2fs" #define MKFS_BTRFS_BIN "/sbin/mkfs.btrfs" #define MKFS_F2FS_BIN "/usr/sbin/mkfs.f2fs" +#define MKFS_NILFS2_BIN "/usr/sbin/mkfs.nilfs2" #define MKFS_EXFAT_BIN "/usr/sbin/mkfs.exfat" #define MKFS_UDF_BIN "/usr/sbin/mkfs.udf"