file_system_mount_option.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef STORAGE_COMMON_FILE_SYSTEM_FILE_SYSTEM_MOUNT_OPTION_H_
  5. #define STORAGE_COMMON_FILE_SYSTEM_FILE_SYSTEM_MOUNT_OPTION_H_
  6. namespace storage {
  7. // Option for specifying if flush or disk sync operation is wanted after
  8. // writing.
  9. enum class FlushPolicy {
  10. // No flushing is required after a writing operation is completed.
  11. FLUSH_ON_COMPLETION,
  12. // Flushing is required in order to commit written data. Note, that syncing
  13. // is only invoked via FileStreamWriter::Flush() and via base::File::Flush()
  14. // for native files. Hence, syncing will not be performed for copying within
  15. // non-native file systems as well as for non-native copies performed with
  16. // snapshots.
  17. NO_FLUSH_ON_COMPLETION
  18. };
  19. // Conveys options for a mounted file systems.
  20. class FileSystemMountOption {
  21. public:
  22. // Constructs with the default options.
  23. FileSystemMountOption()
  24. : flush_policy_(FlushPolicy::NO_FLUSH_ON_COMPLETION) {}
  25. // Constructs with the specified component.
  26. explicit FileSystemMountOption(FlushPolicy flush_policy)
  27. : flush_policy_(flush_policy) {}
  28. FlushPolicy flush_policy() const { return flush_policy_; }
  29. private:
  30. FlushPolicy flush_policy_;
  31. };
  32. } // namespace storage
  33. #endif // STORAGE_COMMON_FILE_SYSTEM_FILE_SYSTEM_MOUNT_OPTION_H_