void FileManager_impl::mount (const char* mountPoint, CF::FileSystem_ptr fileSystem)
    throw (CORBA::SystemException, CF::InvalidFileName,
           CF::FileManager::InvalidFileSystem, CF::FileManager::MountPointAlreadyExists)
{
    TRACE_ENTER(FileManager_impl);

    if (CORBA::is_nil(fileSystem)) {
        throw CF::FileManager::InvalidFileSystem();
    }

    std::string mountPath = normalizeMountPath(mountPoint);
    if (!ossie::isValidFileName(mountPath.c_str())) {
        throw CF::InvalidFileName(CF::CF_EINVAL, "Invalid mount point");
    }

    // Exclusive access to the mount table is required.
    boost::unique_lock<boost::shared_mutex> lock(mountsLock);

    // Ensure that the mount point is not already in use or inside another
    // mount point.
    for (MountList::iterator mount = mountedFileSystems.begin(); mount != mountedFileSystems.end(); ++mount) {
        if (mount->path == mountPath) {
            throw CF::FileManager::MountPointAlreadyExists();
        } else if (mount->contains(mountPath)) {
            throw CF::InvalidFileName(CF::CF_EINVAL, "Cannot mount file system inside another mounted file system");
        }
    }

    LOG_TRACE(FileManager_impl, "Mounting remote file system on " << mountPath);
    mountedFileSystems.push_back(MountPoint(mountPath, fileSystem));

    TRACE_EXIT(FileManager_impl)
}
예제 #2
0
파일: Volume.cpp 프로젝트: Jar-win/Waterfox
void
Volume::Dump(const char* aLabel) const
{
  LOG("%s: Volume: %s (%d) is %s and %s @ %s gen %d locked %d",
      aLabel,
      NameStr(),
      Id(),
      StateStr(),
      MediaPresent() ? "inserted" : "missing",
      MountPoint().get(),
      MountGeneration(),
      (int)IsMountLocked());
  LOG("%s:   Sharing %s Mounting %s Formating %s Unmounting %s",
      aLabel,
      CanBeShared() ? (IsSharingEnabled() ? (IsSharing() ? "en-y" : "en-n")
                                          : "dis")
                    : "x",
      IsMountRequested() ? "req" : "n",
      IsFormatRequested() ? (IsFormatting() ? "req-y" : "req-n")
                          : (IsFormatting() ? "y" : "n"),
      IsUnmountRequested() ? (IsUnmounting() ? "req-y" : "req-n")
                           : (IsUnmounting() ? "y" : "n"));
}