Add unit(in variable) & fix bugs
[platform/core/system/resourced.git] / src / resource-optimizer / memory / swap / fileswap.c
index 5e0c487..748083d 100644 (file)
 struct swap_file_control {
        char crypt_type[MAX_TYPE_LENGTH];
        char swapfile[64];
-       long swap_file_size;
-       unsigned long swap_reclaim_bytes;
+       unsigned long long swap_file_bytes;
+       unsigned long long swap_reclaim_bytes;
 };
 
 static struct swap_file_control file_control = {
        .crypt_type = "aes",
        .swapfile = SWAP_FILE_NAME,
-       .swap_file_size = DEFAULT_SWAP_FILE_SIZE,
+       .swap_file_bytes = DEFAULT_SWAP_FILE_SIZE,
        .swap_reclaim_bytes = 0,
 };
 
@@ -51,7 +51,7 @@ static int swap_file_activate(void *data)
        struct swap_module_ops *swap = (struct swap_module_ops *)data;
 
        file_control.swap_reclaim_bytes =
-                       file_control.swap_file_size * FILESWAP_FULLNESS_RATIO;
+                       file_control.swap_file_bytes * FILESWAP_FULLNESS_RATIO;
 
        return swap_set_file(file_control.swapfile, swap, file_control.crypt_type);
 }
@@ -60,7 +60,7 @@ static int swap_file_reclaim(void *data)
 {
        struct swap_module_ops *swap = (struct swap_module_ops *)data;
        _cleanup_proc_swaps_free_ struct proc_swaps **swaps = NULL;
-       unsigned int swap_size = 0;
+       unsigned long long swap_size = 0;
        int n, i;
 
        n = proc_get_swaps(&swaps);
@@ -103,14 +103,14 @@ static int swap_file_init(void *data)
 {
        struct swap_module_ops *swap = (struct swap_module_ops *)data;
 
-       swap->k_size = BYTE_TO_KBYTE(file_control.swap_file_size);
+       swap->k_size = BYTE_TO_KBYTE(file_control.swap_file_bytes);
        return 0;
 }
 
 static int swap_file_conf(void *data)
 {
        _I("[SWAP] fileswap crypt type = %s", file_control.crypt_type);
-       _I("[SWAP] fileswap file size = %ld", file_control.swap_file_size);
+       _I("[SWAP] fileswap file size = %llu bytes", file_control.swap_file_bytes);
 
        return RESOURCED_ERROR_NONE;
 }