diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2013-08-19 01:44:18 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2013-08-19 01:44:18 +0000 |
commit | 11478117546b77c5c5693ea5d7b6aae02f9eb0f7 (patch) | |
tree | e52e1f83ea35d00d4e05b50ee8b6bfed3cb11271 /src/sg_xcopy.c | |
parent | 06df6b477dd157e72a130704d8b11ca97e335012 (diff) | |
download | sg3_utils-11478117546b77c5c5693ea5d7b6aae02f9eb0f7.tar.gz |
sg_xcopy: fix for sg and bsg nodes
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@508 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_xcopy.c')
-rw-r--r-- | src/sg_xcopy.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c index 1a578424..f62b26e5 100644 --- a/src/sg_xcopy.c +++ b/src/sg_xcopy.c @@ -411,6 +411,30 @@ dd_filetype_str(int ft, char * buff) } static int +simplified_ft(const struct xcopy_fp_t * xfp) +{ + int ftype = xfp->sg_type; + + switch (ftype) { + case FT_BLOCK: + case FT_ST: + case FT_OTHER: /* typically regular file */ + case FT_DEV_NULL: + case FT_FIFO: + case FT_ERROR: + return ftype; + default: + if (FT_SG & ftype) { + if ((0 == xfp->pdt) || (0xe == xfp->pdt)) /* D-A or RBC */ + return FT_BLOCK; + else if (0x1 == xfp->pdt) + return FT_ST; + } + return FT_OTHER; + } +} + +static int seg_desc_from_dd_type(int in_ft, int in_off, int out_ft, int out_off) { int desc_type = -1; @@ -1850,7 +1874,8 @@ main(int argc, char * argv[]) bpt = (r > MAX_BLOCKS_PER_TRANSFER) ? MAX_BLOCKS_PER_TRANSFER : r; } - seg_desc_type = seg_desc_from_dd_type(ixcf.sg_type, 0, oxcf.sg_type, 0); + seg_desc_type = seg_desc_from_dd_type(simplified_ft(&ixcf), 0, + simplified_ft(&oxcf), 0); if (do_time) { start_tm.tv_sec = 0; |