|
22 | 22 | import gdrivefs.gdfs.opened_file
|
23 | 23 | import gdrivefs.config
|
24 | 24 | import gdrivefs.config.changes
|
| 25 | +import gdrivefs.config.fs |
25 | 26 |
|
26 | 27 | from gdrivefs.utility import utility
|
27 | 28 | from gdrivefs.change import get_change_manager
|
@@ -117,6 +118,8 @@ def __get_open_file(self, fh):
|
117 | 118 | def __build_stat_from_entry(self, entry):
|
118 | 119 | (uid, gid, pid) = fuse_get_context()
|
119 | 120 |
|
| 121 | + block_size_b = gdrivefs.config.fs.CALCULATION_BLOCK_SIZE |
| 122 | + |
120 | 123 | if entry.is_directory:
|
121 | 124 | effective_permission = int(Conf.get('default_perm_folder'),
|
122 | 125 | 8)
|
@@ -149,7 +152,8 @@ def __build_stat_from_entry(self, entry):
|
149 | 152 | stat_result["st_mode"] = (stat.S_IFREG | effective_permission)
|
150 | 153 | stat_result["st_nlink"] = 1
|
151 | 154 |
|
152 |
| - stat_result["st_blocks"] = int(math.ceil(float(stat_result["st_size"]) / 512.0)) |
| 155 | + stat_result["st_blocks"] = \ |
| 156 | + int(math.ceil(float(stat_result["st_size"]) / block_size_b)) |
153 | 157 |
|
154 | 158 | return stat_result
|
155 | 159 |
|
@@ -553,7 +557,7 @@ def statfs(self, filepath):
|
553 | 557 | REF: http://stackoverflow.com/questions/4965355/converting-statvfs-to-percentage-free-correctly
|
554 | 558 | """
|
555 | 559 |
|
556 |
| - block_size = 512 |
| 560 | + block_size_b = gdrivefs.config.fs.CALCULATION_BLOCK_SIZE |
557 | 561 |
|
558 | 562 | try:
|
559 | 563 | account_info = AccountInfo.get_instance()
|
|
0 commit comments