Commit a7fabff1 by Celine Mercier

C: made it so column DIR* are not kept open to handle very large DMS

parent f2965177
......@@ -177,15 +177,13 @@ OBIDMS_column_directory_p obi_open_column_directory(OBIDMS_p dms, const char* co
// Initialize the data structure
strcpy(column_directory->directory_name, column_directory_name);
strcpy(column_directory->column_name, column_name);
column_directory->directory = directory;
column_directory->dir_fd = dirfd(directory);
if (column_directory->dir_fd < 0)
if (closedir(directory) < 0)
{
obi_set_errno(OBICOLDIR_MEMORY_ERROR);
obidebug(1, "\nError allocating the memory for an OBIDMS column directory structure");
obidebug(1, "\nError closing a DIR after opening a column directory");
free(column_directory_name);
free(column_directory);
return NULL;
}
free(column_directory_name);
......@@ -215,17 +213,7 @@ OBIDMS_column_directory_p obi_column_directory(OBIDMS_p dms, const char* column_
int obi_close_column_directory(OBIDMS_column_directory_p column_directory)
{
if (column_directory != NULL)
{
// Close the column directory
if (closedir(column_directory->directory) < 0)
{
obi_set_errno(OBICOLDIR_MEMORY_ERROR);
obidebug(1, "\nError closing a column directory");
free(column_directory);
return -1;
}
free(column_directory);
}
return 0;
}
......
......@@ -40,12 +40,6 @@ typedef struct OBIDMS_column_directory {
char directory_name[OBIDMS_COLUMN_MAX_NAME+1]; /**< The name of the directory
* containing the column.
*/
DIR* directory; /**< A directory entry usable to
* refer and scan the column directory.
*/
int dir_fd; /**< The file descriptor of the directory entry
* usable to refer and scan the column directory.
*/
} OBIDMS_column_directory_t, *OBIDMS_column_directory_p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment