X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Froms%2FSLOF%2Flib%2Flibvirtio%2Fp9.h;fp=qemu%2Froms%2FSLOF%2Flib%2Flibvirtio%2Fp9.h;h=7df9ef4411fcd7753a48d2631e4d65b0dfe5da58;hb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;hp=0000000000000000000000000000000000000000;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/qemu/roms/SLOF/lib/libvirtio/p9.h b/qemu/roms/SLOF/lib/libvirtio/p9.h new file mode 100644 index 000000000..7df9ef441 --- /dev/null +++ b/qemu/roms/SLOF/lib/libvirtio/p9.h @@ -0,0 +1,68 @@ +/****************************************************************************** + * Copyright (c) 2011 IBM Corporation + * All rights reserved. + * This program and the accompanying materials + * are made available under the terms of the BSD License + * which accompanies this distribution, and is available at + * http://www.opensource.org/licenses/bsd-license.php + * + * Contributors: + * IBM Corporation - initial implementation + *****************************************************************************/ + +#ifndef P9_H +#define P9_H + +#include + + +#define P9_ERROR -1 +#define P9_UNKNOWN_VERSION -2 +#define P9_R_ERROR -3 +#define P9_MSG_TOO_LONG -4 +#define P9_UNEXPECTED_MSG -5 +#define P9_UNEXPECTED_TAG -6 +#define P9_TRANSPORT_ERROR -7 +#define P9_NO_TRANSPORT -8 +#define P9_NULL_PATH -9 +#define P9_PATH_ELEMENT_TOO_LONG -10 +#define P9_READ_UNEXPECTED_DATA -11 +#define P9_NO_BUFFER -12 +#define P9_MSG_SIZE_TOO_BIG -13 + +#define P9_PARTIAL_WALK 1 + +typedef int (*p9_transact_t)(void *opaque, uint8_t *tx, int tx_size, + uint8_t *rx, int *rx_size); + +typedef struct { + uint32_t message_size; + char *uname; /* User name. */ + char *aname; /* Tree/mount name/path. */ + uint32_t fid; /* Represents mount point. */ +} p9_connection_t; + +typedef struct { + uint32_t fid; /* Identifies the file to P9 server. */ + uint32_t iounit; /* Maximum read size in bytes. */ + uint8_t type; /* Type of file. */ + uint64_t length; /* Length of file. */ + p9_connection_t *connection; +} p9_file_t; + + +void reset_buffers(void); +void p9_reg_transport(p9_transact_t transact_func, void *opaque, + uint8_t *tx_buffer, uint8_t *rx_buffer); +int p9_transaction(p9_connection_t *connection); +int p9_version(p9_connection_t *connection); +int p9_attach(p9_connection_t *connection); +int p9_clunk(p9_connection_t *connection, uint32_t fid); +int p9_walk(p9_connection_t *connection, uint32_t fid, uint32_t new_fid, + uint8_t **pos); +int p9_open(p9_file_t *file, uint8_t mode); +int p9_read(p9_file_t *file, uint8_t *buffer, + uint32_t count, uint64_t offset); +int p9_stat(p9_file_t *file); + +#endif