* [PATCH] btrfs-progs: return zero for success
@ 2013-03-18 7:24 Anand Jain
2013-03-18 16:18 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Anand Jain @ 2013-03-18 7:24 UTC (permalink / raw)
To: linux-btrfs
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
Makefile | 6 +++++-
check-mounted.c | 31 +++++++++++++++++++++++++++++++
cmds-filesystem.c | 2 +-
3 files changed, 37 insertions(+), 2 deletions(-)
create mode 100644 check-mounted.c
diff --git a/Makefile b/Makefile
index d102dee..c97e6b7 100644
--- a/Makefile
+++ b/Makefile
@@ -159,6 +159,10 @@ btrfs-select-super: $(objects) $(libs) btrfs-select-super.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o btrfs-select-super $(objects) btrfs-select-super.o $(LDFLAGS) $(LIBS)
+check-mounted: $(objects) $(libs) check-mounted.o
+ @echo " [LD] $@"
+ $(Q)$(CC) $(CFLAGS) -o check-mounted $(objects) check-mounted.o $(LDFLAGS) $(LIBS)
+
btrfstune: $(objects) $(libs) btrfstune.o
@echo " [LD] $@"
$(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
@@ -205,7 +209,7 @@ clean :
@echo "Cleaning"
$(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfs.static btrfsck \
- version.h \
+ version.h check-mounted\
$(libs) $(lib_links)
$(Q)$(MAKE) $(MAKEOPTS) -C man $@
diff --git a/check-mounted.c b/check-mounted.c
new file mode 100644
index 0000000..781edec
--- /dev/null
+++ b/check-mounted.c
@@ -0,0 +1,31 @@
+
+#define _XOPEN_SOURCE 500
+#define _GNU_SOURCE 1
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include "kerncompat.h"
+#include "ctree.h"
+#include "disk-io.h"
+#include "print-tree.h"
+#include "transaction.h"
+#include "list.h"
+#include "version.h"
+#include "utils.h"
+
+int main(int ac, char **av)
+{
+ int ret;
+
+ if((ret = check_mounted(av[optind])) < 0) {
+ fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
+ return ret;
+ } else if(ret) {
+ fprintf(stderr, "%s is currently mounted. Aborting.\n", av[optind]);
+ return -EBUSY;
+ }
+ printf("Not mounted\n");
+ return 0;
+}
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 2210020..f3d3130 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -446,7 +446,7 @@ static int cmd_defrag(int argc, char **argv)
exit(1);
}
- return errors + 20;
+ return errors;
}
static const char * const cmd_resize_usage[] = {
--
1.8.1.227.g44fe835
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: return zero for success
2013-03-18 7:24 [PATCH] btrfs-progs: return zero for success Anand Jain
@ 2013-03-18 16:18 ` Eric Sandeen
2013-03-18 16:19 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2013-03-18 16:18 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs
On 3/18/13 2:24 AM, Anand Jain wrote:
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
You've got your testcase leaking into this defrag fix.
When you resend, can you add "defrag" to the patch subject somehow?
-Eric
> ---
> Makefile | 6 +++++-
> check-mounted.c | 31 +++++++++++++++++++++++++++++++
> cmds-filesystem.c | 2 +-
> 3 files changed, 37 insertions(+), 2 deletions(-)
> create mode 100644 check-mounted.c
>
> diff --git a/Makefile b/Makefile
> index d102dee..c97e6b7 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -159,6 +159,10 @@ btrfs-select-super: $(objects) $(libs) btrfs-select-super.o
> @echo " [LD] $@"
> $(Q)$(CC) $(CFLAGS) -o btrfs-select-super $(objects) btrfs-select-super.o $(LDFLAGS) $(LIBS)
>
> +check-mounted: $(objects) $(libs) check-mounted.o
> + @echo " [LD] $@"
> + $(Q)$(CC) $(CFLAGS) -o check-mounted $(objects) check-mounted.o $(LDFLAGS) $(LIBS)
> +
> btrfstune: $(objects) $(libs) btrfstune.o
> @echo " [LD] $@"
> $(Q)$(CC) $(CFLAGS) -o btrfstune $(objects) btrfstune.o $(LDFLAGS) $(LIBS)
> @@ -205,7 +209,7 @@ clean :
> @echo "Cleaning"
> $(Q)rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
> btrfs-zero-log btrfstune dir-test ioctl-test quick-test send-test btrfs.static btrfsck \
> - version.h \
> + version.h check-mounted\
> $(libs) $(lib_links)
> $(Q)$(MAKE) $(MAKEOPTS) -C man $@
>
> diff --git a/check-mounted.c b/check-mounted.c
> new file mode 100644
> index 0000000..781edec
> --- /dev/null
> +++ b/check-mounted.c
> @@ -0,0 +1,31 @@
> +
> +#define _XOPEN_SOURCE 500
> +#define _GNU_SOURCE 1
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +#include <sys/stat.h>
> +#include "kerncompat.h"
> +#include "ctree.h"
> +#include "disk-io.h"
> +#include "print-tree.h"
> +#include "transaction.h"
> +#include "list.h"
> +#include "version.h"
> +#include "utils.h"
> +
> +int main(int ac, char **av)
> +{
> + int ret;
> +
> + if((ret = check_mounted(av[optind])) < 0) {
> + fprintf(stderr, "Could not check mount status: %s\n", strerror(-ret));
> + return ret;
> + } else if(ret) {
> + fprintf(stderr, "%s is currently mounted. Aborting.\n", av[optind]);
> + return -EBUSY;
> + }
> + printf("Not mounted\n");
> + return 0;
> +}
> diff --git a/cmds-filesystem.c b/cmds-filesystem.c
> index 2210020..f3d3130 100644
> --- a/cmds-filesystem.c
> +++ b/cmds-filesystem.c
> @@ -446,7 +446,7 @@ static int cmd_defrag(int argc, char **argv)
> exit(1);
> }
>
> - return errors + 20;
> + return errors;
> }
>
> static const char * const cmd_resize_usage[] = {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: return zero for success
2013-03-18 16:18 ` Eric Sandeen
@ 2013-03-18 16:19 ` Eric Sandeen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2013-03-18 16:19 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs
On 3/18/13 11:18 AM, Eric Sandeen wrote:
> On 3/18/13 2:24 AM, Anand Jain wrote:
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>
>
> You've got your testcase leaking into this defrag fix.
>
> When you resend, can you add "defrag" to the patch subject somehow?
>
> -Eric
Ugh,sorry. Should read all new list email before replying.
I see that you did this already. Nevermind.
-Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-18 16:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18 7:24 [PATCH] btrfs-progs: return zero for success Anand Jain
2013-03-18 16:18 ` Eric Sandeen
2013-03-18 16:19 ` Eric Sandeen
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).