mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
virnetserver: Format functions consistently
The file used a pretty inconsistent style for formatting function headers. Return types were both separate and on the same line as function names and functions were separated by one, two, and sometimes even three empty lines. Let's make it consistent by honoring our preferred coding style. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
fb96b6a052
commit
a44738231e
@ -82,7 +82,8 @@ static void virNetServerUpdateServicesLocked(virNetServer *srv,
|
|||||||
static inline size_t virNetServerTrackPendingAuthLocked(virNetServer *srv);
|
static inline size_t virNetServerTrackPendingAuthLocked(virNetServer *srv);
|
||||||
static inline size_t virNetServerTrackCompletedAuthLocked(virNetServer *srv);
|
static inline size_t virNetServerTrackCompletedAuthLocked(virNetServer *srv);
|
||||||
|
|
||||||
static int virNetServerOnceInit(void)
|
static int
|
||||||
|
virNetServerOnceInit(void)
|
||||||
{
|
{
|
||||||
if (!VIR_CLASS_NEW(virNetServer, virClassForObjectLockable()))
|
if (!VIR_CLASS_NEW(virNetServer, virClassForObjectLockable()))
|
||||||
return -1;
|
return -1;
|
||||||
@ -92,7 +93,9 @@ static int virNetServerOnceInit(void)
|
|||||||
|
|
||||||
VIR_ONCE_GLOBAL_INIT(virNetServer);
|
VIR_ONCE_GLOBAL_INIT(virNetServer);
|
||||||
|
|
||||||
unsigned long long virNetServerNextClientID(virNetServer *srv)
|
|
||||||
|
unsigned long long
|
||||||
|
virNetServerNextClientID(virNetServer *srv)
|
||||||
{
|
{
|
||||||
unsigned long long val;
|
unsigned long long val;
|
||||||
|
|
||||||
@ -103,10 +106,12 @@ unsigned long long virNetServerNextClientID(virNetServer *srv)
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virNetServerProcessMsg(virNetServer *srv,
|
|
||||||
virNetServerClient *client,
|
static int
|
||||||
virNetServerProgram *prog,
|
virNetServerProcessMsg(virNetServer *srv,
|
||||||
virNetMessage *msg)
|
virNetServerClient *client,
|
||||||
|
virNetServerProgram *prog,
|
||||||
|
virNetMessage *msg)
|
||||||
{
|
{
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
/* Only send back an error for type == CALL. Other
|
/* Only send back an error for type == CALL. Other
|
||||||
@ -141,7 +146,10 @@ static int virNetServerProcessMsg(virNetServer *srv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virNetServerHandleJob(void *jobOpaque, void *opaque)
|
|
||||||
|
static void
|
||||||
|
virNetServerHandleJob(void *jobOpaque,
|
||||||
|
void *opaque)
|
||||||
{
|
{
|
||||||
virNetServer *srv = opaque;
|
virNetServer *srv = opaque;
|
||||||
virNetServerJob *job = jobOpaque;
|
virNetServerJob *job = jobOpaque;
|
||||||
@ -165,6 +173,7 @@ static void virNetServerHandleJob(void *jobOpaque, void *opaque)
|
|||||||
VIR_FREE(job);
|
VIR_FREE(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virNetServerGetProgramLocked:
|
* virNetServerGetProgramLocked:
|
||||||
* @srv: server (must be locked by the caller)
|
* @srv: server (must be locked by the caller)
|
||||||
@ -186,6 +195,7 @@ virNetServerGetProgramLocked(virNetServer *srv,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
virNetServerDispatchNewMessage(virNetServerClient *client,
|
virNetServerDispatchNewMessage(virNetServerClient *client,
|
||||||
virNetMessage *msg,
|
virNetMessage *msg,
|
||||||
@ -289,8 +299,10 @@ virNetServerCheckLimits(virNetServer *srv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int virNetServerAddClient(virNetServer *srv,
|
|
||||||
virNetServerClient *client)
|
int
|
||||||
|
virNetServerAddClient(virNetServer *srv,
|
||||||
|
virNetServerClient *client)
|
||||||
{
|
{
|
||||||
virObjectLock(srv);
|
virObjectLock(srv);
|
||||||
|
|
||||||
@ -323,9 +335,11 @@ int virNetServerAddClient(virNetServer *srv,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virNetServerDispatchNewClient(virNetServerService *svc,
|
|
||||||
virNetSocket *clientsock,
|
static int
|
||||||
void *opaque)
|
virNetServerDispatchNewClient(virNetServerService *svc,
|
||||||
|
virNetSocket *clientsock,
|
||||||
|
void *opaque)
|
||||||
{
|
{
|
||||||
virNetServer *srv = opaque;
|
virNetServer *srv = opaque;
|
||||||
virNetServerClient *client;
|
virNetServerClient *client;
|
||||||
@ -352,19 +366,20 @@ static int virNetServerDispatchNewClient(virNetServerService *svc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virNetServer *virNetServerNew(const char *name,
|
virNetServer *
|
||||||
unsigned long long next_client_id,
|
virNetServerNew(const char *name,
|
||||||
size_t min_workers,
|
unsigned long long next_client_id,
|
||||||
size_t max_workers,
|
size_t min_workers,
|
||||||
size_t priority_workers,
|
size_t max_workers,
|
||||||
size_t max_clients,
|
size_t priority_workers,
|
||||||
size_t max_anonymous_clients,
|
size_t max_clients,
|
||||||
int keepaliveInterval,
|
size_t max_anonymous_clients,
|
||||||
unsigned int keepaliveCount,
|
int keepaliveInterval,
|
||||||
virNetServerClientPrivNew clientPrivNew,
|
unsigned int keepaliveCount,
|
||||||
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
|
virNetServerClientPrivNew clientPrivNew,
|
||||||
virFreeCallback clientPrivFree,
|
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
|
||||||
void *clientPrivOpaque)
|
virFreeCallback clientPrivFree,
|
||||||
|
void *clientPrivOpaque)
|
||||||
{
|
{
|
||||||
virNetServer *srv;
|
virNetServer *srv;
|
||||||
|
|
||||||
@ -401,13 +416,14 @@ virNetServer *virNetServerNew(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virNetServer *virNetServerNewPostExecRestart(virJSONValue *object,
|
virNetServer *
|
||||||
const char *name,
|
virNetServerNewPostExecRestart(virJSONValue *object,
|
||||||
virNetServerClientPrivNew clientPrivNew,
|
const char *name,
|
||||||
virNetServerClientPrivNewPostExecRestart clientPrivNewPostExecRestart,
|
virNetServerClientPrivNew clientPrivNew,
|
||||||
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
|
virNetServerClientPrivNewPostExecRestart clientPrivNewPostExecRestart,
|
||||||
virFreeCallback clientPrivFree,
|
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
|
||||||
void *clientPrivOpaque)
|
virFreeCallback clientPrivFree,
|
||||||
|
void *clientPrivOpaque)
|
||||||
{
|
{
|
||||||
virNetServer *srv = NULL;
|
virNetServer *srv = NULL;
|
||||||
virJSONValue *clients;
|
virJSONValue *clients;
|
||||||
@ -553,7 +569,8 @@ virNetServer *virNetServerNewPostExecRestart(virJSONValue *object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virJSONValue *virNetServerPreExecRestart(virNetServer *srv)
|
virJSONValue *
|
||||||
|
virNetServerPreExecRestart(virNetServer *srv)
|
||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) object = virJSONValueNewObject();
|
g_autoptr(virJSONValue) object = virJSONValueNewObject();
|
||||||
g_autoptr(virJSONValue) clients = virJSONValueNewArray();
|
g_autoptr(virJSONValue) clients = virJSONValueNewArray();
|
||||||
@ -621,9 +638,9 @@ virJSONValue *virNetServerPreExecRestart(virNetServer *srv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
int virNetServerAddService(virNetServer *srv,
|
virNetServerAddService(virNetServer *srv,
|
||||||
virNetServerService *svc)
|
virNetServerService *svc)
|
||||||
{
|
{
|
||||||
virObjectLock(srv);
|
virObjectLock(srv);
|
||||||
|
|
||||||
@ -687,17 +704,18 @@ virNetServerAddServiceActivation(virNetServer *srv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int virNetServerAddServiceTCP(virNetServer *srv,
|
int
|
||||||
virSystemdActivation *act,
|
virNetServerAddServiceTCP(virNetServer *srv,
|
||||||
const char *actname,
|
virSystemdActivation *act,
|
||||||
const char *nodename,
|
const char *actname,
|
||||||
const char *service,
|
const char *nodename,
|
||||||
int family,
|
const char *service,
|
||||||
int auth,
|
int family,
|
||||||
virNetTLSContext *tls,
|
int auth,
|
||||||
bool readonly,
|
virNetTLSContext *tls,
|
||||||
size_t max_queued_clients,
|
bool readonly,
|
||||||
size_t nrequests_client_max)
|
size_t max_queued_clients,
|
||||||
|
size_t nrequests_client_max)
|
||||||
{
|
{
|
||||||
virNetServerService *svc = NULL;
|
virNetServerService *svc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
@ -735,17 +753,18 @@ int virNetServerAddServiceTCP(virNetServer *srv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int virNetServerAddServiceUNIX(virNetServer *srv,
|
int
|
||||||
virSystemdActivation *act,
|
virNetServerAddServiceUNIX(virNetServer *srv,
|
||||||
const char *actname,
|
virSystemdActivation *act,
|
||||||
const char *path,
|
const char *actname,
|
||||||
mode_t mask,
|
const char *path,
|
||||||
gid_t grp,
|
mode_t mask,
|
||||||
int auth,
|
gid_t grp,
|
||||||
virNetTLSContext *tls,
|
int auth,
|
||||||
bool readonly,
|
virNetTLSContext *tls,
|
||||||
size_t max_queued_clients,
|
bool readonly,
|
||||||
size_t nrequests_client_max)
|
size_t max_queued_clients,
|
||||||
|
size_t nrequests_client_max)
|
||||||
{
|
{
|
||||||
virNetServerService *svc = NULL;
|
virNetServerService *svc = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
@ -783,8 +802,9 @@ int virNetServerAddServiceUNIX(virNetServer *srv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int virNetServerAddProgram(virNetServer *srv,
|
int
|
||||||
virNetServerProgram *prog)
|
virNetServerAddProgram(virNetServer *srv,
|
||||||
|
virNetServerProgram *prog)
|
||||||
{
|
{
|
||||||
virObjectLock(srv);
|
virObjectLock(srv);
|
||||||
|
|
||||||
@ -795,8 +815,10 @@ int virNetServerAddProgram(virNetServer *srv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int virNetServerSetTLSContext(virNetServer *srv,
|
|
||||||
virNetTLSContext *tls)
|
int
|
||||||
|
virNetServerSetTLSContext(virNetServer *srv,
|
||||||
|
virNetTLSContext *tls)
|
||||||
{
|
{
|
||||||
srv->tls = virObjectRef(tls);
|
srv->tls = virObjectRef(tls);
|
||||||
return 0;
|
return 0;
|
||||||
@ -856,15 +878,18 @@ virNetServerUpdateServicesLocked(virNetServer *srv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void virNetServerUpdateServices(virNetServer *srv,
|
void
|
||||||
bool enabled)
|
virNetServerUpdateServices(virNetServer *srv,
|
||||||
|
bool enabled)
|
||||||
{
|
{
|
||||||
virObjectLock(srv);
|
virObjectLock(srv);
|
||||||
virNetServerUpdateServicesLocked(srv, enabled);
|
virNetServerUpdateServicesLocked(srv, enabled);
|
||||||
virObjectUnlock(srv);
|
virObjectUnlock(srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void virNetServerDispose(void *obj)
|
|
||||||
|
void
|
||||||
|
virNetServerDispose(void *obj)
|
||||||
{
|
{
|
||||||
virNetServer *srv = obj;
|
virNetServer *srv = obj;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -886,7 +911,9 @@ void virNetServerDispose(void *obj)
|
|||||||
g_free(srv->clients);
|
g_free(srv->clients);
|
||||||
}
|
}
|
||||||
|
|
||||||
void virNetServerClose(virNetServer *srv)
|
|
||||||
|
void
|
||||||
|
virNetServerClose(virNetServer *srv)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -906,18 +933,21 @@ void virNetServerClose(virNetServer *srv)
|
|||||||
virObjectUnlock(srv);
|
virObjectUnlock(srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virNetServerShutdownWait(virNetServer *srv)
|
virNetServerShutdownWait(virNetServer *srv)
|
||||||
{
|
{
|
||||||
virThreadPoolDrain(srv->workers);
|
virThreadPoolDrain(srv->workers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
virNetServerTrackPendingAuthLocked(virNetServer *srv)
|
virNetServerTrackPendingAuthLocked(virNetServer *srv)
|
||||||
{
|
{
|
||||||
return ++srv->nclients_unauth;
|
return ++srv->nclients_unauth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
virNetServerTrackCompletedAuthLocked(virNetServer *srv)
|
virNetServerTrackCompletedAuthLocked(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -937,6 +967,7 @@ virNetServerHasClients(virNetServer *srv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virNetServerProcessClients(virNetServer *srv)
|
virNetServerProcessClients(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -974,12 +1005,14 @@ virNetServerProcessClients(virNetServer *srv)
|
|||||||
virObjectUnlock(srv);
|
virObjectUnlock(srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
virNetServerGetName(virNetServer *srv)
|
virNetServerGetName(virNetServer *srv)
|
||||||
{
|
{
|
||||||
return srv->name;
|
return srv->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetServerGetThreadPoolParameters(virNetServer *srv,
|
virNetServerGetThreadPoolParameters(virNetServer *srv,
|
||||||
size_t *minWorkers,
|
size_t *minWorkers,
|
||||||
@ -1002,6 +1035,7 @@ virNetServerGetThreadPoolParameters(virNetServer *srv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetServerSetThreadPoolParameters(virNetServer *srv,
|
virNetServerSetThreadPoolParameters(virNetServer *srv,
|
||||||
long long int minWorkers,
|
long long int minWorkers,
|
||||||
@ -1018,6 +1052,7 @@ virNetServerSetThreadPoolParameters(virNetServer *srv,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
virNetServerGetMaxClients(virNetServer *srv)
|
virNetServerGetMaxClients(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -1030,6 +1065,7 @@ virNetServerGetMaxClients(virNetServer *srv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
virNetServerGetCurrentClients(virNetServer *srv)
|
virNetServerGetCurrentClients(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -1042,6 +1078,7 @@ virNetServerGetCurrentClients(virNetServer *srv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
virNetServerGetMaxUnauthClients(virNetServer *srv)
|
virNetServerGetMaxUnauthClients(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -1054,6 +1091,7 @@ virNetServerGetMaxUnauthClients(virNetServer *srv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
virNetServerGetCurrentUnauthClients(virNetServer *srv)
|
virNetServerGetCurrentUnauthClients(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -1067,8 +1105,9 @@ virNetServerGetCurrentUnauthClients(virNetServer *srv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool virNetServerNeedsAuth(virNetServer *srv,
|
bool
|
||||||
int auth)
|
virNetServerNeedsAuth(virNetServer *srv,
|
||||||
|
int auth)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -1083,6 +1122,7 @@ bool virNetServerNeedsAuth(virNetServer *srv,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetServerGetClients(virNetServer *srv,
|
virNetServerGetClients(virNetServer *srv,
|
||||||
virNetServerClient ***clts)
|
virNetServerClient ***clts)
|
||||||
@ -1105,6 +1145,7 @@ virNetServerGetClients(virNetServer *srv,
|
|||||||
return nclients;
|
return nclients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virNetServerClient *
|
virNetServerClient *
|
||||||
virNetServerGetClient(virNetServer *srv,
|
virNetServerGetClient(virNetServer *srv,
|
||||||
unsigned long long id)
|
unsigned long long id)
|
||||||
@ -1128,6 +1169,7 @@ virNetServerGetClient(virNetServer *srv,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetServerSetClientLimits(virNetServer *srv,
|
virNetServerSetClientLimits(virNetServer *srv,
|
||||||
long long int maxClients,
|
long long int maxClients,
|
||||||
@ -1164,6 +1206,7 @@ virNetServerSetClientLimits(virNetServer *srv,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virNetTLSContext *
|
static virNetTLSContext *
|
||||||
virNetServerGetTLSContext(virNetServer *srv)
|
virNetServerGetTLSContext(virNetServer *srv)
|
||||||
{
|
{
|
||||||
@ -1182,6 +1225,7 @@ virNetServerGetTLSContext(virNetServer *srv)
|
|||||||
return ctxt;
|
return ctxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNetServerUpdateTlsFiles(virNetServer *srv)
|
virNetServerUpdateTlsFiles(virNetServer *srv)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user