* 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
This commit is contained in:
fros4943 2009-02-09 10:08:26 +00:00
parent 9b23d1553e
commit 4f7f3c97b5
2 changed files with 16 additions and 12 deletions

View File

@ -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;
}

View File

@ -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);
/** @} */