This is to detect whether the filesystem tool supports bmap or not.

Signed-off-by: Jaegeuk Kim <[email protected]>
---
 common/config |  2 ++
 common/rc     | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/common/config b/common/config
index 235f4a1..9fb3703 100644
--- a/common/config
+++ b/common/config
@@ -168,6 +168,7 @@ if [ -n "$__XFSDUMP_PROG" ]; then
 else
        export XFSDUMP_PROG=""
 fi
+export BMAP_XFS_PROG="`set_prog_path xfs_bmap`"
 export XFSRESTORE_PROG="`set_prog_path xfsrestore`"
 export XFSINVUTIL_PROG="`set_prog_path xfsinvutil`"
 export GETFATTR_PROG="`set_prog_path getfattr`"
@@ -220,6 +221,7 @@ case "$HOSTOS" in
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
         export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
         export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
+        export BMAP_F2FS_PROG="`set_prog_path fibmap.f2fs`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
         export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
diff --git a/common/rc b/common/rc
index 438cd51..d413721 100644
--- a/common/rc
+++ b/common/rc
@@ -2331,6 +2331,24 @@ _require_scratch_shutdown()
        _scratch_unmount
 }
 
+# Does bmap work on this fs?
+_require_bmap()
+{
+       case "$FSTYP" in
+       xfs)
+               _require_command $BMAP_XFS_PROG
+               export BMAP_PROG=$BMAP_XFS_PROG
+               ;;
+       f2fs)
+               _require_command $BMAP_F2FS_PROG
+               export BMAP_PROG=$BMAP_F2FS_PROG
+               ;;
+       *)
+               _notrun "$FSTYP does not support bmap"
+               ;;
+       esac
+}
+
 # arg 1 is dev to remove and is output of the below eg.
 # ls -l /sys/class/block/sdd | rev | cut -d "/" -f 3 | rev
 _devmgt_remove()
-- 
2.1.1


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to