static ssize_t upgrade_proc_write(struct file *file, const char __user *buf, 
            size_t count, loff_t *ppos)
{
    struct partition_package *package;
    int err;
    size_t size;
    //int len;

    package = kzalloc(count, GFP_KERNEL);
    if (!package) {
        err = -ENOMEM;
        part_err("upgrade_proc_write: fail to malloc package\n");
        goto fail_malloc;
    }

    size = simple_write_to_buffer(package, sizeof(*package), ppos, buf, count);
    if (size < 0) {
        err = size;
        part_err("upgrade_proc_write: fail to receive data(%zu)\n", size);
        goto out;
    }

    err = upgrade_handler(package, size);
    
out:
    kfree(package);
fail_malloc:
    if (err)
        return err;
    else
        return count;
}
Exemple #2
0
static void run_master(void)
{
	unsigned id;
	size_t running = worker_processes;

	master_selfwake = mog_selfwake_new();
	siginit(master_wakeup_handler);

	for (id = 0; id < worker_processes; id++)
		fork_worker(id);

	while (running > 0) {
		mog_selfwake_wait(master_selfwake);
		if (sigchld_hit)
			sigchld_handler();
		if (do_upgrade)
			upgrade_handler();
		if (do_exit)
			running = mog_kill_each_worker(SIGQUIT);
	}
}
Exemple #3
0
static void main_worker_loop(const pid_t parent)
{
	mog_cancel_disable(); /* mog_idleq_wait() now relies on this */
	while (parent == 0 || parent == getppid()) {
		mog_notify_wait(have_mgmt);
		if (sigchld_hit)
			sigchld_handler();
		if (do_upgrade)
			upgrade_handler();
		if (do_exit)
			cmogstored_exit();
		if (have_mgmt)
			mog_mnt_refresh();
		else if (have_mgmt && !iostat_running && !do_exit)
			/*
			 * maybe iostat was not installed/available/usable at
			 * startup, but became usable later
			 */
			iostat_running = mog_iostat_respawn(0);
	}

	syslog(LOG_INFO, "parent=%d abandoned us, dying", parent);
	cmogstored_exit();
}