aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Shishkin <edward@redhat.com>2009-12-15 18:47:59 +0100
committerJens Axboe <jens.axboe@oracle.com>2010-04-20 09:51:52 +0200
commite41bf0ffcf5a2ec016493c25737896a03bfbafba (patch)
tree3880ed73fde4709612eb032f2de2d04a8744017f
parentbc14c53fb79ecf2dedf52c55d8601ea4af500ce8 (diff)
downloadblktrace-e41bf0ffcf5a2ec016493c25737896a03bfbafba.tar.gz
blktrace: add back conversion
Fixup for bz 502889. Problem: when executing with /dev/cciss/foo (long path names) btreplay complains (No such file or directory). Bug: Missed back conversion of erscores to slashes. Solution: Convert underscores to slashes to restore device names that have larger paths. Signed-off-by: Edward Shishkin <edward@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--btreplay/btreplay.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/btreplay/btreplay.c b/btreplay/btreplay.c
index 2d122ca..cba099a 100644
--- a/btreplay/btreplay.c
+++ b/btreplay/btreplay.c
@@ -1314,6 +1314,8 @@ static void reset_input_file(struct thr_info *tip)
*/
static void *replay_sub(void *arg)
{
+ int i;
+ char *mdev;
char path[MAXPATHLEN];
struct io_bunch bunch;
struct thr_info *tip = arg;
@@ -1321,8 +1323,15 @@ static void *replay_sub(void *arg)
pin_to_cpu(tip);
- sprintf(path, "/dev/%s", map_dev(tip->devnm));
-
+ mdev = map_dev(tip->devnm);
+ sprintf(path, "/dev/%s", mdev);
+ /*
+ * convert underscores to slashes to
+ * restore device names that have larger paths
+ */
+ for (i = 0; i < strlen(mdev); i++)
+ if (path[strlen("/dev/") + i] == '_')
+ path[strlen("/dev/") + i] = '/';
#ifdef O_NOATIME
oflags = O_NOATIME;
#else