automotive-dlt
dlt-logstorage-list.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "dlt_common.h"
#include "dlt-control-common.h"
#include "dlt-logstorage-common.h"
Include dependency graph for dlt-logstorage-list.c:

Go to the source code of this file.

Data Structures

struct  LogstorageDeviceInfo
 

Macros

#define pr_fmt(fmt)   "Log storage list: "fmt
 

Functions

void print_list ()
 Prints the device list in verbose mode. More...
 
static struct LogstorageDeviceInfologstorage_find_dev_info (const char *node)
 Find element in the list based on device node. More...
 
int logstorage_store_dev_info (const char *node, const char *path)
 Add new device in the list. More...
 
char * logstorage_delete_dev_info (const char *node)
 Remove a device from the list. More...
 

Variables

static struct LogstorageDeviceInfog_info
 

Detailed Description

app begin@ Copyright (C) 2013 - 2015 Advanced Driver Information Technology. This code is developed by Advanced Driver Information Technology. Copyright of Advanced Driver Information Technology, Bosch and DENSO.

This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.

Author
Anitha.BA anith.nosp@m.aamm.nosp@m.aji.b.nosp@m.agga.nosp@m.m@in..nosp@m.bosc.nosp@m.h.com ADIT 2015
Christoph Lipka clipk.nosp@m.a@jp.nosp@m..adit.nosp@m.-jv..nosp@m.com ADIT 2015
Frederic Berat fbera.nosp@m.t@de.nosp@m..adit.nosp@m.-jv..nosp@m.com ADIT 2015

For further information see http://www.genivi.org/. end@

Definition in file dlt-logstorage-list.c.

Macro Definition Documentation

#define pr_fmt (   fmt)    "Log storage list: "fmt

Definition at line 57 of file dlt-logstorage-list.c.

Function Documentation

char* logstorage_delete_dev_info ( const char *  node)

Remove a device from the list.

If the device is removed from the list, the mount point pointer is given back to the caller. That means that he has to free it.

Parameters
nodeThe device node to be removed
Returns
the mount point if the node is found, NULL either.

Definition at line 197 of file dlt-logstorage-list.c.

References LogstorageDeviceInfo::dev_node, g_info, logstorage_find_dev_info(), LogstorageDeviceInfo::mnt_point, LogstorageDeviceInfo::next, NULL, pr_verbose, LogstorageDeviceInfo::prev, and print_list().

Referenced by check_mountpoint_from_partition().

static struct LogstorageDeviceInfo* logstorage_find_dev_info ( const char *  node)
static

Find element in the list based on device node.

Allows to check whether a device is already in the list or to find out the one to be removed.

Parameters
nodeThe device node to look for
Returns
The element of the list found, NULL either.

Definition at line 106 of file dlt-logstorage-list.c.

References LogstorageDeviceInfo::dev_node, DLT_MOUNT_PATH_MAX, g_info, LogstorageDeviceInfo::next, NULL, and pr_verbose.

Referenced by logstorage_delete_dev_info(), and logstorage_store_dev_info().

int logstorage_store_dev_info ( const char *  node,
const char *  path 
)

Add new device in the list.

The device is only added if a configuration file has been found and if it's not already in the list.

Parameters
nodeThe device node to add
pathThe corresponding mount point path
Returns
0 on success, -1 in case of error.

Definition at line 143 of file dlt-logstorage-list.c.

References LogstorageDeviceInfo::dev_node, DLT_MOUNT_PATH_MAX, g_info, logstorage_find_dev_info(), LogstorageDeviceInfo::mnt_point, LogstorageDeviceInfo::next, NULL, pr_error, pr_verbose, LogstorageDeviceInfo::prev, and print_list().

Referenced by check_mountpoint_from_partition().

void print_list ( )

Prints the device list in verbose mode.

This can be used to debug the behavior. Therefore, it's only available in verbose mode.

Definition at line 81 of file dlt-logstorage-list.c.

References LogstorageDeviceInfo::dev_node, g_info, LogstorageDeviceInfo::mnt_point, LogstorageDeviceInfo::next, NULL, and pr_verbose.

Referenced by logstorage_delete_dev_info(), and logstorage_store_dev_info().

Variable Documentation