~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/SLOF/lib/libvirtio/p9.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * Copyright (c) 2011 IBM Corporation
 
3
 * All rights reserved.
 
4
 * This program and the accompanying materials
 
5
 * are made available under the terms of the BSD License
 
6
 * which accompanies this distribution, and is available at
 
7
 * http://www.opensource.org/licenses/bsd-license.php
 
8
 *
 
9
 * Contributors:
 
10
 *     IBM Corporation - initial implementation
 
11
 *****************************************************************************/
 
12
 
 
13
#ifndef P9_H
 
14
#define P9_H
 
15
 
 
16
#include <stdint.h>
 
17
 
 
18
 
 
19
#define P9_ERROR                        -1
 
20
#define P9_UNKNOWN_VERSION              -2
 
21
#define P9_R_ERROR                      -3
 
22
#define P9_MSG_TOO_LONG                 -4
 
23
#define P9_UNEXPECTED_MSG               -5
 
24
#define P9_UNEXPECTED_TAG               -6
 
25
#define P9_TRANSPORT_ERROR              -7
 
26
#define P9_NO_TRANSPORT                 -8
 
27
#define P9_NULL_PATH                    -9
 
28
#define P9_PATH_ELEMENT_TOO_LONG        -10
 
29
#define P9_READ_UNEXPECTED_DATA         -11
 
30
#define P9_NO_BUFFER                    -12
 
31
#define P9_MSG_SIZE_TOO_BIG             -13
 
32
 
 
33
#define P9_PARTIAL_WALK                 1
 
34
 
 
35
typedef int (*p9_transact_t)(void *opaque, uint8_t *tx, int tx_size,
 
36
                uint8_t *rx, uint32_t *rx_size);
 
37
 
 
38
typedef struct {
 
39
        uint32_t message_size;
 
40
        char *uname;            /* User name. */
 
41
        char *aname;            /* Tree/mount name/path. */
 
42
        uint32_t fid;           /* Represents mount point. */
 
43
} p9_connection_t;
 
44
 
 
45
typedef struct {
 
46
        uint32_t fid;           /* Identifies the file to P9 server. */
 
47
        uint32_t iounit;        /* Maximum read size in bytes. */
 
48
        uint8_t type;           /* Type of file. */
 
49
        uint64_t length;        /* Length of file. */
 
50
        p9_connection_t *connection;
 
51
} p9_file_t;
 
52
 
 
53
 
 
54
void reset_buffers(void);
 
55
void p9_reg_transport(p9_transact_t transact_func, void *opaque,
 
56
                      uint8_t *tx_buffer, uint8_t *rx_buffer);
 
57
int p9_transaction(p9_connection_t *connection);
 
58
int p9_version(p9_connection_t *connection);
 
59
int p9_attach(p9_connection_t *connection);
 
60
int p9_clunk(p9_connection_t *connection, uint32_t fid);
 
61
int p9_walk(p9_connection_t *connection, uint32_t fid, uint32_t new_fid,
 
62
                uint8_t **pos);
 
63
int p9_open(p9_file_t *file, uint8_t mode);
 
64
int p9_read(p9_file_t *file, uint8_t *buffer,
 
65
                uint32_t count, uint64_t offset);
 
66
int p9_stat(p9_file_t *file);
 
67
 
 
68
#endif