/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * (C) Copyright 2020 Hewlett Packard Enterprise Development LP * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
*/
/* * Cross Partition (XP) base. * * XP provides a base from which its users can interact * with XPC, yet not be dependent on XPC. *
*/
/* * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level * users of XPC.
*/ struct xpc_registration xpc_registrations[XPC_MAX_NCHANNELS];
EXPORT_SYMBOL_GPL(xpc_registrations);
/* * Initialize the XPC interface to NULL to indicate that XPC isn't loaded.
*/ struct xpc_interface xpc_interface = { };
EXPORT_SYMBOL_GPL(xpc_interface);
/* * XPC calls this when it (the XPC module) is being unloaded.
*/ void
xpc_clear_interface(void)
{
memset(&xpc_interface, 0, sizeof(xpc_interface));
}
EXPORT_SYMBOL_GPL(xpc_clear_interface);
/* * Register for automatic establishment of a channel connection whenever * a partition comes up. * * Arguments: * * ch_number - channel # to register for connection. * func - function to call for asynchronous notification of channel * state changes (i.e., connection, disconnection, error) and * the arrival of incoming messages. * key - pointer to optional user-defined value that gets passed back * to the user on any callouts made to func. * payload_size - size in bytes of the XPC message's payload area which * contains a user-defined message. The user should make * this large enough to hold their largest message. * nentries - max #of XPC message entries a message queue can contain. * The actual number, which is determined when a connection * is established and may be less then requested, will be * passed to the user via the xpConnected callout. * assigned_limit - max number of kthreads allowed to be processing * messages (per connection) at any given instant. * idle_limit - max number of kthreads allowed to be idle at any given * instant.
*/ enum xp_retval
xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
u16 nentries, u32 assigned_limit, u32 idle_limit)
{ struct xpc_registration *registration;
/* * Remove the registration for automatic connection of the specified channel * when a partition comes up. * * Before returning this xpc_disconnect() will wait for all connections on the * specified channel have been closed/torndown. So the caller can be assured * that they will not be receiving any more callouts from XPC to their * function registered via xpc_connect(). * * Arguments: * * ch_number - channel # to unregister.
*/ void
xpc_disconnect(int ch_number)
{ struct xpc_registration *registration;
/* * We've decided not to make this a down_interruptible(), since we * figured XPC's users will just turn around and call xpc_disconnect() * again anyways, so we might as well wait, if need be.
*/
mutex_lock(®istration->mutex);
/* if !XPC_CHANNEL_REGISTERED(ch_number) */ if (registration->func == NULL) {
mutex_unlock(®istration->mutex); return;
}
/* remove the connection registration for the specified channel */
registration->func = NULL;
registration->key = NULL;
registration->nentries = 0;
registration->entry_size = 0;
registration->assigned_limit = 0;
registration->idle_limit = 0;
if (xpc_interface.disconnect)
xpc_interface.disconnect(ch_number);
mutex_unlock(®istration->mutex);
return;
}
EXPORT_SYMBOL_GPL(xpc_disconnect);
staticint __init
xp_init(void)
{ enum xp_retval ret; int ch_number;
/* initialize the connection registration mutex */ for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
mutex_init(&xpc_registrations[ch_number].mutex);
if (is_uv_system())
ret = xp_init_uv(); else
ret = 0;
if (ret != xpSuccess) return ret;
return 0;
}
module_init(xp_init);
staticvoid __exit
xp_exit(void)
{ if (is_uv_system())
xp_exit_uv();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.