Remove ply_create_detachable_directory() and ply_detach_directory(), add

ply_mount_tmpfs() to do the part of that we still need.
This commit is contained in:
Peter Jones 2008-06-04 13:28:15 -04:00 committed by Peter Jones
parent 44ab737bd0
commit 9ebe607e75
2 changed files with 12 additions and 51 deletions

View file

@ -751,55 +751,6 @@ ply_create_directory (const char *directory)
return true;
}
bool
ply_create_detachable_directory (const char *directory)
{
assert (directory != NULL);
assert (directory[0] != '\0');
ply_trace ("trying to create directory '%s'", directory);
if (!ply_create_directory (directory))
return false;
if (mount ("none", directory, "tmpfs", 0, NULL) < 0)
return false;
return true;
}
int
ply_detach_directory (const char *directory)
{
int dir_fd;
dir_fd = open (directory, O_RDONLY);
if (dir_fd < 0)
{
ply_save_errno ();
umount (directory);
ply_restore_errno ();
return dir_fd;
}
if (!ply_unmount_filesystem (directory))
{
ply_save_errno ();
umount (directory);
ply_restore_errno ();
return false;
}
rmdir (directory);
/* return a file descriptor to the directory because it's now been
* detached from the filesystem. The user can fchdir to this
* directory and work from it that way
*/
return dir_fd;
}
static bool
ply_copy_subdirectory (const char *subdirectory,
const char *parent,
@ -985,6 +936,17 @@ ply_unmount_filesystem (const char *directory)
return true;
}
bool ply_mount_tmpfs (const char *directory)
{
assert (directory != NULL);
assert (directory[0] != '\0');
if (mount ("none", directory, "tmpfs", 0, NULL) < 0)
return false;
return true;
}
bool
ply_move_mount (const char *source, const char *destination)
{

View file

@ -83,12 +83,11 @@ ply_module_function_t ply_module_look_up_function (ply_module_handle_t *handle,
void ply_close_module (ply_module_handle_t *handle);
bool ply_create_directory (const char *directory);
bool ply_create_detachable_directory (const char *directory);
int ply_detach_directory (const char *directory);
bool ply_copy_file (const char *source, const char *destination);
bool ply_copy_directory (const char *source, const char *destination);
bool ply_unmount_filesystem (const char *directory);
bool ply_move_mount (const char *source, const char *destination);
bool ply_mount_tmpfs (const char *directory);
ply_daemon_handle_t *ply_create_daemon (void);
bool ply_detach_daemon (ply_daemon_handle_t *handle,