00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2014 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // This file is part of the XRootD software suite. 00006 // 00007 // XRootD is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU Lesser General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // XRootD is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // In applying this licence, CERN does not waive the privileges and immunities 00021 // granted to it by virtue of its status as an Intergovernmental Organization 00022 // or submit itself to any jurisdiction. 00023 //------------------------------------------------------------------------------ 00024 00025 #ifndef __XRD_CL_FILE_SYSTEM_UTILS_HH__ 00026 #define __XRD_CL_FILE_SYSTEM_UTILS_HH__ 00027 00028 #include "XrdCl/XrdClXRootDResponses.hh" 00029 00030 #include <string> 00031 #include <stdint.h> 00032 #include <memory> 00033 00034 namespace XrdCl 00035 { 00036 class FileSystem; 00037 00038 //---------------------------------------------------------------------------- 00041 //---------------------------------------------------------------------------- 00042 class FileSystemUtils 00043 { 00044 //------------------------------------------------------------------------ 00045 // Forward declaration for PIMPL 00046 //------------------------------------------------------------------------ 00047 struct SpaceInfoImpl; 00048 00049 public: 00050 //------------------------------------------------------------------------ 00052 //------------------------------------------------------------------------ 00053 class SpaceInfo 00054 { 00055 public: 00056 SpaceInfo( uint64_t total, uint64_t free, uint64_t used, 00057 uint64_t largestChunk ); 00058 00059 ~SpaceInfo(); 00060 00061 //-------------------------------------------------------------------- 00063 //-------------------------------------------------------------------- 00064 uint64_t GetTotal() const; 00065 00066 //-------------------------------------------------------------------- 00068 //-------------------------------------------------------------------- 00069 uint64_t GetFree() const; 00070 00071 //-------------------------------------------------------------------- 00073 //-------------------------------------------------------------------- 00074 uint64_t GetUsed() const; 00075 00076 //-------------------------------------------------------------------- 00078 //-------------------------------------------------------------------- 00079 uint64_t GetLargestFreeChunk() const; 00080 00081 private: 00082 std::unique_ptr<SpaceInfoImpl> pImpl; 00083 }; 00084 00085 //------------------------------------------------------------------------ 00087 //------------------------------------------------------------------------ 00088 static XRootDStatus GetSpaceInfo( SpaceInfo *&result, 00089 FileSystem *fs, 00090 const std::string &path ); 00091 }; 00092 } 00093 00094 #endif // __XRD_CL_FILE_SYSTEM_UTILS HH__