/**
 * File:
 *   idedma_write.ycp
 *
 * Package:
 *   Configuration of IDE DMA mode
 *
 * Summary:
 *   Writing only client
 *
 * Authors:
 *   Ladislav Slezak <lslezak@suse.cz>
 *
 * $Id: idedma_write.ycp 15079 2004-03-01 15:45:52Z lslezak $
 *
 * This is a write-only client. It takes its arguments and just
 * write the settings.
 */

/**
 * @param first a map of idedma settings
 * @return boolean success of operation
 * @example map mm = $[ "dma_on" : false, ... ];
 * @example any ret = WFM::CallModule ("idedma_write", [ mm ]);
 */

{
    textdomain "tune";

    import "Idedma";

    list args = WFM::Args ();
    if ( size (args) <= 0 )
    {
	y2error ("NOT writing, probably some mistake...");
	return false;
    }
    if ( !is ( WFM::Args (0), map ) )
    {
	y2error ("Bad argument for idedma write: %1", WFM::Args (0));
	return false;
    }

    // The settings are in the first argument
    list<map<string,any> > settings = (list<map<string,any> >) (args[0]:[]);
    y2milestone("Only writing... (%1)", settings);

    if (! Idedma::Import (settings))
    {
	return false;
    }

    boolean ret = Idedma::Write();
    return ret;
}
