Skip to content

Commit c1d3af6

Browse files
committed
btrfs-progs: add btrfs-find-root to btrfs.box
There's a report that btrfs-find-root does not work as built-in tool in btrfs.box, while it's advertised in the help: $ ./btrfs.box help --box Standalone tools built-in in the busybox style: - mkfs.btrfs - btrfs-image - btrfs-convert - btrfstune - btrfs-find-root Add the support as it might be useful tool sometimes. In the future the command should be moved to e.g. inspect-internal or rescue. Issue: #648 Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 0ec1776 commit c1d3af6

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ MAKEOPTS = --no-print-directory Q=$(Q)
326326
# built-in sources into "busybox", all files that contain the main function and
327327
# are not compiled standalone
328328
progs_box_main = btrfs.o mkfs/main.o image/main.o convert/main.o \
329-
tune/main.o
329+
tune/main.o btrfs-find-root.o
330330

331331
progs_box_all_objects = $(mkfs_objects) $(image_objects) $(convert_objects) $(tune_objects)
332332
progs_box_all_static_objects = $(static_mkfs_objects) $(static_image_objects) \

btrfs-find-root.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "kernel-shared/disk-io.h"
2626
#include "kernel-shared/volumes.h"
2727
#include "kernel-shared/extent_io.h"
28+
#include "common/box.h"
2829
#include "common/utils.h"
2930
#include "common/extent-cache.h"
3031
#include "common/help.h"
@@ -329,7 +330,7 @@ static const struct cmd_struct btrfs_find_root_cmd = {
329330
"btrfs-find-root", NULL, btrfs_find_root_usage, NULL, 0,
330331
};
331332

332-
int main(int argc, char **argv)
333+
int BOX_MAIN(find_root)(int argc, char **argv)
333334
{
334335
struct btrfs_fs_info *fs_info;
335336
struct btrfs_find_root_filter filter = {0};

btrfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,8 @@ int main(int argc, char **argv)
420420
return convert_main(argc, argv);
421421
} else if (!strcmp(bname, "btrfstune")) {
422422
return btrfstune_main(argc, argv);
423+
} else if (!strcmp(bname, "btrfs-find-root")) {
424+
return find_root_main(argc, argv);
423425
#endif
424426
} else {
425427
int shift;

common/box.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ DECLARE_BOX_MAIN(mkfs);
3333
DECLARE_BOX_MAIN(image);
3434
DECLARE_BOX_MAIN(convert);
3535
DECLARE_BOX_MAIN(btrfstune);
36+
DECLARE_BOX_MAIN(find_root);
3637

3738
#else
3839
#define BOX_MAIN(standalone) main

0 commit comments

Comments
 (0)