openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/nbd/3.19-r0/nbd-3.19/nbd-server.c
int expflush(CLIENT* client)
{
    gint i;

    if (client->server->flags & F_COPYONWRITE)
    {
        return fsync(client->difffile);
    }

    if (client->server->flags & F_WAIT)
    {
        return fsync(client->difffile);
    }

    if (client->server->flags & F_TREEFILES)
    {
        // all we can do is force sync the entire filesystem containing the tree
        if (client->server->flags & F_READONLY)
            return 0;
        sync();
        return 0;
    }

    for (i = 0; i < client->export->len; i++)
    {
        FILE_INFO fi = g_array_index(client->export, FILE_INFO, i);
        if (fsync(fi.fhandle) < 0)
            return -1;
    }

    return 0;
}
/**
 * Flush data to a client
 *
 * @param client The client we're going to write for.
 * @return 0 on success, nonzero on failure
 **/
Flush data to a client
@param client The client we're going to write for.
@return 0 on success, nonzero on failure
Flush data to a client @param client The client we ' re going to write for . @return 0 on success nonzero on failure
int expflush(CLIENT* client)
{
    gint i;
    if (client->server->flags & F_COPYONWRITE)
    {
        return fsync(client->difffile);
    }
    if (client->server->flags & F_WAIT)
    {
        return fsync(client->difffile);
    }
    if (client->server->flags & F_TREEFILES)
    {
        if (client->server->flags & F_READONLY)
            return 0;
        sync();
        return 0;
    }
    for (i = 0; i < client->export->len; i++)
    {
        FILE_INFO fi = g_array_index(client->export, FILE_INFO, i);
        if (fsync(fi.fhandle) < 0)
            return -1;
    }
    return 0;
}
int expflush ( CLIENT * client ) { gint i ; if ( client -> server -> flags & F_COPYONWRITE ) { return fsync ( client -> difffile ) ; } if ( client -> server -> flags & F_WAIT ) { return fsync ( client -> difffile ) ; } if ( client -> server -> flags & F_TREEFILES ) { if ( client -> server -> flags & F_READONLY ) return 0 ; sync ( ) ; return 0 ; } for ( i = 0 ; i < client -> export -> len ; i ++ ) { FILE_INFO fi = g_array_index ( client -> export , FILE_INFO , i ) ; if ( fsync ( fi . fhandle ) < 0 ) return -1 ; } return 0 ; }
Flush data to a client
 @param client The client we're going to write for.
Flush data to a client @param client The client we ' re going to write for .
// all we can do is force sync the entire filesystem containing the tree