From fddbd903d5e7155652b68486f9811f75016c0a86 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 29 Dec 2010 14:34:17 -0800 Subject: [PATCH] cleanup: don't use __PRETTY_FUNCTION__ Its output isn't as pretty as I had hoped. Signed-off-by: Colin McCabe --- src/common/buffer.cc | 2 +- src/crushtool.cc | 8 ++++---- src/os/FileJournal.cc | 14 +++++++------- src/osd/OSD.cc | 16 ++++++++-------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 0c2d2eba8c267..b1a18e30620e6 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -109,7 +109,7 @@ int buffer::list::read_file(const char *fn, bool silent) continue; } if (!silent) { - derr << __PRETTY_FUNCTION__ << ": read error:" + derr << "buffer::list::read_file: read error:" << cpp_strerror(err) << dendl; } break; diff --git a/src/crushtool.cc b/src/crushtool.cc index 14e092d6297cf..79a2b5f2e9b51 100644 --- a/src/crushtool.cc +++ b/src/crushtool.cc @@ -600,12 +600,12 @@ static int decompile_crush_bucket(int cur, return 0; } else if (c->second == DCB_STATE_IN_PROGRESS) { - cout << __PRETTY_FUNCTION__ << ": logic error: tried to decompile " + cout << "decompile_crush_bucket: logic error: tried to decompile " "a bucket that is already being decompiled" << std::endl; return -EBADE; } else { - cout << __PRETTY_FUNCTION__ << ": logic error: illegal bucket state! " + cout << "decompile_crush_bucket: logic error: illegal bucket state! " << c->second << std::endl; return -EBADE; } @@ -620,14 +620,14 @@ static int decompile_crush_bucket(int cur, return ret; } else if (d->second == DCB_STATE_IN_PROGRESS) { - cout << __PRETTY_FUNCTION__ << ": error: while trying to output bucket " + cout << "decompile_crush_bucket: error: while trying to output bucket " << cur << ", we found out that it contains one of the buckets that " << "contain it. This is not allowed. The buckets must form a " << "directed acyclic graph." << std::endl; return -EINVAL; } else if (d->second != DCB_STATE_DONE) { - cout << __PRETTY_FUNCTION__ << ": logic error: illegal bucket state " + cout << "decompile_crush_bucket: logic error: illegal bucket state " << d->second << std::endl; return -EBADE; } diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index d2047b154761e..d51f14ffdb571 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -47,14 +47,14 @@ int FileJournal::_open(bool forwrite, bool create) if (fd >= 0) { if (TEMP_FAILURE_RETRY(::close(fd))) { int err = errno; - derr << __PRETTY_FUNCTION__ << ": error closing old fd: " + derr << "FileJournal::_open: error closing old fd: " << cpp_strerror(err) << dendl; } } fd = TEMP_FAILURE_RETRY(::open(fn.c_str(), flags, 0644)); if (fd < 0) { int err = errno; - derr << __PRETTY_FUNCTION__ << ": unable to open journal: open() " + derr << "FileJournal::_open : unable to open journal: open() " << "failed: " << cpp_strerror(err) << dendl; return -err; } @@ -63,7 +63,7 @@ int FileJournal::_open(bool forwrite, bool create) ret = ::fstat(fd, &st); if (ret) { int err = errno; - derr << __PRETTY_FUNCTION__ << ": unable to fstat journal: " + derr << "FileJournal::_open: unable to fstat journal: " << cpp_strerror(err) << dendl; return -err; } @@ -235,7 +235,7 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize, ret = ::ftruncate(fd, newsize); if (ret < 0) { int err = errno; - derr << __PRETTY_FUNCTION__ << ": unable to extend journal to " + derr << "FileJournal::_open_file : unable to extend journal to " << newsize << " bytes: " << cpp_strerror(err) << dendl; return -err; } @@ -277,7 +277,7 @@ int FileJournal::create() int r = ::pwrite(fd, bp.c_str(), bp.length(), 0); if (r < 0) { int err = errno; - derr << __PRETTY_FUNCTION__ << ": create write header error " + derr << "FileJournal::create : create write header error " << cpp_strerror(err) << dendl; return -err; } @@ -313,7 +313,7 @@ int FileJournal::open(uint64_t next_seq) //<< " vs expected fsid = " << fsid << dendl; if (header.fsid != fsid) { - derr << __PRETTY_FUNCTION__ << ": open fsid doesn't match, invalid " + derr << "FileJournal::open: open fsid doesn't match, invalid " << "(someone else's?) journal" << dendl; return -EINVAL; } @@ -642,7 +642,7 @@ void FileJournal::write_bl(off64_t& pos, bufferlist& bl) ::lseek64(fd, pos, SEEK_SET); int err = bl.write_fd(fd); if (err) { - derr << __PRETTY_FUNCTION__ << ": write_fd failed: " + derr << "FileJournal::write_bl : write_fd failed: " << cpp_strerror(err) << dendl; } pos += bl.length(); diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d2590f318d472..8e0c1d12ac553 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -444,12 +444,12 @@ int OSD::pre_init() assert(!store); store = create_object_store(dev_path, journal_path); if (!store) { - derr << __PRETTY_FUNCTION__ << ": unable to create object store" << dendl; + derr << "OSD::pre_init: unable to create object store" << dendl; return -ENODEV; } if (store->test_mount_in_use()) { - derr << __PRETTY_FUNCTION__ << ": object store '" << dev_path << "' is " + derr << "OSD::pre_init: object store '" << dev_path << "' is " << "currently in use. (Is cosd already running?)" << dendl; return -EBUSY; } @@ -470,7 +470,7 @@ int OSD::init() int r = store->mount(); if (r < 0) { - derr << __PRETTY_FUNCTION__ << ": unable to mount object store" << dendl; + derr << "OSD:init: unable to mount object store" << dendl; return r; } @@ -479,7 +479,7 @@ int OSD::init() // read superblock r = read_superblock(); if (r < 0) { - derr << __PRETTY_FUNCTION__ << ": unable to read osd superblock" << dendl; + derr << "OSD::init() : unable to read osd superblock" << dendl; store->umount(); delete store; return -1; @@ -493,7 +493,7 @@ int OSD::init() // load up "current" osdmap assert_warn(!osdmap); if (osdmap) { - derr << __PRETTY_FUNCTION__ << ": unable to read current osdmap" << dendl; + derr << "OSD::init: unable to read current osdmap" << dendl; return -1; } osdmap = new OSDMap; @@ -519,7 +519,7 @@ int OSD::init() dout(2) << "superblock: i am osd" << superblock.whoami << dendl; assert_warn(whoami == superblock.whoami); if (whoami != superblock.whoami) { - derr << __PRETTY_FUNCTION__ << ": logic error: superblock says osd" + derr << "OSD::init: logic error: superblock says osd" << superblock.whoami << " but i am osd" << whoami << dendl; return -EINVAL; } @@ -652,7 +652,7 @@ int OSD::shutdown() g_conf.debug_ebofs = 100; g_conf.debug_ms = 100; - derr << __PRETTY_FUNCTION__ << dendl; + derr << "OSD::shutdown" << dendl; state = STATE_STOPPING; @@ -723,7 +723,7 @@ int OSD::shutdown() write_superblock(t); int r = store->apply_transaction(t); if (r) { - derr << __PRETTY_FUNCTION__ << ": error writing superblock: " + derr << "OSD::shutdown: error writing superblock: " << cpp_strerror(r) << dendl; } -- 2.39.5