Skip to content

Commit

Permalink
[common/protected_files] Remove unused fields
Browse files Browse the repository at this point in the history
Signed-off-by: Marcelina Kościelnicka <mwk@0x04.net>
  • Loading branch information
mwkmwkmwk committed Feb 28, 2024
1 parent 63ee38d commit f9390a6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
10 changes: 0 additions & 10 deletions common/src/protected_files/protected_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ static void ipf_init_root_mht(file_node_t* mht) {
mht->type = FILE_MHT_NODE_TYPE;
mht->physical_node_number = 1;
mht->node_number = 0;
mht->new_node = true;
mht->need_writing = false;
}

Expand Down Expand Up @@ -414,7 +413,6 @@ static bool ipf_write_all_changes_to_disk(pf_context_t* pf) {
}

file_node->need_writing = false;
file_node->new_node = false;
}

if (!ipf_write_node(pf, pf->file, /*node_number=*/1, &pf->root_mht.encrypted,
Expand All @@ -423,7 +421,6 @@ static bool ipf_write_all_changes_to_disk(pf_context_t* pf) {
}

pf->root_mht.need_writing = false;
pf->root_mht.new_node = false;
}

if (!ipf_write_node(pf, pf->file, /*node_number=*/0, &pf->file_metadata, PF_NODE_SIZE)) {
Expand Down Expand Up @@ -538,7 +535,6 @@ static file_node_t* ipf_append_mht_node(pf_context_t* pf, uint64_t mht_node_numb
}

new_file_mht_node->type = FILE_MHT_NODE_TYPE;
new_file_mht_node->new_node = true;
new_file_mht_node->parent = parent_file_mht_node;
new_file_mht_node->node_number = mht_node_number;
new_file_mht_node->physical_node_number = physical_node_number;
Expand Down Expand Up @@ -628,7 +624,6 @@ static file_node_t* ipf_append_data_node(pf_context_t* pf, uint64_t offset) {
get_node_numbers(offset, NULL, &node_number, NULL, &physical_node_number);

new_file_data_node->type = FILE_DATA_NODE_TYPE;
new_file_data_node->new_node = true;
new_file_data_node->parent = file_mht_node;
new_file_data_node->node_number = node_number;
new_file_data_node->physical_node_number = physical_node_number;
Expand Down Expand Up @@ -801,7 +796,6 @@ static bool ipf_init_fields(pf_context_t* pf) {
pf->need_writing = false;
pf->file_status = PF_STATUS_UNINITIALIZED;
pf->last_error = PF_STATUS_SUCCESS;
pf->real_file_size = 0;

pf->cache = lruc_create();
return true;
Expand Down Expand Up @@ -870,8 +864,6 @@ static bool ipf_init_existing_file(pf_context_t* pf, const char* path) {
pf->last_error = status;
return false;
}

pf->root_mht.new_node = false;
}

return true;
Expand Down Expand Up @@ -950,7 +942,6 @@ static pf_context_t* ipf_open(const char* path, pf_file_mode_t mode, bool create
}

pf->file = file;
pf->real_file_size = real_size;
pf->mode = mode;

if (!create) {
Expand Down Expand Up @@ -1263,7 +1254,6 @@ pf_status_t pf_set_size(pf_context_t* pf, uint64_t size) {
ipf_init_root_mht(&pf->root_mht);

pf->need_writing = true;
pf->real_file_size = 0;

while ((data = lruc_get_last(pf->cache)) != NULL) {
file_node_t* file_node = (file_node_t*)data;
Expand Down
1 change: 0 additions & 1 deletion common/src/protected_files/protected_files_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ typedef struct _file_node {
uint64_t node_number;
struct _file_node* parent;
bool need_writing;
bool new_node;
struct {
uint64_t physical_node_number;
encrypted_node_t encrypted; // the actual data from the disk
Expand Down
1 change: 0 additions & 1 deletion common/src/protected_files/protected_files_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ struct pf_context {
file_node_t root_mht; // the root of the mht is always needed (for files bigger than 3KB)
pf_handle_t file;
pf_file_mode_t mode;
uint64_t real_file_size;
bool need_writing;
pf_status_t file_status;
pf_key_t user_kdk_key;
Expand Down

0 comments on commit f9390a6

Please sign in to comment.