Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1494)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_file_system.cc

Issue 22256004: Compute available disk space in Files.app by statvfs.f_bavail, not f_free (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste m.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste m.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/statvfs.h> 8 #include <sys/statvfs.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <utime.h> 10 #include <utime.h>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 // Retrieves total and remaining available size on |mount_path|. 130 // Retrieves total and remaining available size on |mount_path|.
131 void GetSizeStatsOnBlockingPool(const std::string& mount_path, 131 void GetSizeStatsOnBlockingPool(const std::string& mount_path,
132 uint64* total_size, 132 uint64* total_size,
133 uint64* remaining_size) { 133 uint64* remaining_size) {
134 struct statvfs stat = {}; // Zero-clear 134 struct statvfs stat = {}; // Zero-clear
135 if (HANDLE_EINTR(statvfs(mount_path.c_str(), &stat)) == 0) { 135 if (HANDLE_EINTR(statvfs(mount_path.c_str(), &stat)) == 0) {
136 *total_size = 136 *total_size =
137 static_cast<uint64>(stat.f_blocks) * stat.f_frsize; 137 static_cast<uint64>(stat.f_blocks) * stat.f_frsize;
138 *remaining_size = 138 *remaining_size =
139 static_cast<uint64>(stat.f_bfree) * stat.f_frsize; 139 static_cast<uint64>(stat.f_bavail) * stat.f_frsize;
140 } 140 }
141 } 141 }
142 142
143 // Retrieves the maximum file name length of the file system of |path|. 143 // Retrieves the maximum file name length of the file system of |path|.
144 // Returns 0 if it could not be queried. 144 // Returns 0 if it could not be queried.
145 size_t GetFileNameMaxLengthOnBlockingPool(const std::string& path) { 145 size_t GetFileNameMaxLengthOnBlockingPool(const std::string& path) {
146 struct statvfs stat = {}; 146 struct statvfs stat = {};
147 if (statvfs(path.c_str(), &stat) != 0) { 147 if (statvfs(path.c_str(), &stat) != 0) {
148 // The filesystem seems not supporting statvfs(). Assume it to be a commonly 148 // The filesystem seems not supporting statvfs(). Assume it to be a commonly
149 // used bound 255, and log the failure. 149 // used bound 255, and log the failure.
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 render_view_host(), profile(), GURL(volume_file_url)); 592 render_view_host(), profile(), GURL(volume_file_url));
593 if (file_path.empty()) 593 if (file_path.empty())
594 return false; 594 return false;
595 595
596 DiskMountManager::GetInstance()->FormatMountedDevice(file_path.value()); 596 DiskMountManager::GetInstance()->FormatMountedDevice(file_path.value());
597 SendResponse(true); 597 SendResponse(true);
598 return true; 598 return true;
599 } 599 }
600 600
601 } // namespace file_manager 601 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698