ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX_VIEWER\"")
ADD_DEFINITIONS("-DNDEBUG")
#ADD_DEFINITIONS("-DFLOG")
-ADD_DEFINITIONS("-DMASTER_PKGNAME=\"org.tizen.data-provider-master\"")
+ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"")
ADD_DEFINITIONS("-DINFO_SOCKET=\"/opt/usr/share/live_magazine/.live.socket\"")
ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/opt/usr/share/live_magazine/.client.socket\"")
ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/opt/usr/share/live_magazine/.slave.socket\"")
Flora License
-Version 1.0, May, 2012
+Version 1.0, May, 2013
http://www.tizenopensource.org/license
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* Listed functions will be called when parser meets each typed component
*/
int (*update_text)(struct livebox *handle, const char *id, const char *part, const char *data); /*!< Update text content */
- int (*update_image)(struct livebox *handle, const char *id, const char *part, const char *data); /*!< Update image content */
+ int (*update_image)(struct livebox *handle, const char *id, const char *part, const char *data, const char *option); /*!< Update image content */
int (*update_script)(struct livebox *handle, const char *id, const char *part, const char *file, const char *group); /*!< Update script content */
int (*update_signal)(struct livebox *handle, const char *id, const char *emission, const char *signal); /*!< Update signal */
int (*update_drag)(struct livebox *handle, const char *id, const char *part, double dx, double dy); /*!< Update drag info */
/*!
* \brief Initialize the livebox system
- * \param[in] disp
- * \return int
+ * \param[in] disp If you have X Display connection object, you can re-use it. but you should care its life cycle.
+ * It must be alive before call the livebox_fini
+ * \return int 0 if success or < 0 (errno)
+ * \sa livebox_fini
*/
extern int livebox_init(void *disp);
/*!
* \brief Finalize the livebox system
- * \return int
+ * \return int 0 if success, -EINVAL if livebox_init is not called.
+ * \sa livebox_init
*/
extern int livebox_fini(void);
/*!
* \brief Client is paused.
- * \return int
+ * \return int 0 if success, -EFAULT if it failed to send state(paused) info
+ * \sa livebox_client_resumed
*/
extern int livebox_client_paused(void);
/*!
* \brief Client is rfesumed.
- * \return int
+ * \return int 0 if success, -EFAULT if it failed to send state(resumed) info
+ * \sa livebox_client_paused
*/
extern int livebox_client_resumed(void);
/*!
* \brief Add a new livebox
- * \param[in] pkgname
- * \param[in] content
+ * \param[in] pkgname Livebox Id
+ * \param[in] content Will be passed to the livebox.
* \param[in] cluster
* \param[in] category
- * \param[in] period
- * \param[in] cb
+ * \param[in] period Update period. if you set DEFAULT_PERIOD, the provider will use the default period which is described in the manifest.
+ * \param[in] cb After send the request to the provider, its result will be passed
* \param[in] data
* \return handle
*/
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
extern const char *util_basename(const char *name);
extern int util_validate_livebox_package(const char *pkgname);
extern const char *util_uri_to_path(const char *uri);
+extern int util_unlink(const char *filename);
#define SCHEMA_FILE "file://"
#define SCHEMA_PIXMAP "pixmap://"
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
Name: liblivebox-viewer
Summary: Library for developing the application.
-Version: 0.10.1
+Version: 0.10.3
Release: 1
-Group: framework/livebox
+Group: HomeTF/Livebox
License: Flora License
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake, gettext-tools, coreutils
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <packet.h>
#include <com-core.h>
#include <com-core_packet.h>
+#include <livebox-errno.h>
#include "debug.h"
#include "client.h"
ret = packet_get(packet, "iisss", &ret, &pinup, &pkgname, &id, &content);
if (ret != 5) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance (%s) is not exists\n", id);
goto out;
}
handler->is_pinned_up = pinup;
} else {
ErrPrint("Heap: %s\n", strerror(errno));
- ret = -ENOMEM;
+ ret = LB_STATUS_ERROR_MEMORY;
}
}
handler->pinup_cb = NULL; /*!< Reset pinup cb */
handler->pinup_cbdata = NULL;
- } else {
+ } else if (ret == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PINUP_CHANGED);
}
- ret = 0;
out:
return NULL;
}
handler->deleted_cbdata = NULL;
}
- DbgPrint("Call the created cb with -ECANCELED\n");
- handler->created_cb(handler, -ECANCELED, handler->created_cbdata);
+ DbgPrint("Call the created cb with LB_STATUS_ERROR_CANCEL\n");
+ handler->created_cb(handler, LB_STATUS_ERROR_CANCEL, handler->created_cbdata);
handler->created_cb = NULL;
handler->created_cbdata = NULL;
} else if (handler->id) {
if (handler->deleted_cb) {
DbgPrint("Call the deleted cb\n");
- handler->deleted_cb(handler, 0, handler->deleted_cbdata);
+ handler->deleted_cb(handler, LB_STATUS_SUCCESS, handler->deleted_cbdata);
handler->deleted_cb = NULL;
handler->deleted_cbdata = NULL;
&priority, &content, &title);
if (ret != 8) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("instance(%s) is not exists\n", id);
goto out;
}
* Don't try to notice anything with this, Just ignore all events
* Beacuse the user doesn't wants know about this anymore
*/
- ret = -EPERM;
+ DbgPrint("(%s) is not exists, but updated\n", id);
goto out;
}
if (lb_text_lb(handler)) {
lb_set_size(handler, lb_w, lb_h);
- ret = parse_desc(handler, livebox_filename(handler), 0);
+ (void)parse_desc(handler, livebox_filename(handler), 0);
/*!
* \note
* DESC parser will call the "text event callback".
+ * Don't need to call global event callback in this case.
*/
goto out;
} else if (lb_get_lb_fb(handler)) {
lb_set_lb_fb(handler, fbfile);
ret = fb_sync(lb_get_lb_fb(handler));
if (ret < 0)
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
} else {
lb_set_size(handler, lb_w, lb_h);
ret = 0;
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
} else {
(void)lb_set_pd_fb(handler, buf_id);
ret = fb_sync(lb_get_pd_fb(handler));
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n",
- pkgname,
- util_basename(util_uri_to_path(id)));
- }
+ if (ret < 0)
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
}
handler->is_pd_created = (status == 0);
lb_invoke_event_handler(handler, LB_EVENT_PD_CREATED);
}
- ret = 0;
out:
return NULL;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
lb_invoke_event_handler(handler, LB_EVENT_PD_DESTROYED);
}
- ret = 0;
out:
return NULL;
}
&pd_w, &pd_h);
if (ret != 6) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Instance(%s) is not exists\n", id);
goto out;
}
* So don't try to notice anything about this anymore.
* Just ignore all events.
*/
- ret = -EPERM;
+ ErrPrint("Instance(%s) is not created\n", id);
goto out;
}
lb_set_pdsize(handler, pd_w, pd_h);
if (lb_text_pd(handler)) {
- ret = parse_desc(handler, descfile, 1);
+ (void)parse_desc(handler, descfile, 1);
} else {
(void)lb_set_pd_fb(handler, fbfile);
ret = fb_sync(lb_get_pd_fb(handler));
- if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n",
- pkgname,
- util_basename(util_uri_to_path(id)));
- goto out;
- }
-
- lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
- ret = 0;
+ if (ret < 0)
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ else
+ lb_invoke_event_handler(handler, LB_EVENT_PD_UPDATED);
}
out:
if (!packet) {
ErrPrint("Invalid packet\n");
- ret = -EINVAL;
goto out;
}
ret = packet_get(packet, "ssiiii", &pkgname, &id, &is_pd, &w, &h, &status);
if (ret != 6) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (handler->state != CREATE) {
- ErrPrint("Hander is not created yet\n");
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created yet\n", id);
goto out;
}
lb_set_pdsize(handler, w, h);
lb_invoke_event_handler(handler, LB_EVENT_PD_SIZE_CHANGED);
} else {
- ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO\n");
+ ErrPrint("This is not possible. PD Size is changed but the return value is not ZERO (%d)\n", status);
}
} else {
if (status == 0) {
* Update it too.
*/
if (lb_get_lb_fb(handler))
- lb_set_lb_fb(handler, id);
+ (void)lb_set_lb_fb(handler, id);
/*!
* \NOTE
ret = packet_get(packet, "idss", &status, &period, &pkgname, &id);
if (ret != 4) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ErrPrint("Livebox(%s - %s) is not found\n", pkgname, id);
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not found\n", id);
goto out;
}
if (handler->state != CREATE) {
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created\n", id);
goto out;
}
handler->period_changed_cb = NULL;
handler->period_cbdata = NULL;
- } else {
+ } else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PERIOD_CHANGED);
}
- ret = 0;
-
out:
return NULL;
}
ret = packet_get(packet, "ssiss", &pkgname, &id, &status, &cluster, &category);
if (ret != 5) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
goto out;
}
handler = lb_find_livebox(pkgname, id);
if (!handler) {
- ret = -ENOENT;
+ ErrPrint("Livebox(%s) is not exists\n", id);
goto out;
}
* Do no access this handler,
* You cannot believe this handler anymore.
*/
- ret = -EPERM;
+ ErrPrint("Livebox(%s) is not created\n", id);
goto out;
}
DbgPrint("Group is changed? [%s] / [%s] (%d)\n", cluster, category, status);
if (status == 0)
- lb_set_group(handler, cluster, category);
+ (void)lb_set_group(handler, cluster, category);
if (handler->group_changed_cb) {
handler->group_changed_cb(handler, status, handler->group_cbdata);
handler->group_changed_cb = NULL;
handler->group_cbdata = NULL;
- } else {
+ } else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_GROUP_CHANGED);
}
- ret = 0;
-
out:
return NULL;
}
&lb_type, &pd_type, &period, &title, &is_pinned_up);
if (ret != 22) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
goto out;
}
handler = lb_new_livebox(pkgname, id, timestamp);
if (!handler) {
ErrPrint("Failed to create a new livebox\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
goto out;
}
* This is not possible!!!
*/
ErrPrint("Invalid handler\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
goto out;
}
content, cluster, category,
lb_fname, pd_fname);
- ret = -EALREADY;
+ ret = LB_STATUS_ERROR_ALREADY;
goto out;
}
* Do not clear this to use this from the deleted event callback.
* if this value is not cleared when the deleted event callback check it,
* it means that the created function is not called yet.
- * Then the call the deleted event callback with -ECANCELED errno.
+ * Then the call the deleted event callback with LB_STATUS_ERROR_CANCEL errno.
*/
}
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include "debug.h"
#include "util.h"
#include "critical_log.h"
+#include "livebox-errno.h" /* For error code */
static struct {
FILE *fp;
struct timeval tv;
if (!s_info.fp)
- return -EIO;
+ return LB_STATUS_ERROR_IO;
gettimeofday(&tv, NULL);
fprintf(s_info.fp, "%d %lu.%lu [%s:%d] ", getpid(), tv.tv_sec, tv.tv_usec, util_basename((char *)func), line);
s_info.filename = strdup(name);
if (!s_info.filename) {
ErrPrint("Failed to create a log file\n");
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
namelen = strlen(name) + strlen(SLAVE_LOG_PATH) + 20;
ErrPrint("Failed to create a log file\n");
free(s_info.filename);
s_info.filename = NULL;
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
snprintf(filename, namelen, "%s/%d_%s", SLAVE_LOG_PATH, s_info.file_id, name);
free(s_info.filename);
s_info.filename = NULL;
free(filename);
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
free(filename);
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <ctype.h>
#include <dlog.h>
+#include <livebox-errno.h>
#include "debug.h"
#include "livebox.h"
char *file;
int file_len;
- char *group;
- int group_len;
+ char *option;
+ int option_len;
char *id;
int id_len;
if (!block || !block->part || !block->data) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
struct livebox_script_operators *ops;
if (!block || !block->part) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
if (ops->update_image)
- ops->update_image(handle, block->id, block->part, block->data);
+ ops->update_image(handle, block->id, block->part, block->data, block->option);
return 0;
}
struct livebox_script_operators *ops;
if (!block || !block->part) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
if (ops->update_script)
- ops->update_script(handle, block->id, block->part, block->data, block->group);
+ ops->update_script(handle, block->id, block->part, block->data, block->option);
return 0;
}
if (!block) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
if (!block || !block->data || !block->part) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
if (sscanf(block->data, "%lfx%lf", &dx, &dy) != 2) {
ErrPrint("Invalid format of data\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (ops->update_drag)
if (!block || !block->part || !block->data) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
ops = is_pd ? &handle->pd.data.ops : &handle->lb.data.ops;
if (sscanf(block->data, "%dx%d", &w, &h) != 2) {
ErrPrint("Invalid format (%s)\n", block->data);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (ops->update_info_size)
VALUE_PART = 0x01,
VALUE_DATA = 0x02,
VALUE_FILE = 0x03,
- VALUE_GROUP = 0x04,
+ VALUE_OPTION = 0x04,
VALUE_ID = 0x05,
};
const char *field_name[] = {
"part",
"data",
"file",
- "group",
+ "option",
"id",
NULL
};
fp = fopen(descfile, "rt");
if (!fp) {
ErrPrint("Error: %s\n", strerror(errno));
- return -EIO;
+ return LB_STATUS_ERROR_IO;
}
update_begin(handle, is_pd);
if (!isspace(ch)) {
update_end(handle, is_pd);
fclose(fp);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
break;
CRITICAL_LOG("Heap: %s\n", strerror(errno));
update_end(handle, is_pd);
fclose(fp);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
state = FIELD;
idx = 0;
break;
case 4:
- state = VALUE_GROUP;
- if (block->group) {
- free(block->group);
- block->group = NULL;
- block->group_len = 0;
+ state = VALUE_OPTION;
+ if (block->option) {
+ free(block->option);
+ block->option = NULL;
+ block->option_len = 0;
}
idx = 0;
break;
idx++;
break;
- case VALUE_GROUP:
- if (idx == block->group_len) {
- block->group_len += 256;
- block->group = realloc(block->group, block->group_len);
- if (!block->group) {
+ case VALUE_OPTION:
+ if (idx == block->option_len) {
+ block->option_len += 256;
+ block->option = realloc(block->option, block->option_len);
+ if (!block->option) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
goto errout;
}
}
if (ch == '\n') {
- block->group[idx] = '\0';
+ block->option[idx] = '\0';
state = FIELD;
idx = 0;
field_idx = 0;
break;
}
- block->group[idx] = ch;
+ block->option[idx] = ch;
idx++;
break;
case VALUE_ID:
free(block->type);
free(block->part);
free(block->data);
- free(block->group);
+ free(block->option);
free(block->id);
free(block);
block = NULL;
free(block->type);
free(block->part);
free(block->data);
- free(block->group);
+ free(block->option);
free(block->id);
free(block);
}
update_end(handle, is_pd);
fclose(fp);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
/* End of a file */
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <X11/Xutil.h>
#include <dlog.h>
+#include <livebox-errno.h> /* For error code */
#include "debug.h"
#include "util.h"
buffer = info->buffer;
if (!buffer) /* Ignore this sync request */
- return 0;
+ return LB_STATUS_SUCCESS;
if (buffer->state != CREATED) {
ErrPrint("Invalid state of a FB\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (buffer->type != BUFFER_TYPE_FILE) {
DbgPrint("Invalid buffer\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
fd = open(util_uri_to_path(info->id), O_RDONLY);
*
* and then update it after it gots update events
*/
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (read(fd, buffer->data, info->bufsz) != info->bufsz) {
*
* and then update it after it gots update events
*/
- return 0;
+ return LB_STATUS_SUCCESS;
}
close(fd);
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline __attribute__((always_inline)) int sync_for_pixmap(struct fb_info *info)
buffer = info->buffer;
if (!buffer) /*!< Ignore this sync request */
- return 0;
+ return LB_STATUS_SUCCESS;
if (buffer->state != CREATED) {
ErrPrint("Invalid state of a FB\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (buffer->type != BUFFER_TYPE_PIXMAP) {
DbgPrint("Invalid buffer\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (!s_info.disp) {
s_info.visual = DefaultVisualOfScreen(screen);
} else {
ErrPrint("Failed to open a display\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
}
if (info->handle == 0) {
DbgPrint("Pixmap ID is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (info->bufsz == 0) {
DbgPrint("Nothing can be sync\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
si.shmid = shmget(IPC_PRIVATE, info->bufsz, IPC_CREAT | 0666);
if (si.shmid < 0) {
ErrPrint("shmget: %s\n", strerror(errno));
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
si.readOnly = False;
if (shmctl(si.shmid, IPC_RMID, 0) < 0)
ErrPrint("shmctl: %s\n", strerror(errno));
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
/*!
if (shmctl(si.shmid, IPC_RMID, 0) < 0)
ErrPrint("shmctl: %s\n", strerror(errno));
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
xim->data = si.shmaddr;
if (shmctl(si.shmid, IPC_RMID, 0) < 0)
ErrPrint("shmctl: %s\n", strerror(errno));
- return 0;
+ return LB_STATUS_SUCCESS;
}
int fb_sync(struct fb_info *info)
{
if (!info) {
ErrPrint("FB Handle is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!info->id || info->id[0] == '\0') {
DbgPrint("Ingore sync\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (!strncasecmp(info->id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
return sync_for_pixmap(info);
} else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) {
/* No need to do sync */
- return 0;
+ return LB_STATUS_SUCCESS;
}
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
struct fb_info *fb_create(const char *id, int w, int h)
} else if (sscanf(info->id, SCHEMA_PIXMAP "%d", &info->handle) == 1) {
DbgPrint("PIXMAP-SHMID: %d is gotten\n", info->handle);
} else {
- info->handle = -EINVAL;
+ info->handle = LB_STATUS_ERROR_INVALID;
}
info->bufsz = 0;
{
if (!info) {
ErrPrint("Handle is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (info->buffer) {
free(info->id);
free(info);
- return 0;
+ return LB_STATUS_SUCCESS;
}
int fb_is_created(struct fb_info *info)
if (buffer->state != CREATED) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
switch (buffer->type) {
int ret;
if (!data)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
buffer = container_of(data, struct buffer, data);
if (buffer->state != CREATED) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
switch (buffer->type) {
case BUFFER_TYPE_SHM:
if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) {
ErrPrint("Error: %s\n", strerror(errno));
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
ret = buf.shm_nattch;
ret = buffer->refcnt;
break;
default:
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
break;
}
{
if (!info) {
ErrPrint("Handle is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
*w = info->w;
*h = info->h;
- return 0;
+ return LB_STATUS_SUCCESS;
}
int fb_size(struct fb_info *info)
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <com-core_packet.h>
#include <packet.h>
#include <livebox-service.h>
+#include <livebox-errno.h>
#include "debug.h"
#include "fb.h"
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
/*!
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (cb)
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) { /*!< Group information is successfully changed */
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
if (!result) {
ErrPrint("Connection lost?\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid argument\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret >= 0) {
destroy_cb_info(data);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "is", &ret, &pkgname) != 2) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (cb)
if (!result) {
DbgPrint("Result is NIL (may connection lost)\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
DbgPrint("Invalid parameter\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
if (ret == 0) {
destroy_cb_info(info);
if (!result) {
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
} else if (packet_get(result, "i", &ret) != 1) {
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
DbgPrint("Delete category returns: %d\n", ret);
destroy_cb_info(info);
if (!result)
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
else if (packet_get(result, "i", &ret) != 1)
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
DbgPrint("Delete category returns: %d\n", ret);
destroy_cb_info(info);
if (!result)
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
else if (packet_get(result, "i", &ret) != 1)
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
if (ret == 0) {
handler->pinup_cb = cb;
packet = packet_create_noack(event, "ssdii", handler->pkgname, handler->id, timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
DbgPrint("Send: %dx%d\n", x, y);
if (s_info.init_count > 0) {
s_info.init_count++;
- return 0;
+ return LB_STATUS_SUCCESS;
}
env = getenv("PROVIDER_DISABLE_PREVENT_OVERWRITE");
if (env && !strcasecmp(env, "true"))
client_init();
s_info.init_count++;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_fini(void)
{
if (s_info.init_count <= 0) {
DbgPrint("Didn't initialized\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
s_info.init_count--;
if (s_info.init_count > 0) {
DbgPrint("init count : %d\n", s_info.init_count);
- return 0;
+ return LB_STATUS_SUCCESS;
}
client_fini();
fb_fini();
livebox_service_fini();
critical_log_fini();
- return 0;
+ return LB_STATUS_SUCCESS;
}
static inline char *lb_pkgname(const char *pkgname)
handler->pkgname = lb_pkgname(pkgname);
if (!handler->pkgname) {
- ErrPrint("Error: %s\n", strerror(errno));
free(handler);
return NULL;
}
if (!handler || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->period_changed_cb) {
ErrPrint("Previous request for changing period is not finished\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the period\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (handler->lb.period == period) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("set_period", "ssd", handler->pkgname, handler->id, period);
if (!packet) {
ErrPrint("Failed to build a packet %s\n", handler->pkgname);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is already deleted\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
handler->state = DELETE;
*/
if (cb)
cb(handler, 0, data);
- return 0;
+ return LB_STATUS_SUCCESS;
}
if (!cb)
struct fault_info *info;
if (!cb)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
info = malloc(sizeof(*info));
if (!info) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
info->handler = cb;
info->user_data = data;
s_info.fault_list = dlist_append(s_info.fault_list, info);
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *))
if (!cb) {
ErrPrint("Invalid argument cb is nil\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
info = malloc(sizeof(*info));
if (!info) {
CRITICAL_LOG("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
info->handler = cb;
info->user_data = data;
s_info.event_list = dlist_append(s_info.event_list, info);
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_unset_event_handler(int (*cb)(struct livebox *, enum livebox_event_type, void *))
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->size_changed_cb) {
ErrPrint("Previous resize request is not finished yet\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to be resized\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (livebox_service_get_size(type, &w, &h) != 0) {
ErrPrint("Invalid size type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.width == w && handler->lb.height == h) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;;
}
packet = packet_create("resize", "ssii", handler->pkgname, handler->id, w, h);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.auto_launch)
packet = packet_create_noack("clicked", "sssddd", handler->pkgname, handler->id, "clicked", timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
+ DbgPrint("Click request: %d\n", ret);
if (!handler->lb.mouse_event && (handler->lb.type == _LB_TYPE_BUFFER || handler->lb.type == _LB_TYPE_SCRIPT)) {
int ret; /* Shadow variable */
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return !!handler->pd.data.fb;
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return handler->is_pd_created;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->is_pd_created == 1) {
DbgPrint("PD already created\n");
- return 0;
+ return LB_STATUS_SUCCESS;
}
packet = packet_create("create_pd", "ssdd", handler->pkgname, handler->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->is_pd_created) {
DbgPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("pd_move", "ssdd", handler->pkgname, handler->id, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
struct packet *packet;
if (!pkgname)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("activate_package", "s", pkgname);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, activated_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->pd.data.fb || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->is_pd_created) {
ErrPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create("destroy_pd", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_PD_MASK) {
if (!handler->is_pd_created) {
ErrPrint("PD is not created\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MASK) {
if (!handler->pd.data.fb) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->pd.x) < MINIMUM_EVENT && fabs(y - handler->pd.y) < MINIMUM_EVENT)
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
} else if (type & CONTENT_EVENT_MOUSE_SET) {
flag = 0;
}
if (type & CONTENT_EVENT_MOUSE_MASK) {
if (!handler->lb.mouse_event) {
ErrPrint("Box is not support the mouse event\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!handler->lb.data.fb) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (type & CONTENT_EVENT_MOUSE_MOVE) {
if (fabs(x - handler->lb.x) < MINIMUM_EVENT && fabs(y - handler->lb.y) < MINIMUM_EVENT)
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
} else if (type & CONTENT_EVENT_MOUSE_SET) {
flag = 0;
}
break;
default:
ErrPrint("Invalid event type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return send_mouse_event(handler, cmd, x * w, y * h);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!w)
*h = handler->pd.height;
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_size(struct livebox *handler)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
w = handler->lb.width;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cluster || !category || handler->state != CREATE || !handler->id) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->group_changed_cb) {
ErrPrint("Previous group changing request is not finished yet\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (!handler->is_user) {
ErrPrint("CA Livebox is not able to change the group\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
if (!strcmp(handler->cluster, cluster) && !strcmp(handler->category, category)) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("change_group", "ssss", handler->pkgname, handler->id, cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cluster || !category || handler->state != CREATE || !handler->id) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
*cluster = handler->cluster;
*category = handler->category;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list)
if (!handler || !size_list) {
ErrPrint("Invalid argument, handler(%p), size_list(%p)\n", handler, size_list);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!cnt || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
for (j = i = 0; i < NR_OF_SIZE_LIST; i++) {
}
*cnt = j;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI const char *livebox_pkgname(struct livebox *handler)
packet = packet_create("delete_cluster", "s", cluster);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, delete_cluster_cb, create_cb_info(cb, data));
packet = packet_create("delete_category", "ss", cluster, category);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(NULL, packet, 0, delete_category_cb, create_cb_info(cb, data));
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
memcpy(&handler->pd.data.ops, ops, sizeof(*ops));
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
memcpy(&handler->lb.data.ops, ops, sizeof(*ops));
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.type != _LB_TYPE_SCRIPT && handler->lb.type != _LB_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
id = fb_id(handler->lb.data.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)))
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("lb_acquire_pixmap", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, pixmap_acquired_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->lb.type != _LB_TYPE_SCRIPT && handler->lb.type != _LB_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("lb_release_pixmap", "ssi", handler->pkgname, handler->id, pixmap);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_INVALID;
}
return master_rpc_request_only(handler, packet);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pd.type != _PD_TYPE_SCRIPT && handler->pd.type != _PD_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
id = fb_id(handler->pd.data.fb);
if (!id || strncasecmp(id, SCHEMA_PIXMAP, strlen(SCHEMA_PIXMAP)))
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create("pd_acquire_pixmap", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, pixmap_acquired_cb, create_cb_info(cb, data));
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Invalid handle\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pd.type != _PD_TYPE_SCRIPT && handler->pd.type != _PD_TYPE_BUFFER) {
ErrPrint("Handler is not valid type\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("pd_release_pixmap", "ssi", handler->pkgname, handler->id, pixmap);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return fb_size(handler->pd.data.fb);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return fb_size(handler->lb.data.fb);
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE) {
ErrPrint("Handler is invalid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
return handler->is_user;
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->pinup_cb) {
ErrPrint("Previous pinup request is not finished\n");
- return -EBUSY;
+ return LB_STATUS_ERROR_BUSY;
}
if (handler->is_pinned_up == flag) {
DbgPrint("No changes\n");
- return -EALREADY;
+ return LB_STATUS_ERROR_ALREADY;
}
packet = packet_create("pinup_changed", "ssi", handler->pkgname, handler->id, flag);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
return handler->is_pinned_up;
}
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
return handler->lb.pinup_supported;
}
{
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
handler->data = data;
- return 0;
+ return LB_STATUS_SUCCESS;
}
EAPI void *livebox_get_data(struct livebox *handler)
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if ((handler->lb.type != _LB_TYPE_TEXT && handler->pd.type != _PD_TYPE_TEXT) || handler->state != CREATE || !handler->id) {
ErrPrint("Handler is not valid\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!emission)
handler->pkgname, handler->id, emission, source, sx, sy, ex, ey);
if (!packet) {
ErrPrint("Failed to build a param\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_async_request(handler, packet, 0, text_signal_cb, create_cb_info(cb, data));
packet = packet_create_noack("subscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("unsubscribe", "ss", cluster ? cluster : "", category ? category : "");
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler) {
ErrPrint("Hnalder is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
packet = packet_create_noack("update", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(handler, packet);
if (!cluster || !category) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
packet = packet_create_noack("refresh_group", "ss", cluster, category);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
if (!handler) {
ErrPrint("Handler is NIL\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->state != CREATE || !handler->id)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
if (!handler->is_user) {
/* System cluster livebox cannot be changed its visible states */
if (state == LB_HIDE_WITH_PAUSE) {
ErrPrint("CA Livebox is not able to change the visibility\n");
- return -EPERM;
+ return LB_STATUS_ERROR_PERMISSION;
}
}
DbgPrint("Change the visibility %d <> %d, %s\n", handler->visible, state, handler->id);
if (handler->visible == state)
- return 0;
+ return LB_STATUS_ERROR_ALREADY;
packet = packet_create_noack("change,visibility", "ssi", handler->pkgname, handler->id, (int)state);
if (!packet) {
ErrPrint("Failed to create a packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
ret = master_rpc_request_only(handler, packet);
return LB_VISIBLE_ERROR;
}
- if (handler->state != CREATE)
+ if (handler->state != CREATE || !handler->id)
return LB_VISIBLE_ERROR;
return handler->visible;
pc = strdup(cluster);
if (!pc) {
CRITICAL_LOG("Heap: %s (cluster: %s)\n", strerror(errno), cluster);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
if (!ps) {
CRITICAL_LOG("Heap: %s (category: %s)\n", strerror(errno), category);
free(pc);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
handler->cluster = pc;
handler->category = ps;
- return 0;
+ return LB_STATUS_SUCCESS;
}
void lb_set_size(struct livebox *handler, int w, int h)
lb_unref(handler);
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_content(struct livebox *handler, const char *content)
handler->content = strdup(content);
if (!handler->content) {
CRITICAL_LOG("Heap: %s (content: %s)\n", strerror(errno), content);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_title(struct livebox *handler, const char *title)
handler->title = strdup(title);
if (!handler->title) {
CRITICAL_LOG("Heap: %s (title: %s)\n", strerror(errno), title);
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
}
- return 0;
+ return LB_STATUS_SUCCESS;
}
void lb_set_size_list(struct livebox *handler, int size_list)
struct fb_info *fb;
if (!handler)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fb = handler->lb.data.fb;
if (fb && !strcmp(fb_id(fb), filename)) /*!< BUFFER is not changed, */
- return 0;
+ return LB_STATUS_SUCCESS;
handler->lb.data.fb = NULL;
if (!filename || filename[0] == '\0') {
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
handler->lb.data.fb = fb_create(filename, handler->lb.width, handler->lb.height);
ErrPrint("Faield to create a FB\n");
if (fb)
fb_destroy(fb);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
int lb_set_pd_fb(struct livebox *handler, const char *filename)
struct fb_info *fb;
if (!handler)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
fb = handler->pd.data.fb;
if (fb && !strcmp(fb_id(fb), filename)) {
/* BUFFER is not changed, just update the content */
- return -EEXIST;
+ return LB_STATUS_ERROR_EXIST;
}
handler->pd.data.fb = NULL;
if (!filename || filename[0] == '\0') {
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
handler->pd.data.fb = fb_create(filename, handler->pd.width, handler->pd.height);
ErrPrint("Failed to create a FB\n");
if (fb)
fb_destroy(fb);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (fb)
fb_destroy(fb);
- return 0;
+ return LB_STATUS_SUCCESS;
}
struct fb_info *lb_get_lb_fb(struct livebox *handler)
if (handler->refcnt > 0)
return handler;
+ if (handler->filename)
+ util_unlink(handler->filename);
+
dlist_remove_data(s_info.livebox_list, handler);
handler->state = DESTROYED;
if (!cb && !!data) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (handler->deleted_cb) {
ErrPrint("Already in-progress\n");
- return -EINPROGRESS;
+ return LB_STATUS_ERROR_BUSY;
}
packet = packet_create("delete", "ss", handler->pkgname, handler->id);
if (!packet) {
ErrPrint("Failed to build a param\n");
if (cb)
- cb(handler, -EFAULT, data);
+ cb(handler, LB_STATUS_ERROR_FAULT, data);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
if (!cb)
packet = packet_create_noack("client_paused", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a pause packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
packet = packet_create_noack("client_resumed", "d", util_timestamp());
if (!packet) {
ErrPrint("Failed to create a resume packet\n");
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
return master_rpc_request_only(NULL, packet);
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <packet.h>
#include <com-core_packet.h>
+#include <livebox-errno.h>
#include "debug.h"
#include "dlist.h"
if (packet_get(packet, "i", &ret) != 1) {
ErrPrint("Invalid result packet\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
DbgPrint("[%s] Returns: %d\n", packet_command(packet), ret);
ret_cb(handler, NULL, data);
packet_unref(packet);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
command->ret_cb = ret_cb;
push_command(command);
packet_unref(packet);
- return 0;
+ return LB_STATUS_SUCCESS;
}
int master_rpc_request_only(struct livebox *handler, struct packet *packet)
if (!command) {
ErrPrint("Failed to create a command\n");
packet_unref(packet);
- return -EFAULT;
+ return LB_STATUS_ERROR_FAULT;
}
command->ret_cb = NULL;
push_command(command);
packet_unref(packet);
- return 0;
+ return LB_STATUS_SUCCESS;
}
int master_rpc_clear_fault_package(const char *pkgname)
struct command *command;
if (!pkgname)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
DbgPrint("Clear requests of the fault package(%s)\n", pkgname);
if (result) {
if (packet_get(result, "i", &ret) != 1) {
ErrPrint("Invalid result packet\n");
- ret = -EINVAL;
+ ret = LB_STATUS_ERROR_INVALID;
}
packet_unref(result);
} else {
ErrPrint("Failed to send a sync request\n");
- ret = -EFAULT;
+ ret = LB_STATUS_ERROR_FAULT;
}
packet_unref(packet);
/*
- * Copyright 2012 Samsung Electronics Co., Ltd
+ * Copyright 2013 Samsung Electronics Co., Ltd
*
* Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
#include <stdlib.h>
#include <dlog.h>
+#include <livebox-errno.h> /* For error code */
#include "debug.h"
#include "util.h"
name_len = strlen(filename);
while (--name_len >= 0 && *check_ptr) {
if (filename[name_len] != *check_ptr)
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
check_ptr ++;
}
path = malloc(len + 1);
if (!path) {
ErrPrint("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
snprintf(path, len, "/opt/usr/live/%s/libexec/liblive-%s.so", pkgname, pkgname);
if (access(path, F_OK | R_OK) != 0) {
ErrPrint("%s is not a valid package\n", pkgname);
free(path);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
free(path);
path = malloc(len + 1);
if (!path) {
ErrPrint("Heap: %s\n", strerror(errno));
- return -ENOMEM;
+ return LB_STATUS_ERROR_MEMORY;
}
snprintf(path, len, "/opt/usr/apps/%s/res/wgt/livebox/index.html", pkgname);
if (access(path, F_OK | R_OK) != 0) {
ErrPrint("%s is not a valid package\n", pkgname);
free(path);
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
free(path);
{
if (!pkgname) {
ErrPrint("Invalid argument\n");
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
if (!check_native_livebox(pkgname) || !check_web_livebox(pkgname))
return 0;
- return -EINVAL;
+ return LB_STATUS_ERROR_INVALID;
}
const char *util_uri_to_path(const char *uri)
return uri + len;
}
+int util_unlink(const char *filename)
+{
+ char *descfile;
+ int desclen;
+ int ret;
+
+ desclen = strlen(filename) + 6; /* .desc */
+ descfile = malloc(desclen);
+ if (!descfile) {
+ ErrPrint("Heap: %s\n", strerror(errno));
+ return LB_STATUS_ERROR_MEMORY;
+ }
+
+ ret = snprintf(descfile, desclen, "%s.desc", filename);
+ if (ret < 0) {
+ ErrPrint("Error: %s\n", strerror(errno));
+ free(descfile);
+ return LB_STATUS_ERROR_FAULT;
+ }
+
+ (void)unlink(descfile);
+ free(descfile);
+ (void)unlink(filename);
+
+ return LB_STATUS_SUCCESS;
+}
+
/* End of a file */