Rudiments
filesystem.h
1 // Copyright (c) 2003 David Muse
2 // See the COPYING file for more information.
3 
4 #ifndef RUDIMENTS_FILESYSTEM_H
5 #define RUDIMENTS_FILESYSTEM_H
6 
7 #include <rudiments/private/filesystemincludes.h>
8 
9 // TODO:
10 // NetBSD: u_short f_oflags - deprecated copy of mount flags
11 // NetBSD: u_short f_flags - mount flags
12 // OpenBSD: union mount_info mount_info - per fs mount options
13 // FreeBSD: int32_t f_flags - mount flags
14 // SCO OSR5: unsigned long f_flag - mount flags
15 // solaris: u_long f_flag - mount flags
16 
17 #ifdef RUDIMENTS_NAMESPACE
18 namespace rudiments {
19 #endif
20 
21 class filesystemprivate;
22 
36 class RUDIMENTS_DLLSPEC filesystem {
37  public:
39  filesystem();
40 
43  filesystem(const filesystem &f);
44 
47  filesystem &operator=(const filesystem &f);
48 
50  virtual ~filesystem();
51 
56  bool initialize(const char *path);
57 
62  bool initialize(int32_t fd);
63 
66  int64_t getType() const;
67 
73  static bool getType(const char *path, int64_t *type);
74 
81  static bool getType(int32_t fd, int64_t *type);
82 
85  int64_t getBlockSize() const;
86 
92  static bool getBlockSize(const char *path, int64_t *size);
93 
99  static bool getBlockSize(int32_t fd, int64_t *size);
100 
103  int64_t getOptimumTransferBlockSize() const;
104 
110  static bool getOptimumTransferBlockSize(const char *path,
111  int64_t *size);
112 
119  static bool getOptimumTransferBlockSize(int32_t fd,
120  int64_t *size);
121 
125  int64_t getTotalBlocks() const;
126 
132  static bool getTotalBlocks(const char *path,
133  int64_t *blocks);
134 
141  static bool getTotalBlocks(int32_t fd, int64_t *blocks);
142 
145  int64_t getFreeBlocks() const;
146 
152  static bool getFreeBlocks(const char *path,
153  int64_t *blocks);
154 
161  static bool getFreeBlocks(int32_t fd, int64_t *blocks);
162 
166  int64_t getAvailableBlocks() const;
167 
173  static bool getAvailableBlocks(const char *path,
174  int64_t *blocks);
175 
182  static bool getAvailableBlocks(int32_t fd, int64_t *blocks);
183 
186  int64_t getTotalFileNodes() const;
187 
193  static bool getTotalFileNodes(const char *path,
194  int64_t *nodes);
195 
201  static bool getTotalFileNodes(int32_t fd, int64_t *nodes);
202 
205  int64_t getFreeFileNodes() const;
206 
212  static bool getFreeFileNodes(const char *path,
213  int64_t *nodes);
214 
221  static bool getFreeFileNodes(int32_t fd, int64_t *nodes);
222 
226  int64_t getAvailableFileNodes() const;
227 
231  static bool getAvailableFileNodes(const char *path,
232  int64_t *nodes);
233  static bool getAvailableFileNodes(int32_t fd,
234  int64_t *nodes);
235 
238  int64_t getFileSystemId() const;
239 
245  static bool getFileSystemId(const char *path, int64_t *id);
246 
252  static bool getFileSystemId(int32_t fd, int64_t *id);
253 
256  int64_t getMaximumFileNameLength() const;
257 
263  static bool getMaximumFileNameLength(const char *path,
264  int64_t *length);
265 
272  static bool getMaximumFileNameLength(int32_t fd,
273  int64_t *length);
274 
277  uid_t getOwner() const;
278 
284  static bool getOwner(const char *path, uid_t *owner);
285 
292  static bool getOwner(int32_t fd, uid_t *owner);
293 
297  int64_t getSyncWrites() const;
298 
305  static bool getSyncWrites(const char *path,
306  int64_t *swrites);
307 
314  static bool getSyncWrites(int32_t fd, int64_t *swrites);
315 
319  int64_t getAsyncWrites() const;
320 
327  static bool getAsyncWrites(const char *path,
328  int64_t *aswrites);
329 
336  static bool getAsyncWrites(int32_t fd, int64_t *aswrites);
337 
340  const char *getTypeName() const;
341 
347  static bool getTypeName(const char *path,
348  const char **name);
349 
356  static bool getTypeName(int32_t fd, const char **name);
357 
360  const char *getMountPoint() const;
361 
367  static bool getMountPoint(const char *path,
368  const char **mtpt);
369 
375  static bool getMountPoint(int32_t fd, const char **mtpt);
376 
380  int64_t getSyncReads() const;
381 
388  static bool getSyncReads(const char *path, int64_t *sreads);
389 
396  static bool getSyncReads(int32_t fd, int64_t *sreads);
397 
401  int64_t getAsyncReads() const;
402 
409  static bool getAsyncReads(const char *path,
410  int64_t *asreads);
411 
418  static bool getAsyncReads(int32_t fd, int64_t *asreads);
419 
422  const char *getDeviceName() const;
423 
429  static bool getDeviceName(const char *path,
430  const char **devname);
431 
438  static bool getDeviceName(int32_t fd, const char **devname);
439 
442  const char *getFilesystemSpecificString() const;
443 
449  static bool getFilesystemSpecificString(const char *path,
450  const char **str);
451 
458  static bool getFilesystemSpecificString(int32_t fd,
459  const char **str);
460 
461 
465  bool getCurrentProperties();
466 
470  void *getInternalFilesystemStatisticsStructure();
471 
472  #include <rudiments/private/filesystem.h>
473 };
474 
475 #ifdef RUDIMENTS_NAMESPACE
476 }
477 #endif
478 
479 #endif