openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/glib-2.0/1_2.60.3-r0/glib-2.60.3/gio/gfile.c
gboolean g_file_move(GFile* source, GFile* destination, GFileCopyFlags flags,
                     GCancellable* cancellable,
                     GFileProgressCallback progress_callback,
                     gpointer progress_callback_data, GError** error)
{
    GFileIface* iface;
    GError* my_error;
    gboolean res;

    g_return_val_if_fail(G_IS_FILE(source), FALSE);
    g_return_val_if_fail(G_IS_FILE(destination), FALSE);

    if (g_cancellable_set_error_if_cancelled(cancellable, error))
        return FALSE;

    iface = G_FILE_GET_IFACE(destination);
    if (iface->move)
    {
        my_error = NULL;
        res = (*iface->move)(source, destination, flags, cancellable,
                             progress_callback, progress_callback_data,
                             &my_error);

        if (res)
            return TRUE;

        if (my_error->domain != G_IO_ERROR ||
            my_error->code != G_IO_ERROR_NOT_SUPPORTED)
        {
            g_propagate_error(error, my_error);
            return FALSE;
        }
        else
            g_clear_error(&my_error);
    }

    /* If the types are different, and the destination method failed
     * also try the source method
     */
    if (G_OBJECT_TYPE(source) != G_OBJECT_TYPE(destination))
    {
        iface = G_FILE_GET_IFACE(source);

        if (iface->move)
        {
            my_error = NULL;
            res = (*iface->move)(source, destination, flags, cancellable,
                                 progress_callback, progress_callback_data,
                                 &my_error);

            if (res)
                return TRUE;

            if (my_error->domain != G_IO_ERROR ||
                my_error->code != G_IO_ERROR_NOT_SUPPORTED)
            {
                g_propagate_error(error, my_error);
                return FALSE;
            }
            else
                g_clear_error(&my_error);
        }
    }

    if (flags & G_FILE_COPY_NO_FALLBACK_FOR_MOVE)
    {
        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
                            _("Operation not supported"));
        return FALSE;
    }

    flags |= G_FILE_COPY_ALL_METADATA;
    if (!g_file_copy(source, destination, flags, cancellable, progress_callback,
                     progress_callback_data, error))
        return FALSE;

    return g_file_delete(source, cancellable, error);
}
/**
 * g_file_move:
 * @source: #GFile pointing to the source location
 * @destination: #GFile pointing to the destination location
 * @flags: set of #GFileCopyFlags
 * @cancellable: (nullable): optional #GCancellable object,
 *     %NULL to ignore
 * @progress_callback: (nullable) (scope call): #GFileProgressCallback
 *     function for updates
 * @progress_callback_data: (closure): gpointer to user data for
 *     the callback function
 * @error: #GError for returning error conditions, or %NULL
 *
 * Tries to move the file or directory @source to the location specified
 * by @destination. If native move operations are supported then this is
 * used, otherwise a copy + delete fallback is used. The native
 * implementation may support moving directories (for instance on moves
 * inside the same filesystem), but the fallback code does not.
 *
 * If the flag #G_FILE_COPY_OVERWRITE is specified an already
 * existing @destination file is overwritten.
 *
 * If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
 * will be copied as symlinks, otherwise the target of the
 * @source symlink will be copied.
 *
 * If @cancellable is not %NULL, then the operation can be cancelled by
 * triggering the cancellable object from another thread. If the operation
 * was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
 *
 * If @progress_callback is not %NULL, then the operation can be monitored
 * by setting this to a #GFileProgressCallback function.
 * @progress_callback_data will be passed to this function. It is
 * guaranteed that this callback will be called after all data has been
 * transferred with the total number of bytes copied during the operation.
 *
 * If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND
 * error is returned, independent on the status of the @destination.
 *
 * If #G_FILE_COPY_OVERWRITE is not specified and the target exists,
 * then the error %G_IO_ERROR_EXISTS is returned.
 *
 * If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
 * error is returned. If trying to overwrite a directory with a directory the
 * %G_IO_ERROR_WOULD_MERGE error is returned.
 *
 * If the source is a directory and the target does not exist, or
 * #G_FILE_COPY_OVERWRITE is specified and the target is a file, then
 * the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native
 * move operation isn't available).
 *
 * Returns: %TRUE on successful move, %FALSE otherwise.
 */


