Skip to content

Commit

Permalink
os : Common Log messages
Browse files Browse the repository at this point in the history
make changes in os folder to edit log messages
  • Loading branch information
NayanaNagaraj23 committed Sep 2, 2024
1 parent d07b2ac commit 3ef52c8
Show file tree
Hide file tree
Showing 142 changed files with 492 additions and 490 deletions.
7 changes: 4 additions & 3 deletions os/audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include <tinyara/fs/fs.h>
#include <tinyara/arch.h>
#include <tinyara/audio/audio.h>
#include <tinyara/common_logs/common_logs.h>

#include <arch/irq.h>

Expand Down Expand Up @@ -938,7 +939,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)

upper = (FAR struct audio_upperhalf_s *)kmm_zalloc(sizeof(struct audio_upperhalf_s));
if (!upper) {
auddbg("ERROR: Allocation failed\n");
auddbg("%s\n", clog_message_str[CMN_LOG_ALLOC_FAIL]);
return -ENOMEM;
}

Expand Down Expand Up @@ -990,7 +991,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)

ret = mkdir(path, 0644);
if (ret < 0) {
auddbg("ERROR: mkdir failed\n");
auddbg("%s %s \n", clog_message_str[CMN_LOG_FAILED_OP], path);
kmm_free(upper);
return ret;
}
Expand Down Expand Up @@ -1031,7 +1032,7 @@ int audio_register(FAR const char *name, FAR struct audio_lowerhalf_s *dev)

ret = mkdir(devname, 0644);
if (ret < 0) {
auddbg("ERROR: mkdir failed\n");
auddbg("%s %s \n", clog_message_str[CMN_LOG_FILE_OPEN_ERROR], devname);
kmm_free(upper);
return ret;
}
Expand Down
11 changes: 6 additions & 5 deletions os/binfmt/binfmt_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include <tinyara/kmalloc.h>
#include <tinyara/sched.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/common_logs/common_logs.h>

#include "binfmt.h"

