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 00033 namespace XrdCl 00034 { 00035 class FileSystem; 00036 00037 //---------------------------------------------------------------------------- 00040 //---------------------------------------------------------------------------- 00041 class FileSystemUtils 00042 { 00043 public: 00044 //------------------------------------------------------------------------ 00046 //------------------------------------------------------------------------ 00047 class SpaceInfo 00048 { 00049 public: 00050 SpaceInfo( uint64_t total, uint64_t free, uint64_t used, 00051 uint64_t largestChunk ): 00052 pTotal( total ), pFree( free ), pUsed( used ), 00053 pLargestChunk( largestChunk ) { } 00054 00055 //-------------------------------------------------------------------- 00057 //-------------------------------------------------------------------- 00058 uint64_t GetTotal() const { return pTotal; } 00059 00060 //-------------------------------------------------------------------- 00062 //-------------------------------------------------------------------- 00063 uint64_t GetFree() const { return pFree; } 00064 00065 //-------------------------------------------------------------------- 00067 //-------------------------------------------------------------------- 00068 uint64_t GetUsed() const { return pUsed; } 00069 00070 //-------------------------------------------------------------------- 00072 //-------------------------------------------------------------------- 00073 uint64_t GetLargestFreeChunk() const { return pLargestChunk; } 00074 00075 private: 00076 uint64_t pTotal; 00077 uint64_t pFree; 00078 uint64_t pUsed; 00079 uint64_t pLargestChunk; 00080 }; 00081 00082 //------------------------------------------------------------------------ 00084 //------------------------------------------------------------------------ 00085 static XRootDStatus GetSpaceInfo( SpaceInfo *&result, 00086 FileSystem *fs, 00087 const std::string &path ); 00088 }; 00089 } 00090 00091 #endif // __XRD_CL_FILE_SYSTEM_UTILS HH__