From 4f7f3c97b5364209d2bb0ba4405955dea9b89354 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 9 Feb 2009 10:08:26 +0000 Subject: [PATCH] * added coffee_files to the protected memory needed during cfs-based checkpointing operations * renamed cfs_coffee_get_fd_set() to cfs_coffee_get_protected_memory() to highlight that not only fd_set is protected --- core/cfs/cfs-coffee.c | 14 +++++++++----- core/cfs/cfs-coffee.h | 14 +++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/core/cfs/cfs-coffee.c b/core/cfs/cfs-coffee.c index dbb2a26cb..a570ed3c9 100644 --- a/core/cfs/cfs-coffee.c +++ b/core/cfs/cfs-coffee.c @@ -131,8 +131,12 @@ struct log_param { uint16_t size; }; -static struct file coffee_files[COFFEE_MAX_OPEN_FILES]; -static struct file_desc coffee_fd_set[COFFEE_FD_SET_SIZE]; +static struct protected_mem_t { + struct file coffee_files[COFFEE_MAX_OPEN_FILES]; + struct file_desc coffee_fd_set[COFFEE_FD_SET_SIZE]; +} protected_mem; +static struct file *coffee_files = protected_mem.coffee_files; +static struct file_desc *coffee_fd_set = protected_mem.coffee_fd_set; /*---------------------------------------------------------------------------*/ static void @@ -1181,8 +1185,8 @@ cfs_coffee_format(void) } /*---------------------------------------------------------------------------*/ void * -cfs_coffee_get_fd_set(unsigned *size) +cfs_coffee_get_protected_mem(unsigned *size) { - *size = sizeof(coffee_fd_set); - return &coffee_fd_set; + *size = sizeof(protected_mem); + return &protected_mem; } diff --git a/core/cfs/cfs-coffee.h b/core/cfs/cfs-coffee.h index 2f86dd816..f156b79f3 100644 --- a/core/cfs/cfs-coffee.h +++ b/core/cfs/cfs-coffee.h @@ -86,16 +86,16 @@ int cfs_coffee_configure_log(const char *file, unsigned log_size, int cfs_coffee_format(void); /** - * \brief Gives information about the file descriptor area in Coffee. + * \brief Gives information about memory that must not be altered during + * CFS-based checkpointing operations. * \param size - * \return A pointer to the file descriptor set. + * \return A pointer to the protected memory. * - * This function returns the file descriptor set and sets the size - * argument to the number of bytes that the set uses. Mainly used for - * sensornet checkpointing to protect the file descriptor while rolling - * back the state from a file. + * This function returns the protected memory pointer and writes its size + * to the given parameter. Mainly used by sensornet checkpointing to protect + * the coffee state during CFS-based checkpointing operations. */ -void *cfs_coffee_get_fd_set(unsigned *size); +void *cfs_coffee_get_protected_mem(unsigned *size); /** @} */