2009-11-05 16:18:07 +00:00
|
|
|
/*
|
2013-05-31 17:52:51 +00:00
|
|
|
* Copyright (C) 2010, 2013 Red Hat, Inc.
|
2009-11-05 16:18:07 +00:00
|
|
|
* Copyright IBM Corp. 2009
|
|
|
|
*
|
|
|
|
* phyp_driver.c: ssh layer to access Power Hypervisors
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Eduardo Otubo <otubo at linux.vnet.ibm.com>
|
|
|
|
*
|
|
|
|
* This library 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.
|
|
|
|
*
|
|
|
|
* This library 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2009-11-05 16:18:07 +00:00
|
|
|
*/
|
|
|
|
|
phyp: reduce scope of driver functions
Several phyp functions are not namespace clean, and had no reason
to be exported since no one outside the phyp driver needed to use
them. Rather than do lots of forward declarations, I was able
to topologically sort the file. So, this patch looks huge, but
is really just a matter of marking things static and dealing with
the compiler fallout.
* src/phyp/phyp_driver.h (PHYP_DRIVER_H): Add include guard.
(phypCheckSPFreeSapce): Delete unused declaration.
(phypGetSystemType, phypGetVIOSPartitionID, phypCapsInit)
(phypBuildLpar, phypUUIDTable_WriteFile, phypUUIDTable_ReadFile)
(phypUUIDTable_AddLpar, phypUUIDTable_RemLpar, phypUUIDTable_Pull)
(phypUUIDTable_Push, phypUUIDTable_Init, phypUUIDTable_Free)
(escape_specialcharacters, waitsocket, phypGetLparUUID)
(phypGetLparMem, phypGetLparCPU, phypGetLparCPUGeneric)
(phypGetRemoteSlot, phypGetBackingDevice, phypDiskType)
(openSSHSession): Move declarations to phyp_driver.c and make static.
* src/phyp/phyp_driver.c: Rearrange file contents to provide
topological sorting of newly-static funtions (no semantic changes
other than reduced scope).
(phypGetBackingDevice, phypDiskType): Mark unused, for now.
2010-06-24 21:05:16 +00:00
|
|
|
#ifndef PHYP_DRIVER_H
|
|
|
|
# define PHYP_DRIVER_H
|
|
|
|
|
|
|
|
# include "conf/capabilities.h"
|
|
|
|
# include "conf/domain_conf.h"
|
|
|
|
# include <libssh2.h>
|
2009-07-24 14:17:06 +00:00
|
|
|
|
phyp: reduce scope of driver functions
Several phyp functions are not namespace clean, and had no reason
to be exported since no one outside the phyp driver needed to use
them. Rather than do lots of forward declarations, I was able
to topologically sort the file. So, this patch looks huge, but
is really just a matter of marking things static and dealing with
the compiler fallout.
* src/phyp/phyp_driver.h (PHYP_DRIVER_H): Add include guard.
(phypCheckSPFreeSapce): Delete unused declaration.
(phypGetSystemType, phypGetVIOSPartitionID, phypCapsInit)
(phypBuildLpar, phypUUIDTable_WriteFile, phypUUIDTable_ReadFile)
(phypUUIDTable_AddLpar, phypUUIDTable_RemLpar, phypUUIDTable_Pull)
(phypUUIDTable_Push, phypUUIDTable_Init, phypUUIDTable_Free)
(escape_specialcharacters, waitsocket, phypGetLparUUID)
(phypGetLparMem, phypGetLparCPU, phypGetLparCPUGeneric)
(phypGetRemoteSlot, phypGetBackingDevice, phypDiskType)
(openSSHSession): Move declarations to phyp_driver.c and make static.
* src/phyp/phyp_driver.c: Rearrange file contents to provide
topological sorting of newly-static funtions (no semantic changes
other than reduced scope).
(phypGetBackingDevice, phypDiskType): Mark unused, for now.
2010-06-24 21:05:16 +00:00
|
|
|
# define LPAR_EXEC_ERR -1
|
|
|
|
# define SSH_CONN_ERR -2 /* error while trying to connect to remote host */
|
|
|
|
# define SSH_CMD_ERR -3 /* error while trying to execute the remote cmd */
|
2009-07-24 14:17:06 +00:00
|
|
|
|
|
|
|
typedef struct _ConnectionData ConnectionData;
|
|
|
|
typedef ConnectionData *ConnectionDataPtr;
|
|
|
|
struct _ConnectionData {
|
2009-09-04 10:08:47 +00:00
|
|
|
LIBSSH2_SESSION *session;
|
|
|
|
int sock;
|
2009-07-24 14:17:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* This is the lpar (domain) struct that relates
|
|
|
|
* the ID with UUID generated by the API
|
|
|
|
* */
|
|
|
|
typedef struct _lpar lpar_t;
|
|
|
|
typedef lpar_t *lparPtr;
|
|
|
|
struct _lpar {
|
|
|
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Struct that holds how many lpars (domains) we're
|
|
|
|
* handling and a pointer to an array of lpar structs
|
|
|
|
* */
|
2009-11-05 16:18:07 +00:00
|
|
|
typedef struct _uuid_table uuid_table_t;
|
|
|
|
typedef uuid_table_t *uuid_tablePtr;
|
|
|
|
struct _uuid_table {
|
2009-07-24 14:17:06 +00:00
|
|
|
int nlpars;
|
|
|
|
lparPtr *lpars;
|
|
|
|
};
|
|
|
|
|
2009-11-05 16:18:07 +00:00
|
|
|
/* This is the main structure of the driver
|
|
|
|
* */
|
|
|
|
typedef struct _phyp_driver phyp_driver_t;
|
|
|
|
typedef phyp_driver_t *phyp_driverPtr;
|
|
|
|
struct _phyp_driver {
|
|
|
|
uuid_tablePtr uuid_table;
|
|
|
|
virCapsPtr caps;
|
2013-03-31 18:03:42 +00:00
|
|
|
virDomainXMLOptionPtr xmlopt;
|
2009-11-05 16:18:07 +00:00
|
|
|
int vios_id;
|
2010-06-16 20:33:27 +00:00
|
|
|
|
|
|
|
/* system_type:
|
|
|
|
* 0 = hmc
|
|
|
|
* 127 = ivm
|
|
|
|
* */
|
|
|
|
int system_type;
|
2009-11-05 16:18:07 +00:00
|
|
|
char *managed_system;
|
|
|
|
};
|
2009-07-24 14:17:06 +00:00
|
|
|
|
2009-11-05 16:18:07 +00:00
|
|
|
int phypRegister(void);
|
2009-07-24 14:17:06 +00:00
|
|
|
|
phyp: reduce scope of driver functions
Several phyp functions are not namespace clean, and had no reason
to be exported since no one outside the phyp driver needed to use
them. Rather than do lots of forward declarations, I was able
to topologically sort the file. So, this patch looks huge, but
is really just a matter of marking things static and dealing with
the compiler fallout.
* src/phyp/phyp_driver.h (PHYP_DRIVER_H): Add include guard.
(phypCheckSPFreeSapce): Delete unused declaration.
(phypGetSystemType, phypGetVIOSPartitionID, phypCapsInit)
(phypBuildLpar, phypUUIDTable_WriteFile, phypUUIDTable_ReadFile)
(phypUUIDTable_AddLpar, phypUUIDTable_RemLpar, phypUUIDTable_Pull)
(phypUUIDTable_Push, phypUUIDTable_Init, phypUUIDTable_Free)
(escape_specialcharacters, waitsocket, phypGetLparUUID)
(phypGetLparMem, phypGetLparCPU, phypGetLparCPUGeneric)
(phypGetRemoteSlot, phypGetBackingDevice, phypDiskType)
(openSSHSession): Move declarations to phyp_driver.c and make static.
* src/phyp/phyp_driver.c: Rearrange file contents to provide
topological sorting of newly-static funtions (no semantic changes
other than reduced scope).
(phypGetBackingDevice, phypDiskType): Mark unused, for now.
2010-06-24 21:05:16 +00:00
|
|
|
#endif /* PHYP_DRIVER_H */
|