diff mbox series

[bpf-next,8/9] libbpf: typo and formatting fixes

Message ID 20190529011426.1328736-9-andriin@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series [bpf-next,1/9] libbpf: fix detection of corrupted BPF instructions section | expand

Commit Message

Andrii Nakryiko May 29, 2019, 1:14 a.m. UTC
A bunch of typo and formatting fixes.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/lib/bpf/libbpf.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Song Liu May 29, 2019, 5:25 p.m. UTC | #1
On Tue, May 28, 2019 at 6:14 PM Andrii Nakryiko <andriin@fb.com> wrote:
>
> A bunch of typo and formatting fixes.
>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>

> ---
>  tools/lib/bpf/libbpf.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index e3bc00933145..9d9c19a1b2fe 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -505,7 +505,7 @@ static struct bpf_object *bpf_object__new(const char *path,
>
>         obj->efile.fd = -1;
>         /*
> -        * Caller of this function should also calls
> +        * Caller of this function should also call
>          * bpf_object__elf_finish() after data collection to return
>          * obj_buf to user. If not, we should duplicate the buffer to
>          * avoid user freeing them before elf finish.
> @@ -574,8 +574,7 @@ static int bpf_object__elf_init(struct bpf_object *obj)
>                 }
>
>                 obj->efile.elf = elf_begin(obj->efile.fd,
> -                               LIBBPF_ELF_C_READ_MMAP,
> -                               NULL);
> +                                          LIBBPF_ELF_C_READ_MMAP, NULL);
>         }
>
>         if (!obj->efile.elf) {
> @@ -594,9 +593,9 @@ static int bpf_object__elf_init(struct bpf_object *obj)
>         ep = &obj->efile.ehdr;
>
>         /* Old LLVM set e_machine to EM_NONE */
> -       if ((ep->e_type != ET_REL) || (ep->e_machine && (ep->e_machine != EM_BPF))) {
> -               pr_warning("%s is not an eBPF object file\n",
> -                       obj->path);
> +       if (ep->e_type != ET_REL ||
> +           (ep->e_machine && ep->e_machine != EM_BPF)) {
> +               pr_warning("%s is not an eBPF object file\n", obj->path);
>                 err = -LIBBPF_ERRNO__FORMAT;
>                 goto errout;
>         }
> @@ -1438,7 +1437,7 @@ bpf_program__collect_reloc(struct bpf_program *prog, GElf_Shdr *shdr,
>                         }
>
>                         if (map_idx >= nr_maps) {
> -                               pr_warning("bpf relocation: map_idx %d large than %d\n",
> +                               pr_warning("bpf relocation: map_idx %d larger than %d\n",
>                                            (int)map_idx, (int)nr_maps - 1);
>                                 return -LIBBPF_ERRNO__RELOC;
>                         }
> @@ -1797,7 +1796,7 @@ bpf_object__create_maps(struct bpf_object *obj)
>                         }
>                 }
>
> -               pr_debug("create map %s: fd=%d\n", map->name, *pfd);
> +               pr_debug("created map %s: fd=%d\n", map->name, *pfd);
>         }
>
>         return 0;
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e3bc00933145..9d9c19a1b2fe 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -505,7 +505,7 @@  static struct bpf_object *bpf_object__new(const char *path,
 
 	obj->efile.fd = -1;
 	/*
-	 * Caller of this function should also calls
+	 * Caller of this function should also call
 	 * bpf_object__elf_finish() after data collection to return
 	 * obj_buf to user. If not, we should duplicate the buffer to
 	 * avoid user freeing them before elf finish.
@@ -574,8 +574,7 @@  static int bpf_object__elf_init(struct bpf_object *obj)
 		}
 
 		obj->efile.elf = elf_begin(obj->efile.fd,
-				LIBBPF_ELF_C_READ_MMAP,
-				NULL);
+					   LIBBPF_ELF_C_READ_MMAP, NULL);
 	}
 
 	if (!obj->efile.elf) {
@@ -594,9 +593,9 @@  static int bpf_object__elf_init(struct bpf_object *obj)
 	ep = &obj->efile.ehdr;
 
 	/* Old LLVM set e_machine to EM_NONE */
-	if ((ep->e_type != ET_REL) || (ep->e_machine && (ep->e_machine != EM_BPF))) {
-		pr_warning("%s is not an eBPF object file\n",
-			obj->path);
+	if (ep->e_type != ET_REL ||
+	    (ep->e_machine && ep->e_machine != EM_BPF)) {
+		pr_warning("%s is not an eBPF object file\n", obj->path);
 		err = -LIBBPF_ERRNO__FORMAT;
 		goto errout;
 	}
@@ -1438,7 +1437,7 @@  bpf_program__collect_reloc(struct bpf_program *prog, GElf_Shdr *shdr,
 			}
 
 			if (map_idx >= nr_maps) {
-				pr_warning("bpf relocation: map_idx %d large than %d\n",
+				pr_warning("bpf relocation: map_idx %d larger than %d\n",
 					   (int)map_idx, (int)nr_maps - 1);
 				return -LIBBPF_ERRNO__RELOC;
 			}
@@ -1797,7 +1796,7 @@  bpf_object__create_maps(struct bpf_object *obj)
 			}
 		}
 
-		pr_debug("create map %s: fd=%d\n", map->name, *pfd);
+		pr_debug("created map %s: fd=%d\n", map->name, *pfd);
 	}
 
 	return 0;