Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimental support for bcachefs #83

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion barrel/cmds.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2021-2022] SUSE LLC
* Copyright (c) [2021-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -20,6 +20,8 @@
*/


#include <storage/Version.h>

#include "cmds.h"
#include "commit.h"
#include "create-encryption.h"
Expand Down Expand Up @@ -78,6 +80,9 @@ namespace barrel


const vector<Parser> create_cmds = {
#if LIBSTORAGE_NG_VERSION_AT_LEAST(1, 100)
{ "bcachefs", make_shared<CmdCreateBcachefs>() },
#endif
{ "btrfs", make_shared<CmdCreateBtrfs>() },
{ "encryption", make_shared<CmdCreateEncryption>() },
{ "exfat", make_shared<CmdCreateExfat>() },
Expand Down
24 changes: 23 additions & 1 deletion barrel/create-filesystem.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2021-2023] SUSE LLC
* Copyright (c) [2021-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand Down Expand Up @@ -31,6 +31,7 @@
#include <storage/Filesystems/MountPoint.h>
#include <storage/Filesystems/Btrfs.h>
#include <storage/SystemInfo/SystemInfo.h>
#include <storage/Version.h>

#include "Utils/GetOpts.h"
#include "Utils/Text.h"
Expand Down Expand Up @@ -66,6 +67,9 @@ namespace barrel


const map<string, FsType> str_to_fs_type = {
#if LIBSTORAGE_NG_VERSION_AT_LEAST(1, 100)
{ "bcachefs", FsType::BCACHEFS },
#endif
{ "btrfs", FsType::BTRFS },
{ "exfat", FsType::EXFAT },
{ "ext2", FsType::EXT2 },
Expand Down Expand Up @@ -583,6 +587,24 @@ namespace barrel
}


#if LIBSTORAGE_NG_VERSION_AT_LEAST(1, 100)

shared_ptr<ParsedCmd>
CmdCreateBcachefs::parse(GetOpts& get_opts) const
{
return parse_create_filesystem(get_opts, FsType::BCACHEFS);
}


const char*
CmdCreateBcachefs::help() const
{
return _("Alias for 'create filesystem --type bcachefs'");
}

#endif


shared_ptr<ParsedCmd>
CmdCreateBtrfs::parse(GetOpts& get_opts) const
{
Expand Down
16 changes: 15 additions & 1 deletion barrel/create-filesystem.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2021-2022] SUSE LLC
* Copyright (c) [2021-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -24,6 +24,8 @@
#define BARREL_CREATE_FILESYSTEM_H


#include <storage/Version.h>

#include "handle.h"


Expand All @@ -38,6 +40,18 @@ namespace barrel
};


#if LIBSTORAGE_NG_VERSION_AT_LEAST(1, 100)

struct CmdCreateBcachefs : public CmdCreateFilesystem
{
virtual shared_ptr<ParsedCmd> parse(GetOpts& get_opts) const override;
virtual const char* help() const override;
virtual bool is_alias() const override { return true; }
};

#endif


struct CmdCreateBtrfs : public CmdCreateFilesystem
{
virtual shared_ptr<ParsedCmd> parse(GetOpts& get_opts) const override;
Expand Down
6 changes: 3 additions & 3 deletions doc/barrel.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<refentry id='barrel8' xmlns:xlink="http://www.w3.org/1999/xlink">

<refentryinfo>
<date>2023-10-06</date>
<date>2024-01-29</date>
</refentryinfo>

<refmeta>
<refentrytitle>barrel</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class='date'>2023-10-06</refmiscinfo>
<refmiscinfo class='date'>2024-01-29</refmiscinfo>
<refmiscinfo class='version'>@VERSION@</refmiscinfo>
<refmiscinfo class='manual'>Storage Management</refmiscinfo>
</refmeta>
Expand Down Expand Up @@ -342,7 +342,7 @@
<varlistentry>
<term><option>-t, --type</option> <replaceable>type</replaceable></term>
<listitem>
<para>Set file system type. Possible values are btrfs, exfat,
<para>Set file system type. Possible values are bcachefs, btrfs, exfat,
ext2, ext3, ext4, f2fs, jfs, nilfs2, ntfs, reiserfs, swap, udf,
vfat, xfs.</para>
<para>Not all file systems may be available on the
Expand Down
5 changes: 5 additions & 0 deletions package/barrel.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jan 29 11:16:40 CET 2024 - [email protected]

- experimental support for bcachefs

-------------------------------------------------------------------
Tue Jan 02 16:34:48 CET 2024 - [email protected]

Expand Down