Tries to move the file or directory @source to the location specified
by @destination. If native move operations are supported then this is
used, otherwise a copy + delete fallback is used. The native
implementation may support moving directories (for instance on moves
inside the same filesystem), but the fallback code does not.

If the flag #G_FILE_COPY_OVERWRITE is specified an already
existing @destination file is overwritten.

If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks
will be copied as symlinks, otherwise the target of the
@source symlink will be copied.

If @cancellable is not %NULL, then the operation can be cancelled by
triggering the cancellable object from another thread. If the operation
was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.

If @progress_callback is not %NULL, then the operation can be monitored
by setting this to a #GFileProgressCallback function.
@progress_callback_data will be passed to this function. It is
guaranteed that this callback will be called after all data has been
transferred with the total number of bytes copied during the operation.

If the @source file does not exist, then the %G_IO_ERROR_NOT_FOUND
error is returned, independent on the status of the @destination.

If #G_FILE_COPY_OVERWRITE is not specified and the target exists,
then the error %G_IO_ERROR_EXISTS is returned.

If trying to overwrite a file over a directory, the %G_IO_ERROR_IS_DIRECTORY
error is returned. If trying to overwrite a directory with a directory the
%G_IO_ERROR_WOULD_MERGE error is returned.

If the source is a directory and the target does not exist, or
#G_FILE_COPY_OVERWRITE is specified and the target is a file, then
the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native
move operation isn't available).

