next up previous contents index
Next: 7.5.6 mkdir: Create a Up: 7.5 oskit_dir: Directory Interface Previous: 7.5.4 unlink: Unlink a

7.5.5 rename: Rename a file from this directory

 

SYNOPSIS

#include <oskit/fs/dir.h>

oskit_error_t oskit_dir_rename(oskit_dir_t *old_dir, const char *old_name, oskit_dir_t *new_dir, const char *new_name);

DIRECTION

client OS tex2html_wrap_inline32841 filesystem library

DESCRIPTION

This method atomically links the file named by old_name in old_dir into new_dir, using new_name for the new directory entry, and unlinks old_name from old_dir.

If a file named new_name already exists in new_dir, then it is first removed. In this case, the source and target files must either both be directories or both be non-directories, and if the target file is a directory, it must be empty.

Typically, this is only supported if new_dir resides in the same filesystem as old_dir.

The old_name and new_name may each only be a single component; multi-component lookups are not supported.

PARAMETERS

old_dir
This directory.
old_name
The name of the file to be renamed.
new_dir
The target directory.
new_name
The name for the new directory entry.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



University of Utah Flux Research Group