linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Block <ablock84@googlemail.com>
To: linux-btrfs@vger.kernel.org
Cc: Alexander Block <ablock84@googlemail.com>
Subject: [PATCH 2/5] Btrfs-progs: move skip_prefix and prefixcmp to utils.c
Date: Sun, 24 Jun 2012 23:20:05 +0200	[thread overview]
Message-ID: <1340572808-30281-3-git-send-email-ablock84@googlemail.com> (raw)
In-Reply-To: <1340572808-30281-1-git-send-email-ablock84@googlemail.com>

Needed by btrfs fi prop.

Signed-off-by: Alexander Block <ablock84@googlemail.com>
---
 btrfs.c    |   17 ++---------------
 commands.h |    2 --
 help.c     |    2 ++
 utils.c    |   15 +++++++++++++++
 utils.h    |    3 +++
 5 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/btrfs.c b/btrfs.c
index 88238d6..f48e483 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -19,7 +19,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "ctree.h"
 #include "commands.h"
+#include "utils.h"
 #include "version.h"
 
 static const char * const btrfs_cmd_group_usage[] = {
@@ -32,21 +34,6 @@ static const char btrfs_cmd_group_info[] =
 
 char argv0_buf[ARGV0_BUF_SIZE] = "btrfs";
 
-static inline const char *skip_prefix(const char *str, const char *prefix)
-{
-	size_t len = strlen(prefix);
-	return strncmp(str, prefix, len) ? NULL : str + len;
-}
-
-int prefixcmp(const char *str, const char *prefix)
-{
-	for (; ; str++, prefix++)
-		if (!*prefix)
-			return 0;
-		else if (*str != *prefix)
-			return (unsigned char)*prefix - (unsigned char)*str;
-}
-
 static int parse_one_token(const char *arg, const struct cmd_group *grp,
 			   const struct cmd_struct **cmd_ret)
 {
diff --git a/commands.h b/commands.h
index a303a50..64acf17 100644
--- a/commands.h
+++ b/commands.h
@@ -58,8 +58,6 @@ struct cmd_group {
 };
 
 /* btrfs.c */
-int prefixcmp(const char *str, const char *prefix);
-
 int check_argc_exact(int nargs, int expected);
 int check_argc_min(int nargs, int expected);
 int check_argc_max(int nargs, int expected);
diff --git a/help.c b/help.c
index 6d04293..29ff3d6 100644
--- a/help.c
+++ b/help.c
@@ -18,7 +18,9 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "ctree.h"
 #include "commands.h"
+#include "utils.h"
 
 extern char argv0_buf[ARGV0_BUF_SIZE];
 
diff --git a/utils.c b/utils.c
index 5833030..61ae39b 100644
--- a/utils.c
+++ b/utils.c
@@ -1216,3 +1216,18 @@ scan_again:
 	return 0;
 }
 
+const char *skip_prefix(const char *str, const char *prefix)
+{
+	size_t len = strlen(prefix);
+	return strncmp(str, prefix, len) ? NULL : str + len;
+}
+
+int prefixcmp(const char *str, const char *prefix)
+{
+	for (; ; str++, prefix++)
+		if (!*prefix)
+			return 0;
+		else if (*str != *prefix)
+			return (unsigned char)*prefix - (unsigned char)*str;
+}
+
diff --git a/utils.h b/utils.h
index c5f55e1..e6b5df8 100644
--- a/utils.h
+++ b/utils.h
@@ -46,4 +46,7 @@ int check_label(char *input);
 int get_mountpt(char *dev, char *mntpt, size_t size);
 
 int btrfs_scan_block_devices(int run_ioctl);
+
+const char *skip_prefix(const char *str, const char *prefix);
+int prefixcmp(const char *str, const char *prefix);
 #endif
-- 
1.7.10


  parent reply	other threads:[~2012-06-24 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-24 21:20 [PATCH 0/5] introduce btrfs filesystem property command Alexander Block
2012-06-24 21:20 ` [PATCH 1/5] Btrfs-progs: add BTRFS_IOC_SUBVOL_GET/SETFLAGS to ioctl.h Alexander Block
2012-06-24 21:20 ` Alexander Block [this message]
2012-06-24 21:20 ` [PATCH 3/5] Btrfs-progs: let get_label return the label instead of of printing it Alexander Block
2012-06-24 21:20 ` [PATCH 4/5] Btrfs-progs: make filesystem_cmd_group non const Alexander Block
2012-06-24 22:14   ` Alexander Block
2012-06-24 21:20 ` [PATCH 5/5] Btrfs-progs: introduce btrfs filesystem property command Alexander Block
2012-06-27  2:25 ` [PATCH 0/5] " Liu Bo
2012-06-27 11:08   ` Alexander Block
2012-06-28 13:08 ` Martin Steigerwald

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=1340572808-30281-3-git-send-email-ablock84@googlemail.com \
    --to=ablock84@googlemail.com \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).