1 /*
2  * s3fs - FUSE-based file system backed by Amazon S3
3  *
4  * Copyright(C) 2007 Randy Rizun <rrizun@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20 
21 #ifndef S3FS_FDCACHE_STAT_H_
22 #define S3FS_FDCACHE_STAT_H_
23 
24 //------------------------------------------------
25 // CacheFileStat
26 //------------------------------------------------
27 class CacheFileStat
28 {
29     private:
30         std::string path;
31         int         fd;
32 
33     private:
34         static bool MakeCacheFileStatPath(const char* path, std::string& sfile_path, bool is_create_dir = true);
35 
36         bool RawOpen(bool readonly);
37 
38     public:
39         static std::string GetCacheFileStatTopDir();
40         static bool DeleteCacheFileStat(const char* path);
41         static bool CheckCacheFileStatTopDir();
42         static bool DeleteCacheFileStatDirectory();
43         static bool RenameCacheFileStat(const char* oldpath, const char* newpath);
44 
45         explicit CacheFileStat(const char* tpath = NULL);
46         ~CacheFileStat();
47 
48         bool Open();
49         bool ReadOnlyOpen();
50         bool Release();
51         bool SetPath(const char* tpath, bool is_open = true);
GetFd()52         int GetFd() const { return fd; }
53 };
54 
55 #endif // S3FS_FDCACHE_STAT_H_
56 
57 /*
58 * Local variables:
59 * tab-width: 4
60 * c-basic-offset: 4
61 * End:
62 * vim600: expandtab sw=4 ts=4 fdm=marker
63 * vim<600: expandtab sw=4 ts=4
64 */
65