54 #define pr_fmt(fmt) "Logstorage common: "fmt 63 #include <sys/types.h> 64 #include <sys/socket.h> 73 #ifdef DLT_LOGSTORAGE_CTRL_UDEV_ENABLE 159 #ifdef DLT_LOGSTORAGE_CTRL_UDEV_ENABLE 179 #ifdef DLT_LOGSTORAGE_CTRL_UDEV_ENABLE 198 struct dirent **files;
203 if ((mnt_point ==
NULL) || (mnt_point[0] ==
'\0'))
211 n = scandir(mnt_point, &files,
NULL, alphasort);
215 pr_error(
"Cannot read mounted directory\n");
221 pr_verbose(
"Checking %s.\n", files[i]->d_name);
233 for (i = 0 ; i < n ; i++)
250 if (mnt_point ==
NULL)
252 pr_error(
"Given mount point is NULL\n");
256 if (access(mnt_point, W_OK) == 0)
276 DltServiceOfflineLogstorage *serv =
NULL;
280 pr_error(
"Mount path is uninitialized: %s\n", path);
284 pr_verbose(
"Sending event %d for %s.\n", conn_type, path);
290 pr_error(
"Not able to allocate memory for body.\n");
294 (*body)->
data = calloc(1,
sizeof(DltServiceOfflineLogstorage));
300 pr_error(
"Not able to allocate memory for body data.\n");
304 (*body)->size =
sizeof(DltServiceOfflineLogstorage);
306 serv = (DltServiceOfflineLogstorage *) (*body)->data;
309 serv->connection_type = conn_type;
335 pr_error(
"Data for Dlt Message body is NULL\n");
341 free(msg_body->
data);
char device_path[DLT_MOUNT_PATH_MAX]
static DltLogstorageCtrl lctrl
int dlt_logstorage_get_handler_fd(void)
void set_default_path(char *path)
static int dlt_logstorage_prop_deinit(void)
Clean-up proprietary connection.
#define DLT_SERVICE_ID_OFFLINE_LOGSTORAGE
DltLogstorageHandler get_handler_type(void)
DltLogstorageCtrl * get_logstorage_control(void)
int dlt_logstorage_check_config_file(char *mnt_point)
Search for config file in given mount point.
void * dlt_logstorage_get_handler_cb(void)
int dlt_logstorage_udev_deinit(void)
Clean-up the udev data.
#define DLT_MOUNT_PATH_MAX
void set_handler_type(char *type)
char * get_default_path(void)
static int dlt_logstorage_prop_init(void)
Initialize proprietary connection.
void set_default_event_type(long type)
DltLogstorageHandler handler_type
#define pr_error(fmt,...)
int get_default_event_type(void)
int dlt_control_send_message(DltControlMsgBody *body, int timeout)
Send a message to the daemon and wait for the asynchronous answer.
static struct LogstorageOptions g_options
int dlt_logstorage_send_event(int type, char *mount_point)
Send a logstorage event to DLT.
#define pr_verbose(fmt,...)
int dlt_logstorage_deinit_handler(void)
Clean-up the handler based on configuration.
static int check_proprietary_handling(char *type)
Check whether user wants to use proprietary handler.
int dlt_logstorage_init_handler(void)
Initialized the handler based on configuration.
int dlt_logstorage_check_directory_permission(char *mnt_point)
Check if given mount point is writable.
int dlt_logstorage_udev_init(void)
Initialize the private data.
static DltControlMsgBody * prepare_message_body(DltControlMsgBody **body, int conn_type, char *path)
Prepares the body of the message to be send to DLT.