All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: util-linux@vger.kernel.org
Cc: Petr Vorel <pvorel@suse.cz>
Subject: [PATCH 1/2] libmount: add mnt_fs_is_btrfs()
Date: Thu, 23 Feb 2017 15:04:43 +0100	[thread overview]
Message-ID: <20170223140444.17916-1-pvorel@suse.cz> (raw)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
I exported mnt_fs_is_btrfs() even it's not necessary for second patch as I
consider useful to have it available. I'd like to have
btrfs_get_default_subvol_id() exported as well.
---
 libmount/docs/libmount-sections.txt |  1 +
 libmount/src/fs.c                   | 11 +++++++++++
 libmount/src/libmount.h.in          |  1 +
 libmount/src/libmount.sym           |  7 ++++++-
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libmount/docs/libmount-sections.txt b/libmount/docs/libmount-sections.txt
index 78d89cae7..65f774c2c 100644
--- a/libmount/docs/libmount-sections.txt
+++ b/libmount/docs/libmount-sections.txt
@@ -209,6 +209,7 @@ mnt_fs_get_usedsize
 mnt_fs_get_userdata
 mnt_fs_get_user_options
 mnt_fs_get_vfs_options
+mnt_fs_is_btrfs
 mnt_fs_is_kernel
 mnt_fs_is_netfs
 mnt_fs_is_pseudofs
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index 1c4ba1aab..e1bb9cde4 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -616,6 +616,17 @@ int mnt_fs_is_netfs(struct libmnt_fs *fs)
 }
 
 /**
+ * mnt_fs_is_btrfs:
+ * @fs: filesystem
+ *
+ * Returns: 1 if the filesystem is a btrfs fs type
+ */
+int mnt_fs_is_btrfs(struct libmnt_fs *fs)
+{
+	return !strcmp(fs->fstype, "btrfs");
+}
+
+/**
  * mnt_fs_get_fstype:
  * @fs: fstab/mtab/mountinfo entry pointer
  *
diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in
index f191a52fe..7196430ef 100644
--- a/libmount/src/libmount.h.in
+++ b/libmount/src/libmount.h.in
@@ -411,6 +411,7 @@ extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types);
 extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options);
 extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file);
 
+extern int mnt_fs_is_btrfs(struct libmnt_fs *fs);
 extern int mnt_fs_is_kernel(struct libmnt_fs *fs);
 extern int mnt_fs_is_swaparea(struct libmnt_fs *fs);
 extern int mnt_fs_is_netfs(struct libmnt_fs *fs);
diff --git a/libmount/src/libmount.sym b/libmount/src/libmount.sym
index f0210c240..72c9caa78 100644
--- a/libmount/src/libmount.sym
+++ b/libmount/src/libmount.sym
@@ -4,7 +4,7 @@
  *
  * Version info can't enforce this since we never change the SONAME.
  *
- * Copyright (C) 2011-2014 Karel Zak <kzak@redhat.com> 
+ * Copyright (C) 2011-2014 Karel Zak <kzak@redhat.com>
  */
 MOUNT_2.19 {
 global:
@@ -315,3 +315,8 @@ MOUNT_2.28 {
 	mnt_table_find_target_with_option;
 	mnt_fs_set_priority;
 } MOUNT_2.26;
+
+MOUNT_2.30 {
+global:
+	mnt_fs_is_btrfs;
+} MOUNT_2.28;
-- 
2.11.0


             reply	other threads:[~2017-02-23 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 14:04 Petr Vorel [this message]
2017-02-23 14:04 ` [PATCH 2/2] libmount: return tab entry for default node Petr Vorel
2017-02-23 15:12 ` [PATCH 1/2] libmount: add mnt_fs_is_btrfs() Karel Zak
2017-02-23 18:15   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170223140444.17916-1-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.