38#ifndef __DEV_VIRTIO_FS9P_HH__
39#define __DEV_VIRTIO_FS9P_HH__
52struct VirtIO9PBaseParams;
68template <
typename T>
inline T
72template <
typename T>
inline T
75template <>
inline P9MsgHeader
84template <>
inline P9MsgHeader
136 {
nullptr, [](
void *
p){
operator delete(
p); }};
210struct VirtIO9PProxyParams;
230 size_t size)
override;
291struct VirtIO9PDiodParams;
343struct VirtIO9PSocketParams;
virtual std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
This object is a proxy for a port or other object which implements the functional response protocol,...
VirtIO descriptor (chain) wrapper.
Virtqueue for 9p requests.
void onNotifyDescriptor(VirtDescriptor *desc)
Notify queue of pending incoming descriptor.
FSQueue(PortProxy &proxy, ByteOrder bo, uint16_t size, VirtIO9PBase &_parent)
This class implements a VirtIO transport layer for the 9p network file system.
VirtIO9PBase(const Params ¶ms)
void sendRMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)
Send a 9p RPC message reply.
virtual void recvTMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)=0
Handle incoming 9p RPC message.
std::unique_ptr< Config, void(*)(void *p)> config
Currently active configuration (host byte order)
void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
void dumpMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)
Dump a 9p RPC message on the debug output.
std::map< P9Tag, VirtDescriptor * > pendingTransactions
Map between 9p transaction tags and descriptors where they appeared.
static const DeviceId ID_9P
VirtIO device ID.
VirtIO9PBaseParams Params
static const FeatureBits F_MOUNT_TAG
Device provides a name of the resource in its configuration.
DiodDataEvent(VirtIO9PDiod &_parent, int fd, int event)
VirtIO 9p proxy that communicates with the diod 9p server using pipes.
void startDiod()
Start diod and setup the communication pipes.
void startup()
startup() is the final initialization call before simulation.
int fd_from_diod
fd for data pipe coming from diod (read end)
int diod_pid
PID of diod process.
ssize_t read(uint8_t *data, size_t len)
Read data from the server behind the proxy.
VirtIO9PDiod(const Params ¶ms)
ssize_t write(const uint8_t *data, size_t len)
Write data to the server behind the proxy.
VirtIO9PDiodParams Params
int fd_to_diod
fd for data pipe going to diod (write end)
void terminateDiod()
Kill the diod child process at the end of the simulation.
std::unique_ptr< DiodDataEvent > dataEvent
VirtIO 9p proxy base class.
virtual ssize_t read(uint8_t *data, size_t len)=0
Read data from the server behind the proxy.
virtual ssize_t write(const uint8_t *data, size_t len)=0
Write data to the server behind the proxy.
void recvTMsg(const P9MsgHeader &header, const uint8_t *data, size_t size) override
Handle incoming 9p RPC message.
void writeAll(const uint8_t *data, size_t len)
Convenience function that writes exactly len bytes.
void readAll(uint8_t *data, size_t len)
Convenience function that reads exactly len bytes.
bool deviceUsed
Bool to track if the device has been used or not.
VirtIO9PProxyParams Params
void unserialize(CheckpointIn &cp) override
Unserialize an object.
VirtIO9PProxy(const Params ¶ms)
void serverDataReady()
Notification of pending data from server.
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual ~SocketDataEvent()
SocketDataEvent(VirtIO9PSocket &_parent, int fd, int event)
VirtIO 9p proxy that communicates with a 9p server over tcp sockets.
virtual ~VirtIO9PSocket()
std::unique_ptr< SocketDataEvent > dataEvent
ssize_t read(uint8_t *data, size_t len)
Read data from the server behind the proxy.
VirtIO9PSocketParams Params
void startup()
startup() is the final initialization call before simulation.
void socketDisconnect()
9p server disconnect notification
int fdSocket
Socket connected to the 9p server.
VirtIO9PSocket(const Params ¶ms)
ssize_t write(const uint8_t *data, size_t len)
Write data to the server behind the proxy.
void connectSocket()
Try to resolve the server name and connect to the 9p server.
Base class for all VirtIO-based devices.
uint16_t DeviceId
Device Type (sometimes known as subsystem ID)
Base wrapper around a virtqueue.
const Params & params() const
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T htop9(T v)
Convert host byte order to p9 byte order (LE)
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
T p9toh(T v)
Convert p9 byte order (LE) to host byte order.
VirtIO 9p configuration structure.