15460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===- Directory.cpp ------------------------------------------------------===//
25460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
35460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//                     The MCLinker Project
45460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
55460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// This file is distributed under the University of Illinois Open Source
65460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// License. See LICENSE.TXT for details.
75460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//
85460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===----------------------------------------------------------------------===//
937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Support/Directory.h"
1037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#include "mcld/Support/FileSystem.h"
115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace mcld {
1337b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace sys {
1437b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace fs {
155460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1637b74a387bb3993387029859c2d9d051c41c724eStephen Hinesnamespace {  // anonymous
175460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1837b74a387bb3993387029859c2d9d051c41c724eStephen Hinesbool status_known(FileStatus f) {
195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return f.type() != StatusError;
205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
215460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
2237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesbool is_symlink(FileStatus f) {
235460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return f.type() == SymlinkFile;
245460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
255460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
26f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hinesconst Path dot_path(".");
27f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hinesconst Path dot_dot_path("..");
28f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines
2937b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // anonymous namespace
305460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
316f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines//===----------------------------------------------------------------------===//
325460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// Directory
336f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines//===----------------------------------------------------------------------===//
345460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei LiaoDirectory::Directory()
3537b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : m_Path(),
3637b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_FileStatus(),
3737b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_SymLinkStatus(),
3837b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Handler(0),
3937b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Cache(),
4037b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_CacheFull(false) {
4137b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
4237b74a387bb3993387029859c2d9d051c41c724eStephen Hines
4337b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory::Directory(const Path& pPath, FileStatus st, FileStatus symlink_st)
4437b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : m_Path(pPath),
4537b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_FileStatus(st),
4637b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_SymLinkStatus(symlink_st),
4737b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Handler(0),
4837b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Cache(),
4937b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_CacheFull(false) {
50f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines  if (m_Path == dot_path)
51f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines    detail::get_pwd(m_Path);
525460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Path.m_append_separator_if_needed();
53f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines  detail::open_dir(*this);
545460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
555460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
5637b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory::Directory(const char* pPath, FileStatus st, FileStatus symlink_st)
5737b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : Directory(sys::fs::Path(pPath), st, symlink_st) {
5837b74a387bb3993387029859c2d9d051c41c724eStephen Hines}
5937b74a387bb3993387029859c2d9d051c41c724eStephen Hines
605460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei LiaoDirectory::Directory(const Directory& pCopy)
6137b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : m_Path(pCopy.m_Path),
6237b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_FileStatus(pCopy.m_FileStatus),
6337b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_SymLinkStatus(pCopy.m_SymLinkStatus),
6437b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Handler(0),
6537b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Cache(),
6637b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_CacheFull(false) {
67f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines  detail::open_dir(*this);
685460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
695460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
7037b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory::~Directory() {
715460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  detail::close_dir(*this);
725460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
735460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
7437b74a387bb3993387029859c2d9d051c41c724eStephen Hinesbool Directory::isGood() const {
755460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return (0 != m_Handler);
765460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
775460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
7837b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory& Directory::operator=(const Directory& pCopy) {
795460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  assign(pCopy.m_Path, pCopy.m_FileStatus, pCopy.m_SymLinkStatus);
805460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return *this;
815460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
825460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
835460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liaovoid Directory::assign(const Path& pPath,
845460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                       FileStatus st,
8537b74a387bb3993387029859c2d9d051c41c724eStephen Hines                       FileStatus symlink_st) {
865460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (isGood())
875460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    clear();
885460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
895460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Path = pPath;
90f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines  if (m_Path == dot_path)
91f7ac0f19a1c8d0ad14bcf6456ce368b830fea886Stephen Hines    detail::get_pwd(m_Path);
925460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Path.m_append_separator_if_needed();
935460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
945460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_FileStatus = st;
955460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_SymLinkStatus = symlink_st;
965460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  detail::open_dir(*this);
975460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
985460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
9937b74a387bb3993387029859c2d9d051c41c724eStephen HinesFileStatus Directory::status() const {
10037b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (!status_known(m_FileStatus)) {
1015460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    // optimization: if the symlink status is known, and it isn't a symlink,
1025460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    // then status and symlink_status are identical so just copy the
1035460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    // symlink status to the regular status.
10437b74a387bb3993387029859c2d9d051c41c724eStephen Hines    if (status_known(m_SymLinkStatus) && !is_symlink(m_SymLinkStatus)) {
1055460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      m_FileStatus = m_SymLinkStatus;
10637b74a387bb3993387029859c2d9d051c41c724eStephen Hines    } else
10737b74a387bb3993387029859c2d9d051c41c724eStephen Hines      detail::status(m_Path, m_FileStatus);
1085460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  }
1095460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return m_FileStatus;
1105460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
11237b74a387bb3993387029859c2d9d051c41c724eStephen HinesFileStatus Directory::symlinkStatus() const {
1135460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (!status_known(m_SymLinkStatus))
11437b74a387bb3993387029859c2d9d051c41c724eStephen Hines    detail::symlink_status(m_Path, m_SymLinkStatus);
11537b74a387bb3993387029859c2d9d051c41c724eStephen Hines  return m_SymLinkStatus;
1165460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1175460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
11837b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory::iterator Directory::begin() {
1195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (m_CacheFull && m_Cache.empty())
1205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return end();
1215460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  PathCache::iterator iter = m_Cache.begin();
12237b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (iter.getEntry() == NULL)
1235460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    ++iter;
1245460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return iterator(this, iter);
1255460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1265460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
12737b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirectory::iterator Directory::end() {
1285460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return iterator(0, m_Cache.end());
1295460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1305460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
13137b74a387bb3993387029859c2d9d051c41c724eStephen Hinesvoid Directory::clear() {
1325460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Path.native().clear();
1335460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_FileStatus = FileStatus();
1345460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_SymLinkStatus = FileStatus();
1355460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Cache.clear();
1365460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  detail::close_dir(*this);
1375460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1385460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1395460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//==========================
1405460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// DirIterator
1415460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei LiaoDirIterator::DirIterator(Directory* pParent,
1425460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao                         const DirIterator::DirCache::iterator& pIter)
14337b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : m_pParent(pParent), m_Iter(pIter) {
1445460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_pEntry = m_Iter.getEntry();
1455460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1465460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1475460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei LiaoDirIterator::DirIterator(const DirIterator& pCopy)
14837b74a387bb3993387029859c2d9d051c41c724eStephen Hines    : m_pParent(pCopy.m_pParent),
14937b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_Iter(pCopy.m_Iter),
15037b74a387bb3993387029859c2d9d051c41c724eStephen Hines      m_pEntry(pCopy.m_pEntry) {
1515460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1525460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
15337b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirIterator::~DirIterator() {
1545460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1555460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
15637b74a387bb3993387029859c2d9d051c41c724eStephen HinesPath* DirIterator::path() {
15737b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (m_pParent == NULL)
1586f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines    return NULL;
1596f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines  return &m_pEntry->value();
1605460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1615460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
16237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesconst Path* DirIterator::path() const {
16337b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (m_pParent == NULL)
1646f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines    return NULL;
1656f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines  return &m_pEntry->value();
1665460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1675460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
16837b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirIterator& DirIterator::operator=(const DirIterator& pCopy) {
1695460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_pParent = pCopy.m_pParent;
1705460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_Iter = pCopy.m_Iter;
1715460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_pEntry = pCopy.m_pEntry;
1725460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return (*this);
1735460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1745460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
17537b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirIterator& DirIterator::operator++() {
17637b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (m_pParent == 0)
1775460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return *this;
1785460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1795460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  // move forward one step first.
1805460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  ++m_Iter;
1815460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1825460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (m_pParent->m_Cache.end() == m_Iter) {
1835460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    if (!m_pParent->m_CacheFull) {
1845460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      m_pEntry = detail::bring_one_into_cache(*this);
18537b74a387bb3993387029859c2d9d051c41c724eStephen Hines      if (m_pEntry == 0 && m_pParent->m_CacheFull)
1865460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao        m_pParent = 0;
1875460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      return *this;
1885460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    }
1895460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    m_pParent = 0;
1905460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return *this;
1915460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  }
1925460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
1935460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_pEntry = m_Iter.getEntry();
1945460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return *this;
1955460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
1965460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
19737b74a387bb3993387029859c2d9d051c41c724eStephen HinesDirIterator DirIterator::operator++(int pIn) {
1985460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  DirIterator tmp(*this);
1995460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
2005460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  // move forward one step first.
2015460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  ++m_Iter;
2025460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
2035460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (m_pParent->m_Cache.end() == m_Iter) {
2045460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    if (!m_pParent->m_CacheFull) {
2055460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      m_pEntry = detail::bring_one_into_cache(*this);
20637b74a387bb3993387029859c2d9d051c41c724eStephen Hines      if (m_pEntry == 0 && m_pParent->m_CacheFull)
2075460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao        m_pParent = 0;
2085460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao      return tmp;
2095460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    }
2105460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    m_pParent = 0;
2115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return tmp;
2125460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  }
2135460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
2145460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  m_pEntry = m_Iter.getEntry();
2155460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return tmp;
2165460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
2175460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
21837b74a387bb3993387029859c2d9d051c41c724eStephen Hinesbool DirIterator::operator==(const DirIterator& y) const {
2195460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  if (m_pParent != y.m_pParent)
2205460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return false;
22137b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (m_pParent == 0)
2225460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return true;
2235460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  const Path* x_path = path();
2245460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  const Path* y_path = y.path();
22537b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (x_path == 0 && y_path == 0)
2265460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return true;
22737b74a387bb3993387029859c2d9d051c41c724eStephen Hines  if (x_path == 0 || y_path == 0)
2285460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao    return false;
2295460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return (*x_path == *y_path);
2305460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
2315460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
23237b74a387bb3993387029859c2d9d051c41c724eStephen Hinesbool DirIterator::operator!=(const DirIterator& y) const {
2335460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao  return !this->operator==(y);
2345460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao}
2355460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao
23637b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // namespace fs
23737b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // namespace sys
23837b74a387bb3993387029859c2d9d051c41c724eStephen Hines}  // namespace mcld
239