changeset 937:06f96627ac9a

rvinterf TM log: decode TMFFS2 commands
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 24 May 2023 04:25:47 +0000
parents f4e6f6b6548e
children 74930218c270
files rvinterf/lowlevel/rviftmode.c
diffstat 1 files changed, 96 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/lowlevel/rviftmode.c	Wed May 24 04:00:18 2023 +0000
+++ b/rvinterf/lowlevel/rviftmode.c	Wed May 24 04:25:47 2023 +0000
@@ -11,6 +11,7 @@
 #include <strings.h>
 #include "../include/etm.h"
 #include "../include/tm3.h"
+#include "../include/tmffs2.h"
 
 extern u_char rxpkt[];
 extern size_t rxpkt_len;
@@ -103,8 +104,101 @@
 	unsigned pktlen;
 	char *outbuf;
 {
-	/* classification code to be filled */
-	strcpy(outbuf, "FFS2");
+	if (pktlen < 4) {
+		strcpy(outbuf, "ETM_FFS2 runt");
+		return;
+	}
+	switch (pkt[2]) {
+	case TMFFS_FORMAT:
+		strcpy(outbuf, "FFS2 format");
+		return;
+	case TMFFS_PREFORMAT:
+		strcpy(outbuf, "FFS2 preformat");
+		return;
+	case TMFFS_MKDIR:
+		strcpy(outbuf, "FFS2 mkdir");
+		return;
+	case TMFFS_OPENDIR:
+		strcpy(outbuf, "FFS2 opendir");
+		return;
+	case TMFFS_READDIR:
+		strcpy(outbuf, "FFS2 readdir");
+		return;
+	case TMFFS_REMOVE:
+		strcpy(outbuf, "FFS2 remove");
+		return;
+	case TMFFS_RENAME:
+		strcpy(outbuf, "FFS2 rename");
+		return;
+	case TMFFS_XLSTAT:
+		strcpy(outbuf, "FFS2 xlstat");
+		return;
+	case TMFFS_SYMLINK:
+		strcpy(outbuf, "FFS2 symlink");
+		return;
+	case TMFFS_READLINK:
+		strcpy(outbuf, "FFS2 readlink");
+		return;
+	case TMFFS_OPEN:
+		strcpy(outbuf, "FFS2 open");
+		return;
+	case TMFFS_CLOSE:
+		strcpy(outbuf, "FFS2 close");
+		return;
+	case TMFFS_READ:
+		strcpy(outbuf, "FFS2 read");
+		return;
+	case TMFFS_WRITE:
+		strcpy(outbuf, "FFS2 write");
+		return;
+	case TMFFS_SEEK:
+		strcpy(outbuf, "FFS2 seek");
+		return;
+	case TMFFS_FTRUNCATE:
+		strcpy(outbuf, "FFS2 ftruncate");
+		return;
+	case TMFFS_TRUNCATE:
+		strcpy(outbuf, "FFS2 truncate");
+		return;
+	case TMFFS_FILE_READ:
+		strcpy(outbuf, "FFS2 fread");
+		return;
+	case TMFFS_FILE_WRITE:
+		strcpy(outbuf, "FFS2 fwrite");
+		return;
+	case TMFFS_FSTAT:
+		strcpy(outbuf, "FFS2 fstat");
+		return;
+	case TMFFS_LSTAT:
+		strcpy(outbuf, "FFS2 lstat");
+		return;
+	case TMFFS_STAT:
+		strcpy(outbuf, "FFS2 stat");
+		return;
+	case TMFFS_FCONTROL:
+		strcpy(outbuf, "FFS2 fcontrol");
+		return;
+	case TMFFS_QUERY:
+		strcpy(outbuf, "FFS2 query");
+		return;
+	case TMFFS_INIT:
+		strcpy(outbuf, "FFS2 init");
+		return;
+	case TMFFS_EXIT:
+		strcpy(outbuf, "FFS2 exit");
+		return;
+	case TMFFS_DIRXLSTAT:
+		strcpy(outbuf, "FFS2 dirxlstat");
+		return;
+	case TMFFS_VERSION:
+		strcpy(outbuf, "FFS2 version");
+		return;
+	case TMFFS_TFFS:
+		strcpy(outbuf, "FFS2 tffs");
+		return;
+	default:
+		sprintf(outbuf, "ETM_FFS2 opcode 0x%02X", pkt[2]);
+	}
 }
 
 static void