return NULL;
}
-static char *get_operation_char(enum block_dev_operation op,
- char *name, unsigned int len)
+static const char *get_operation_char(enum block_dev_operation op)
{
- char *str = "unknown";
-
- if (!name)
- return NULL;
-
switch (op) {
case BLOCK_DEV_MOUNT:
- str = "MOUNT";
- break;
+ return "MOUNT";
+
case BLOCK_DEV_UNMOUNT:
- str = "UNMOUNT";
- break;
+ return "UNMOUNT";
+
case BLOCK_DEV_FORMAT:
- str = "FORMAT";
- break;
+ return "FORMAT";
+
case BLOCK_DEV_INSERT:
- str = "INSERT";
- break;
+ return "INSERT";
+
case BLOCK_DEV_REMOVE:
- str = "REMOVE";
- break;
+ return "REMOVE";
+
case BLOCK_LUKS_CLOSE:
- str = "LUKS CLOSE";
- break;
- default:
- _E("invalid operation (%d)", op);
- break;
+ return "LUKS CLOSE";
}
- snprintf(name, len, "%s", str);
- return name;
+ _E("invalid operation (%d)", op);
+ return "unknown";
}
static void create_external_apps_directory(void)
{
struct pipe_data pdata = { op, bdev, result };
int n;
- char name[16];
_D("op : %s, bdev : %p, result : %d",
- get_operation_char(pdata.op, name, sizeof(name)),
+ get_operation_char(pdata.op),
pdata.bdev, pdata.result);
// Multi thread should not write at the same time
int n;
int thread_id;
int ret;
- char name[16];
n = read(fd, &pdata, sizeof(pdata));
if (n != sizeof(pdata) || !pdata.bdev) {
}
_I("op : %s, bdev : %p, result : %d",
- get_operation_char(pdata.op, name, sizeof(name)),
+ get_operation_char(pdata.op),
pdata.bdev, pdata.result);
if (pdata.op == BLOCK_DEV_MOUNT && pdata.result < 0) {
{
struct operation_queue *op;
dd_list *l, *next;
- char name[16];
int thread_id;
assert(bdev);
DD_LIST_FOREACH_SAFE(bdev->op_queue, l, next, op) {
if (op->done) {
_D("Remove operation (%s, %s)",
- get_operation_char(op->op, name, sizeof(name)),
+ get_operation_char(op->op),
bdev->data->devnode);
DD_LIST_REMOVE(bdev->op_queue, op);
int ret = 0;
int thread_id;
char devnode[PATH_MAX];
- char name[16];
enum block_dev_operation operation;
bool unmounted = false;
operation = op->op;
_D("Thread id %d Trigger operation (%s, %s)", thread_id,
- get_operation_char(operation, name, sizeof(name)), devnode);
+ get_operation_char(operation), devnode);
unmounted = false;
if (operation == BLOCK_DEV_INSERT && bdev->removed) {
check_removed(bdev, &queue, &op);
operation = op->op;
_D("Trigger operation again (%s, %s)",
- get_operation_char(operation, name, sizeof(name)), devnode);
+ get_operation_char(operation), devnode);
}
if (operation == BLOCK_DEV_MOUNT) {
unmounted = check_unmount(bdev, &queue, &op);
if (unmounted) {
operation = op->op;
_D("Trigger operation again (%s, %s)",
- get_operation_char(operation, name, sizeof(name)), devnode);
+ get_operation_char(operation), devnode);
}
}
int ret;
int thread_id;
bool start_th;
- char name[16];
if (!bdev)
return -EINVAL;
_I("Add operation (%s, %s)",
- get_operation_char(operation, name, sizeof(name)),
+ get_operation_char(operation),
bdev->data->devnode);
thread_id = bdev->thread_id;