return rc;
}
+/* Trim given path to final 10 components and return it by prefixing it with
+ * "..." to indicate that the path has been trimmed. */
+std::string Client::get_trimmed_path(std::string path)
+{
+ std::size_t n = 0;
+ for (int i = 1; i <= 10; ++i) {
+ n = path.rfind("/", n - 1);
+ if (n == std::string::npos)
+ return path;
+ }
+
+ return "..." + path.substr(n, -1);
+}
+
int Client::path_walk(InodeRef dirinode, const filepath& origpath, walk_dentry_result* result, const UserPerm& perms, const PathWalk_ExtraOptions& extra_options)
{
int rc = 0;
int symlinks = 0;
unsigned i = 0;
- ldout(cct, 10) << __func__ << ": cur=" << *diri << " path=" << path << dendl;
+ std::string trimmed_path = get_trimmed_path(path.get_path());
+
+ ldout(cct, 10) << __func__ << ": cur=" << *diri << " path=" << trimmed_path << dendl;
if (path.depth() == 0) {
/* diri/dname can also be used as a filepath; or target */
int caps = 0;
dname = path[i];
ldout(cct, 10) << " " << i << " " << *diri << " " << dname << dendl;
- ldout(cct, 20) << " (path is " << path << ")" << dendl;
+ ldout(cct, 20) << " (path is " << trimmed_path << ")" << dendl;
InodeRef next;
if (!diri.get()->is_dir()) {
ldout(cct, 20) << diri.get() << " is not a dir inode, name " << dname.c_str() << dendl;
int Client::_rmdir(Inode *dir, const char *name, const UserPerm& perms, bool check_perms)
{
- ldout(cct, 8) << "_rmdir(" << dir->ino << " " << name << " uid "
+ ldout(cct, 8) << "_rmdir(" << dir->ino << " " << get_trimmed_path(name) << " uid "
<< perms.uid() << " gid " << perms.gid() << ")" << dendl;
walk_dentry_result wdr;