Rudiments
|
00001 // Copyright (c) 2003 David Muse 00002 // See the COPYING file for more information. 00003 00004 #ifndef RUDIMENTS_FILESYSTEM_H 00005 #define RUDIMENTS_FILESYSTEM_H 00006 00007 #include <rudiments/private/filesystemincludes.h> 00008 00009 // TODO: 00010 // NetBSD: u_short f_oflags - deprecated copy of mount flags 00011 // NetBSD: u_short f_flags - mount flags 00012 // OpenBSD: union mount_info mount_info - per fs mount options 00013 // FreeBSD: int32_t f_flags - mount flags 00014 // SCO OSR5: unsigned long f_flag - mount flags 00015 // solaris: u_long f_flag - mount flags 00016 00017 #ifdef RUDIMENTS_NAMESPACE 00018 namespace rudiments { 00019 #endif 00020 00021 class filesystemprivate; 00022 00036 class RUDIMENTS_DLLSPEC filesystem { 00037 public: 00039 filesystem(); 00040 00043 filesystem(const filesystem &f); 00044 00047 filesystem &operator=(const filesystem &f); 00048 00050 virtual ~filesystem(); 00051 00056 bool initialize(const char *path); 00057 00062 bool initialize(int32_t fd); 00063 00066 int64_t getType() const; 00067 00073 static bool getType(const char *path, int64_t *type); 00074 00081 static bool getType(int32_t fd, int64_t *type); 00082 00085 int64_t getBlockSize() const; 00086 00092 static bool getBlockSize(const char *path, int64_t *size); 00093 00099 static bool getBlockSize(int32_t fd, int64_t *size); 00100 00103 int64_t getOptimumTransferBlockSize() const; 00104 00110 static bool getOptimumTransferBlockSize(const char *path, 00111 int64_t *size); 00112 00119 static bool getOptimumTransferBlockSize(int32_t fd, 00120 int64_t *size); 00121 00125 int64_t getTotalBlocks() const; 00126 00132 static bool getTotalBlocks(const char *path, 00133 int64_t *blocks); 00134 00141 static bool getTotalBlocks(int32_t fd, int64_t *blocks); 00142 00145 int64_t getFreeBlocks() const; 00146 00152 static bool getFreeBlocks(const char *path, 00153 int64_t *blocks); 00154 00161 static bool getFreeBlocks(int32_t fd, int64_t *blocks); 00162 00166 int64_t getAvailableBlocks() const; 00167 00173 static bool getAvailableBlocks(const char *path, 00174 int64_t *blocks); 00175 00182 static bool getAvailableBlocks(int32_t fd, int64_t *blocks); 00183 00186 int64_t getTotalFileNodes() const; 00187 00193 static bool getTotalFileNodes(const char *path, 00194 int64_t *nodes); 00195 00201 static bool getTotalFileNodes(int32_t fd, int64_t *nodes); 00202 00205 int64_t getFreeFileNodes() const; 00206 00212 static bool getFreeFileNodes(const char *path, 00213 int64_t *nodes); 00214 00221 static bool getFreeFileNodes(int32_t fd, int64_t *nodes); 00222 00226 int64_t getAvailableFileNodes() const; 00227 00231 static bool getAvailableFileNodes(const char *path, 00232 int64_t *nodes); 00233 static bool getAvailableFileNodes(int32_t fd, 00234 int64_t *nodes); 00235 00238 int64_t getFileSystemId() const; 00239 00245 static bool getFileSystemId(const char *path, int64_t *id); 00246 00252 static bool getFileSystemId(int32_t fd, int64_t *id); 00253 00256 int64_t getMaximumFileNameLength() const; 00257 00263 static bool getMaximumFileNameLength(const char *path, 00264 int64_t *length); 00265 00272 static bool getMaximumFileNameLength(int32_t fd, 00273 int64_t *length); 00274 00277 uid_t getOwner() const; 00278 00284 static bool getOwner(const char *path, uid_t *owner); 00285 00292 static bool getOwner(int32_t fd, uid_t *owner); 00293 00297 int64_t getSyncWrites() const; 00298 00305 static bool getSyncWrites(const char *path, 00306 int64_t *swrites); 00307 00314 static bool getSyncWrites(int32_t fd, int64_t *swrites); 00315 00319 int64_t getAsyncWrites() const; 00320 00327 static bool getAsyncWrites(const char *path, 00328 int64_t *aswrites); 00329 00336 static bool getAsyncWrites(int32_t fd, int64_t *aswrites); 00337 00340 const char *getTypeName() const; 00341 00347 static bool getTypeName(const char *path, 00348 const char **name); 00349 00356 static bool getTypeName(int32_t fd, const char **name); 00357 00360 const char *getMountPoint() const; 00361 00367 static bool getMountPoint(const char *path, 00368 const char **mtpt); 00369 00375 static bool getMountPoint(int32_t fd, const char **mtpt); 00376 00380 int64_t getSyncReads() const; 00381 00388 static bool getSyncReads(const char *path, int64_t *sreads); 00389 00396 static bool getSyncReads(int32_t fd, int64_t *sreads); 00397 00401 int64_t getAsyncReads() const; 00402 00409 static bool getAsyncReads(const char *path, 00410 int64_t *asreads); 00411 00418 static bool getAsyncReads(int32_t fd, int64_t *asreads); 00419 00422 const char *getDeviceName() const; 00423 00429 static bool getDeviceName(const char *path, 00430 const char **devname); 00431 00438 static bool getDeviceName(int32_t fd, const char **devname); 00439 00442 const char *getFilesystemSpecificString() const; 00443 00449 static bool getFilesystemSpecificString(const char *path, 00450 const char **str); 00451 00458 static bool getFilesystemSpecificString(int32_t fd, 00459 const char **str); 00460 00461 00465 bool getCurrentProperties(); 00466 00470 void *getInternalFilesystemStatisticsStructure(); 00471 00472 #include <rudiments/private/filesystem.h> 00473 }; 00474 00475 #ifdef RUDIMENTS_NAMESPACE 00476 } 00477 #endif 00478 00479 #endif