1 /******************************************************************************
2 * Copyright (c) 2011 IBM Corporation
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
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
20 #define P9_UNKNOWN_VERSION -2
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
33 #define P9_PARTIAL_WALK 1
35 typedef int (*p9_transact_t)(void *opaque, uint8_t *tx, int tx_size,
36 uint8_t *rx, uint32_t *rx_size);
39 uint32_t message_size;
40 char *uname; /* User name. */
41 char *aname; /* Tree/mount name/path. */
42 uint32_t fid; /* Represents mount point. */
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;
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,
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);