2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2016-04-29 19:14:52 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2016 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "sd-bus.h"
|
|
|
|
#include "sd-event.h"
|
|
|
|
|
|
|
|
#include "list.h"
|
|
|
|
|
|
|
|
typedef struct Operation Operation;
|
|
|
|
|
|
|
|
#include "machined.h"
|
|
|
|
|
|
|
|
#define OPERATIONS_MAX 64
|
|
|
|
|
|
|
|
struct Operation {
|
|
|
|
Manager *manager;
|
2016-04-29 20:32:56 +02:00
|
|
|
Machine *machine;
|
2016-04-29 19:14:52 +02:00
|
|
|
pid_t pid;
|
|
|
|
sd_bus_message *message;
|
|
|
|
int errno_fd;
|
2016-06-24 16:01:14 +02:00
|
|
|
int extra_fd;
|
2016-04-29 19:14:52 +02:00
|
|
|
sd_event_source *event_source;
|
2016-06-24 16:01:14 +02:00
|
|
|
int (*done)(Operation *o, int ret, sd_bus_error *error);
|
2016-04-29 19:14:52 +02:00
|
|
|
LIST_FIELDS(Operation, operations);
|
2016-04-29 20:32:56 +02:00
|
|
|
LIST_FIELDS(Operation, operations_by_machine);
|
2016-04-29 19:14:52 +02:00
|
|
|
};
|
|
|
|
|
2016-06-24 16:01:14 +02:00
|
|
|
int operation_new(Manager *manager, Machine *machine, pid_t child, sd_bus_message *message, int errno_fd, Operation **ret);
|
2016-04-29 19:14:52 +02:00
|
|
|
Operation *operation_free(Operation *o);
|