summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorManikandan C <Manikandan.Chockalingam@in.bosch.com>2015-08-28 17:12:55 +0530
committerLutz Helwing <lutz_helwing@mentor.com>2015-11-18 16:14:00 +0100
commit18f3332a363b98fca6345514c35fa10761e36c8e (patch)
tree05e2bb1d4329ab84b6e618cb3e8de60fc57e78ac /include
parent5e1270dec72c175ad3ad3a26d2c3d402d0e07ebe (diff)
downloadDLT-daemon-18f3332a363b98fca6345514c35fa10761e36c8e.tar.gz
offline trace: supported trace file name configuration based on index
Changes made for trace file name configuration based on index and made it configurable from dlt.conf file. Using this configuration one can select either timestamp based or index based log file creation for offline trace. Signed-off-by: Manikandan C <Manikandan.Chockalingam@in.bosch.com>
Diffstat (limited to 'include')
-rw-r--r--include/dlt/dlt_offline_trace.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/include/dlt/dlt_offline_trace.h b/include/dlt/dlt_offline_trace.h
index 90cfa96..7612b90 100644
--- a/include/dlt/dlt_offline_trace.h
+++ b/include/dlt/dlt_offline_trace.h
@@ -61,12 +61,24 @@
#include "dlt_types.h"
+#define DLT_OFFLINETRACE_FILENAME_BASE "dlt_offlinetrace"
+#define DLT_OFFLINETRACE_FILENAME_DELI "."
+#define DLT_OFFLINETRACE_FILENAME_EXT ".dlt"
+#define DLT_OFFLINETRACE_INDEX_MAX_SIZE 10
+#define DLT_OFFLINETRACE_FILENAME_TO_COMPARE "dlt_offlinetrace_"
+/* "dlt_offlinetrace.4294967295.dlt" -> MAX 32byte include NULL terminate */
+#define DLT_OFFLINETRACE_FILENAME_MAX_SIZE (sizeof(DLT_OFFLINETRACE_FILENAME_BASE) + \
+ sizeof(DLT_OFFLINETRACE_FILENAME_DELI) + \
+ DLT_OFFLINETRACE_INDEX_MAX_SIZE + \
+ sizeof(DLT_OFFLINETRACE_FILENAME_EXT) + 1)
+
typedef struct
{
char directory[NAME_MAX + 1];/**< (String) Store DLT messages to local directory */
char filename[NAME_MAX + 1]; /**< (String) Filename of currently used log file */
int fileSize; /**< (int) Maximum size in bytes of one trace file (Default: 1000000) */
int maxSize; /**< (int) Maximum size of all trace files (Default: 4000000) */
+ int filenameTimestampBased; /**< (int) timestamp based or index based (Default: 1 Timestamp based) */
int ohandle;
} DltOfflineTrace;
@@ -80,9 +92,10 @@ typedef struct
* @param directory directory where to store offline trace files
* @param fileSize maximum size of one offline trace file.
* @param maxSize maximum size of complete offline trace in bytes.
+ *.@param filenameTimestampBased filename to be created on timestamp based or index based
* @return negative value if there was an error
*/
-extern DltReturnValue dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize);
+extern DltReturnValue dlt_offline_trace_init(DltOfflineTrace *trace,const char *directory,int fileSize,int maxSize,int filenameTimestampBased);
/**
* Uninitialise the offline trace
@@ -115,4 +128,30 @@ extern DltReturnValue dlt_offline_trace_write(DltOfflineTrace *trace,unsigned ch
*/
extern unsigned long dlt_offline_trace_get_total_size(DltOfflineTrace *trace);
+/**
+ * Provides info about the offline logs storage directory
+ * @param path of the storage directory
+ * @param filename to search for
+ * @param pointer to store newest filename
+ * @param pointer to store oldest filename
+ * @return num of files in the directory
+ */
+unsigned int dlt_offline_trace_storage_dir_info(char *path, char *file_name, char *newest, char *oldest);
+
+/**
+ * creates filename with index
+ * @param log file name created with index
+ * @param filename base
+ * @param index to be used for file name creation
+ */
+void dlt_offline_trace_file_name(char *log_file_name, char *name, unsigned int idx);
+
+/**
+ * generates index for log file name
+ * @param filename supplied to create index
+ * @return the index to be used for log file name
+ */
+unsigned int dlt_offline_trace_get_idx_of_log_file(char *file);
+
+
#endif /* DLT_OFFLINE_TRACE_H */