%TRUE on successful move, %FALSE otherwise.
Tries to move the file or directory @source to the location specified by @destination . If native move operations are supported then this is used otherwise a copy + delete fallback is used . The native implementation may support moving directories ( for instance on moves inside the same filesystem ) but the fallback code does not . If the flag #G_FILE_COPY_OVERWRITE is specified an already existing @destination file is overwritten . If the flag #G_FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will be copied as symlinks otherwise the target of the @source symlink will be copied . If @cancellable is not %NULL then the operation can be cancelled by triggering the cancellable object from another thread . If the operation was cancelled the error %G_IO_ERROR_CANCELLED will be returned . If @progress_callback is not %NULL then the operation can be monitored by setting this to a #GFileProgressCallback function . @progress_callback_data will be passed to this function . It is guaranteed that this callback will be called after all data has been transferred with the total number of bytes copied during the operation . If the @source file does not exist then the %G_IO_ERROR_NOT_FOUND error is returned independent on the status of the @destination . If #G_FILE_COPY_OVERWRITE is not specified and the target exists then the error %G_IO_ERROR_EXISTS is returned . If trying to overwrite a file over a directory the %G_IO_ERROR_IS_DIRECTORY error is returned . If trying to overwrite a directory with a directory the %G_IO_ERROR_WOULD_MERGE error is returned . If the source is a directory and the target does not exist or #G_FILE_COPY_OVERWRITE is specified and the target is a file then the %G_IO_ERROR_WOULD_RECURSE error may be returned ( if the native move operation isn ' t available ) . %TRUE on successful move %FALSE otherwise .
gboolean g_file_move(GFile* source, GFile* destination, GFileCopyFlags flags,
                     GCancellable* cancellable,
                     GFileProgressCallback progress_callback,
                     gpointer progress_callback_data, GError** error)
{
    GFileIface* iface;
    GError* my_error;
    gboolean res;
    g_return_val_if_fail(G_IS_FILE(source), FALSE);
    g_return_val_if_fail(G_IS_FILE(destination), FALSE);
    if (g_cancellable_set_error_if_cancelled(cancellable, error))
        return FALSE;
    iface = G_FILE_GET_IFACE(destination);
    if (iface->move)
    {
        my_error = NULL;
        res = (*iface->move)(source, destination, flags, cancellable,
                             progress_callback, progress_callback_data,
                             &my_error);
        if (res)
            return TRUE;
        if (my_error->domain != G_IO_ERROR ||
            my_error->code != G_IO_ERROR_NOT_SUPPORTED)
        {
            g_propagate_error(error, my_error);
            return FALSE;
        }
        else
            g_clear_error(&my_error);
    }
    if (G_OBJECT_TYPE(source) != G_OBJECT_TYPE(destination))
    {
        iface = G_FILE_GET_IFACE(source);
        if (iface->move)
        {
            my_error = NULL;
            res = (*iface->move)(source, destination, flags, cancellable,
                                 progress_callback, progress_callback_data,
                                 &my_error);
            if (res)
                return TRUE;
            if (my_error->domain != G_IO_ERROR ||
                my_error->code != G_IO_ERROR_NOT_SUPPORTED)
            {
                g_propagate_error(error, my_error);
                return FALSE;
            }
            else
                g_clear_error(&my_error);
        }
    }
    if (flags & G_FILE_COPY_NO_FALLBACK_FOR_MOVE)
    {
        g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
                            _("Operation not supported"));
        return FALSE;
    }
    flags |= G_FILE_COPY_ALL_METADATA;
    if (!g_file_copy(source, destination, flags, cancellable, progress_callback,
                     progress_callback_data, error))
        return FALSE;
    return g_file_delete(source, cancellable, error);
}
gboolean g_file_move ( GFile * source , GFile * destination , GFileCopyFlags flags , GCancellable * cancellable , GFileProgressCallback progress_callback , gpointer progress_callback_data , GError * * error ) { GFileIface * iface ; GError * my_error ; gboolean res ; g_return_val_if_fail ( G_IS_FILE ( source ) , FALSE ) ; g_return_val_if_fail ( G_IS_FILE ( destination ) , FALSE ) ; if ( g_cancellable_set_error_if_cancelled ( cancellable , error ) ) return FALSE ; iface = G_FILE_GET_IFACE ( destination ) ; if ( iface -> move ) { my_error = NULL ; res = ( * iface -> move ) ( source , destination , flags , cancellable , progress_callback , progress_callback_data , & my_error ) ; if ( res ) return TRUE ; if ( my_error -> domain != G_IO_ERROR || my_error -> code != G_IO_ERROR_NOT_SUPPORTED ) { g_propagate_error ( error , my_error ) ; return FALSE ; } else g_clear_error ( & my_error ) ; } if ( G_OBJECT_TYPE ( source ) != G_OBJECT_TYPE ( destination ) ) { iface = G_FILE_GET_IFACE ( source ) ; if ( iface -> move ) { my_error = NULL ; res = ( * iface -> move ) ( source , destination , flags , cancellable , progress_callback , progress_callback_data , & my_error ) ; if ( res ) return TRUE ; if ( my_error -> domain != G_IO_ERROR || my_error -> code != G_IO_ERROR_NOT_SUPPORTED ) { g_propagate_error ( error , my_error ) ; return FALSE ; } else g_clear_error ( & my_error ) ; } } if ( flags & G_FILE_COPY_NO_FALLBACK_FOR_MOVE ) { g_set_error_literal ( error , G_IO_ERROR , G_IO_ERROR_NOT_SUPPORTED , _ ( " " ) ) ; return FALSE ; } flags |= G_FILE_COPY_ALL_METADATA ; if ( ! g_file_copy ( source , destination , flags , cancellable , progress_callback , progress_callback_data , error ) ) return FALSE ; return g_file_delete ( source , cancellable , error ) ; }
g_file_move:
 @source: #GFile pointing to the source location
 @destination: #GFile pointing to the destination location
 @flags: set of #GFileCopyFlags
 @cancellable: (nullable): optional #GCancellable object,
     %NULL to ignore
 @progress_callback: (nullable) (scope call): #GFileProgressCallback
     function for updates
 @progress_callback_data: (closure): gpointer to user data for
     the callback function
 @error: #GError for returning error conditions, or %NULL
g_file_move : @source : #GFile pointing to the source location @destination : #GFile pointing to the destination location @flags : set of #GFileCopyFlags @cancellable : ( nullable ) : optional #GCancellable object %NULL to ignore @progress_callback : ( nullable ) ( scope call ) : #GFileProgressCallback function for updates @progress_callback_data : ( closure ) : gpointer to user data for the callback function @error : #GError for returning error conditions or %NULL
/* If the types are different, and the destination method failed
     * also try the source method
     */