Expand Down Expand Up @@ -149,7 +150,7 @@ int exec(FAR const char *filename, FAR char *const *argv, FAR const struct symta
start_addr = kmm_memalign(size, size);

if (!start_addr) {
berr("ERROR: Failed to allocate RAM partition\n");
berr("%s RAM Partition\n",clog_message_str[CMN_LOG_ALLOC_FAIL]);
errcode = ENOMEM;
goto errout;
}
Expand All @@ -159,7 +160,7 @@ int exec(FAR const char *filename, FAR char *const *argv, FAR const struct symta

bin = (FAR struct binary_s *)kmm_zalloc(sizeof(struct binary_s));
if (!bin) {
berr("ERROR: Failed to allocate binary_s\n");
berr(" %s binary_s \n", clog_message_str[CMN_LOG_ALLOC_FAIL]);
errcode = ENOMEM;
goto err_free_partition;
}
Expand All @@ -178,7 +179,7 @@ int exec(FAR const char *filename, FAR char *const *argv, FAR const struct symta
ret = binfmt_copyargv(bin, argv);
if (ret < 0) {
errcode = -ret;
berr("ERROR: Failed to copy argv[]: %d\n", errcode);
berr("%s copy argv[]: %d\n" ,clog_message_str[CMN_LOG_FAILED_OP], errcode);
goto errout_with_bin;
}

Expand All @@ -187,7 +188,7 @@ int exec(FAR const char *filename, FAR char *const *argv, FAR const struct symta
ret = load_module(bin);
if (ret < 0) {
errcode = -ret;
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
berr("%s to load program %s': %d\n",clog_message_str[CMN_LOG_FAILED_OP], filename, errcode);
goto errout_with_argv;
}

Expand All @@ -203,7 +204,7 @@ int exec(FAR const char *filename, FAR char *const *argv, FAR const struct symta
pid = exec_module(bin);
if (pid < 0) {
errcode = -pid;
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
berr("%s to execute program'%s': %d\n",clog_message_str[CMN_LOG_FAILED_OP], filename, errcode);
goto errout_with_lock;
}

Expand Down
12 changes: 7 additions & 5 deletions os/binfmt/binfmt_execmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
#include <tinyara/mm/shm.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/mm/mm.h>
#include <tinyara/common_logs/common_logs.h>

#if defined(CONFIG_APP_BINARY_SEPARATION) && defined(CONFIG_ARCH_USE_MMU)
#include <tinyara/mmu.h>
#endif
Expand Down Expand Up @@ -188,7 +190,7 @@ int exec_module(FAR struct binary_s *binp)
binp->uheap = (struct mm_heap_s *)binp->sections[BIN_HEAP];
ret = mm_initialize(binp->uheap, (void *)binp->sections[BIN_HEAP] + sizeof(struct mm_heap_s), binp->sizes[BIN_HEAP]);
if (ret != OK) {
berr("ERROR: mm_initialize() failed, %d.\n", ret);
berr("%s mm_initialize(), %d.\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}
mm_add_app_heap_list(binp->uheap, binp->bin_name);
Expand All @@ -213,7 +215,7 @@ int exec_module(FAR struct binary_s *binp)

ret = up_create_stack((FAR struct tcb_s *)newtcb, binp->stacksize, TCB_FLAG_TTYPE_TASK);
if (ret < 0) {
berr("ERROR: up_create_stack() failed.\n");
berr("%s up_create_stack().\n",clog_message_str[CMN_LOG_FAILED_OP]);
goto errout_with_appheap;
}
stack = newtcb->cmn.stack_alloc_ptr;
Expand All @@ -223,7 +225,7 @@ int exec_module(FAR struct binary_s *binp)
ret = task_init((FAR struct tcb_s *)newtcb, binp->filename, binp->priority, NULL, binp->stacksize, binp->entrypt, binp->argv);
if (ret < 0) {
ret = -get_errno();
berr("task_init() failed: %d\n", ret);
berr("%s task_init: %d\n", clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout_with_stack;
}

Expand Down Expand Up @@ -261,7 +263,7 @@ int exec_module(FAR struct binary_s *binp)

ret = shm_group_initialize(newtcb->cmn.group);
if (ret < 0) {
berr("ERROR: shm_group_initialize() failed: %d\n", ret);
berr("%s shm_group_initialize(): %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout_with_tcbinit;
}
#endif
Expand Down Expand Up @@ -343,7 +345,7 @@ int exec_module(FAR struct binary_s *binp)
ret = task_activate((FAR struct tcb_s *)newtcb);
if (ret < 0) {
ret = -get_errno();
berr("task_activate() failed: %d\n", ret);
berr("%s task_activate(): %d\n", clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout_with_tcbinit;
}

Expand Down
3 changes: 2 additions & 1 deletion os/binfmt/binfmt_exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
#include <tinyara/mm/mm.h>
#include <tinyara/kmalloc.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/common_logs/common_logs.h>

#include "binfmt.h"

Expand Down Expand Up @@ -110,7 +111,7 @@ int binfmt_exit(FAR struct binary_s *bin)

ret = unload_module(bin);
if (ret < 0) {
berr("ERROR: unload_module() failed: %d\n", ret);
berr("%s %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}

elf_delete_bin_section_addr(bin->binary_idx);
Expand Down
11 changes: 6 additions & 5 deletions os/binfmt/binfmt_initialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/binfmt/builtin.h>
#include <tinyara/binfmt/elf.h>
#include <tinyara/common_logs/common_logs.h>

#ifdef CONFIG_BINFMT_ENABLE

Expand All @@ -81,35 +82,35 @@ void binfmt_initialize(void)
#ifdef CONFIG_FS_BINFS
ret = builtin_initialize();
if (ret < 0) {
berr("ERROR: builtin_initialize failed: %d\n", ret);
berr("%s builtin_initialize() : %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}
#endif

#ifdef CONFIG_ELF
ret = elf_initialize();
if (ret < 0) {
berr("ERROR: elf_initialize failed: %d\n", ret);
berr("%s elf_initialize(): %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}
#endif

#ifdef CONFIG_BINFMT_PCODE
ret = pcode_initialize();
if (ret < 0) {
berr("ERROR: pcode_initialize failed: %d\n", ret);
berr("%s pcode_initialize() : %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}
#endif

#ifdef CONFIG_NXFLAT
ret = nxflat_initialize();
if (ret < 0) {
berr("ERROR: nxflat_initialize failed: %d\n", ret);
berr("%s nxflat_initialize() : %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}
#endif

#ifdef CONFIG_XIP_ELF
ret = xipelf_initialize();
if (ret < 0) {
berr("ERROR: xipelf_initialize failed: %d\n", ret);
berr("%s xipelf_initialize(): %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}
#endif

Expand Down
13 changes: 7 additions & 6 deletions os/binfmt/binfmt_loadbinary.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <tinyara/sched.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/binary_manager.h>
#include <tinyara/common_logs/common_logs.h>

#ifdef CONFIG_SAVE_BIN_SECTION_ADDR
#include "libelf/libelf.h"
Expand Down Expand Up @@ -89,11 +90,11 @@ int load_binary(int binary_idx, FAR const char *filename, load_attr_t *load_attr

/* Sanity check */
if (!load_attr) {
berr("ERROR: Invalid load_attr\n");
berr("%s attr\n", clog_message_str[CMN_LOG_INVALID_VAL]);
errcode = -EINVAL;
goto errout;
} else if (load_attr->bin_size <= 0) {
berr("ERROR: Invalid file length!\n");
berr("%s file length \n", clog_message_str[CMN_LOG_INVALID_VAL]);
errcode = -EINVAL;
goto errout;
}
Expand All @@ -107,7 +108,7 @@ int load_binary(int binary_idx, FAR const char *filename, load_attr_t *load_attr
if (bin) {
if (!bin->data_backup) {
errcode = -EINVAL;
berr("ERROR: Failed to find copy of data section from previous load\n");
berr("%s find copy of data section from previous load\n",clog_message_str[CMN_LOG_FAILED_OP]);
goto errout_with_bin;
}

Expand All @@ -121,7 +122,7 @@ int load_binary(int binary_idx, FAR const char *filename, load_attr_t *load_attr

bin = (FAR struct binary_s *)kmm_zalloc(sizeof(struct binary_s));
if (!bin) {
berr("ERROR: Failed to allocate binary_s\n");
berr("%s binary_s\n",clog_message_str[CMN_LOG_ALLOC_FAIL]);
errcode = -ENOMEM;
goto errout_with_bin;
}
Expand Down Expand Up @@ -165,7 +166,7 @@ int load_binary(int binary_idx, FAR const char *filename, load_attr_t *load_attr
ret = load_module(bin);
if (ret < 0) {
errcode = ret;
berr("ERROR: Failed to load program '%s': %d\n", filename, errcode);
berr("%s load program '%s': %d\n",clog_message_str[CMN_LOG_FAILED_OP], filename, errcode);
goto errout_with_bin;
}

Expand Down Expand Up @@ -215,7 +216,7 @@ int load_binary(int binary_idx, FAR const char *filename, load_attr_t *load_attr
pid = exec_module(bin);
if (pid < 0) {
errcode = pid;
berr("ERROR: Failed to execute program '%s': %d\n", filename, errcode);
berr("%s execute program '%s': %d\n", clog_message_str[CMN_LOG_FAILED_OP], filename, errcode);
elf_delete_bin_section_addr(bin->binary_idx);
goto errout_with_unload;
}
Expand Down
3 changes: 2 additions & 1 deletion os/binfmt/binfmt_loadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include <tinyara/sched.h>
#include <tinyara/kmalloc.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/common_logs/common_logs.h>

#include "binfmt.h"

Expand Down Expand Up @@ -97,7 +98,7 @@ static int load_default_priority(FAR struct binary_s *bin)

ret = sched_getparam(0, &param);
if (ret < 0) {
berr("ERROR: sched_getparam failed: %d\n", ret);
berr("%s %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}

Expand Down
5 changes: 3 additions & 2 deletions os/binfmt/binfmt_unloadmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

#include <tinyara/kmalloc.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/common_logs/common_logs.h>

#include "binfmt.h"
#include "binfmt_arch_apis.h"
Expand Down Expand Up @@ -143,7 +144,7 @@ int unload_module(FAR struct binary_s *binp)
if (binp->unload) {
ret = binp->unload(binp);
if (ret < 0) {
berr("binp->unload() failed: %d\n", ret);
berr("%s binp->unload(): %d\n", clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}
}
Expand All @@ -152,7 +153,7 @@ int unload_module(FAR struct binary_s *binp)

ret = exec_dtors(binp);
if (ret < 0) {
berr("exec_ctors() failed: %d\n", ret);
berr("%s exec_ctors(): %d\n", clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}
#endif
Expand Down
7 changes: 4 additions & 3 deletions os/binfmt/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
#include <tinyara/fs/ioctl.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/binfmt/builtin.h>
#include <tinyara/common_logs/common_logs.h>

#ifdef CONFIG_BUILTIN

Expand Down Expand Up @@ -118,7 +119,7 @@ static int builtin_loadbinary(struct binary_s *binp)

fd = open(binp->filename, O_RDONLY);
if (fd < 0) {
berr("ERROR: Failed to open binary %s: %d\n", binp->filename, fd);
berr("%s %s: %d\n",clog_message_str[CMN_LOG_FILE_OPEN_ERROR], binp->filename, fd);
return fd;
}

Expand All @@ -129,7 +130,7 @@ static int builtin_loadbinary(struct binary_s *binp)
ret = ioctl(fd, FIOC_FILENAME, (unsigned long)((uintptr_t) & filename));
if (ret < 0) {
int errval = get_errno();
berr("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
berr("%s %d\n",clog_message_str[CMN_LOG_FILE_IOCTL_ERROR], errval);
close(fd);
return -errval;
}
Expand Down Expand Up @@ -187,7 +188,7 @@ int builtin_initialize(void)

ret = register_binfmt(&g_builtin_binfmt);
if (ret != 0) {
berr("Failed to register binfmt: %d\n", ret);
berr("%s register binfmt(): %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}

return ret;
Expand Down
9 changes: 5 additions & 4 deletions os/binfmt/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <tinyara/arch.h>
#include <tinyara/binfmt/binfmt.h>
#include <tinyara/binfmt/elf.h>
#include <tinyara/common_logs/common_logs.h>

#include "libelf/libelf.h"

Expand Down Expand Up @@ -219,7 +220,7 @@ static int elf_loadbinary(FAR struct binary_s *binp)
ret = elf_init(binp->filename, &loadinfo);
if (ret != 0) {
elf_dumploadinfo(&loadinfo);
berr("Failed to initialize for load of ELF program: %d\n", ret);
berr("%s to initialize for load of ELF program: %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout;
}

Expand All @@ -228,15 +229,15 @@ static int elf_loadbinary(FAR struct binary_s *binp)
ret = elf_load(&loadinfo);
elf_dumploadinfo(&loadinfo);
if (ret != 0) {
berr("Failed to load ELF program binary: %d\n", ret);
berr("%s load ELF program %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout_with_init;
}

/* Bind the program to the exported symbol table */

ret = elf_bind(&loadinfo, binp->exports, binp->nexports);
if (ret != 0) {
berr("Failed to bind symbols program binary: %d\n", ret);
berr("%s bind symbols %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
goto errout_with_load;
}

Expand Down Expand Up @@ -301,7 +302,7 @@ int elf_initialize(void)

ret = register_binfmt(&g_elfbinfmt);
if (ret != 0) {
berr("Failed to register binfmt: %d\n", ret);
berr("%s register binfmt(): %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
}

return ret;
Expand Down
Loading

0 comments on commit 3ef52c8

Please sign in to comment.