Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.

Commit 9b6a15b

Browse files
author
bocianu
committed
usage log is not displaying repeating paths, minor fixes
1 parent 77ad8eb commit 9b6a15b

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

tnfs/tnfsd/bin/tnfsd

-88.5 KB
Binary file not shown.

tnfs/tnfsd/directory.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <stdlib.h>
2828
#include <stdio.h>
29+
#include <ctype.h>
2930
#include <dirent.h>
3031
#include <sys/stat.h>
3132
#include <string.h>
@@ -342,7 +343,10 @@ void tnfs_seekdir(Header *hdr, Session *s, unsigned char *databuf, int datasz)
342343
}
343344
#ifdef USAGELOG
344345
if (pos == 0) {
345-
USGLOG(hdr, "Path changed to: %s", s->dhandles[*databuf].path);
346+
if (strcmp(s->lastpath, s->dhandles[*databuf].path) != 0) {
347+
USGLOG(hdr, "Path changed to: %s", s->dhandles[*databuf].path);
348+
};
349+
strcpy(s->lastpath, s->dhandles[*databuf].path);
346350
}
347351
#endif
348352

tnfs/tnfsd/session.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ int tnfs_mount(Header *hdr, unsigned char *buf, int bufsz)
140140
#endif
141141
#ifdef USAGELOG
142142
USGLOG(hdr, "Session started at: %s", s->root);
143+
s->lastpath[0] = 0;
143144
#endif
144145
}
145146
else

tnfs/tnfsd/tnfs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ typedef struct _session
129129
dir_handle dhandles[MAX_DHND_PER_CONN];
130130
char *root; /* requested root dir */
131131
unsigned char lastmsg[MAXMSGSZ];/* last message sent */
132+
#ifdef USAGELOG
133+
char lastpath[MAX_TNFSPATH]; /* last path visited */
134+
#endif
132135
int lastmsgsz; /* last message's size inc. hdr */
133136
uint8_t lastseqno; /* last sequence number */
134137
uint8_t isTCP; /* uses the TCP transport */

tnfs/tnfsd/tnfs_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
#include "errortable.h"
5050
#include "endian.h"
5151
#include "bsdcompat.h"
52+
#include "log.h"
5253

5354
char fnbuf[MAX_FILEPATH];
5455
unsigned char iobuf[MAX_IOSZ + 2]; /* 2 bytes added for the size param */

0 commit comments

Comments
 (0)