1c79331a4SRobert Wing /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3c79331a4SRobert Wing * 4c79331a4SRobert Wing * Copyright (c) 2022 Rob Wing <rew@FreeBSD.org> 5c79331a4SRobert Wing * 6c79331a4SRobert Wing * Redistribution and use in source and binary forms, with or without 7c79331a4SRobert Wing * modification, are permitted provided that the following conditions 8c79331a4SRobert Wing * are met: 9c79331a4SRobert Wing * 1. Redistributions of source code must retain the above copyright 10c79331a4SRobert Wing * notice, this list of conditions and the following disclaimer. 11c79331a4SRobert Wing * 2. Redistributions in binary form must reproduce the above copyright 12c79331a4SRobert Wing * notice, this list of conditions and the following disclaimer in the 13c79331a4SRobert Wing * documentation and/or other materials provided with the distribution. 14c79331a4SRobert Wing * 15c79331a4SRobert Wing * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16c79331a4SRobert Wing * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17c79331a4SRobert Wing * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18c79331a4SRobert Wing * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19c79331a4SRobert Wing * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20c79331a4SRobert Wing * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21c79331a4SRobert Wing * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22c79331a4SRobert Wing * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23c79331a4SRobert Wing * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24c79331a4SRobert Wing * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25c79331a4SRobert Wing * SUCH DAMAGE. 26c79331a4SRobert Wing * 27c79331a4SRobert Wing */ 28c79331a4SRobert Wing 29c79331a4SRobert Wing #ifndef _IPC_H_ 30c79331a4SRobert Wing #define _IPC_H_ 31c79331a4SRobert Wing 32c79331a4SRobert Wing #include <sys/cdefs.h> 33c79331a4SRobert Wing #include <sys/linker_set.h> 34c79331a4SRobert Wing #include <sys/nv.h> 35c79331a4SRobert Wing 36c79331a4SRobert Wing struct ipc_command { 377039bdd5SMark Johnston const char *name; 38c79331a4SRobert Wing int (*handler)(struct vmctx *ctx, const nvlist_t *nvl); 39c79331a4SRobert Wing }; 40c79331a4SRobert Wing 41c79331a4SRobert Wing #define IPC_COMMAND(set, name, function) \ 42c79331a4SRobert Wing static struct ipc_command name ## _ipc_command = \ 43c79331a4SRobert Wing { #name, function }; \ 441308a17bSElyes Haouas DATA_SET(set, name ## _ipc_command) 45c79331a4SRobert Wing 46c79331a4SRobert Wing #define IPC_COMMAND_FOREACH(pvar, set) SET_FOREACH(pvar, set) 47c79331a4SRobert Wing 48c79331a4SRobert Wing SET_DECLARE(ipc_cmd_set, struct ipc_command); 49c79331a4SRobert Wing 50c79331a4SRobert Wing #endif /* _IPC_H_ */ 51