// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- /* * Ceph - scalable distributed file system * * Copyright (C) 2004-2006 Sage Weil * * This is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software * Foundation. See file COPYING. * */ #ifndef __FILEPATH_H #define __FILEPATH_H /* * BUG: /a/b/c is equivalent to a/b/c in dentry-breakdown, but not string. * -> should it be different? how? should this[0] be "", with depth 4? * */ #include #include #include using namespace std; #include using namespace __gnu_cxx; #include "buffer.h" class filepath { string path; vector bits; void rebuild() { if (absolute()) path = "/"; else path.clear(); for (unsigned i=0; i::iterator it = bits.begin(); it != bits.end(); it++) { r.append((*it).c_str(), (*it).length()+1); } } void _unrope(crope& r, int& off) { clear(); char n; r.copy(off, sizeof(char), (char*)&n); off += sizeof(char); for (int i=0; i::iterator it = bits.begin(); it != bits.end(); it++) { bl.append((*it).c_str(), (*it).length()+1); } } void _decode(bufferlist& bl, int& off) { clear(); char n; bl.copy(off, sizeof(char), (char*)&n); off += sizeof(char); for (int i=0; i