qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/4] bsd-user: Fix some code style problems
@ 2021-01-13  9:30 shiliyang
  2021-01-13  9:31 ` [PATCH V3 1/4] bsd-user: "foo * bar" should be "foo *bar" shiliyang
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: shiliyang @ 2021-01-13  9:30 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alex.chen, hunongda

This patch series fixes error style problems found by checkpatch.pl.

V2->V3:
Make the patch into a series.

V1->V2:
Add cover letter message.
Fix some style error in patch file before.

Liyang Shi (4):
  bsd-user: "foo * bar" should be "foo *bar"
  bsd-user: suspect code indent for conditional statements
  bsd-user: space required after semicolon
  bsd-user: do not use C99 // comments

 bsd-user/bsdload.c |  6 +++---
 bsd-user/elfload.c | 38 +++++++++++++++++++-------------------
 bsd-user/qemu.h    | 14 +++++++-------
 bsd-user/syscall.c |  6 +++---
 4 files changed, 32 insertions(+), 32 deletions(-)

-- 
2.29.1.59.gf9b6481aed



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH V3 1/4] bsd-user: "foo * bar" should be "foo *bar"
  2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
@ 2021-01-13  9:31 ` shiliyang
  2021-01-13  9:32 ` [PATCH V3 2/4] bsd-user: suspect code indent for conditional statements shiliyang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: shiliyang @ 2021-01-13  9:31 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alex.chen, hunongda

This patch fixes error style problems found by checkpatch.pl:
ERROR: "foo ** bar" should be "foo **bar".
ERROR: "foo * bar" should be "foo *bar"

Signed-off-by: Liyang Shi <shiliyang@huawei.com>

---
 bsd-user/bsdload.c |  6 +++---
 bsd-user/elfload.c | 22 +++++++++++-----------
 bsd-user/qemu.h    | 14 +++++++-------
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c
index f38c4faacf..b2f352c041 100644
--- a/bsd-user/bsdload.c
+++ b/bsd-user/bsdload.c
@@ -20,7 +20,7 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
     return 0;
 }

-static int count(char ** vec)
+static int count(char **vec)
 {
     int         i;

@@ -125,8 +125,8 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
     return sp;
 }

-int loader_exec(const char * filename, char ** argv, char ** envp,
-             struct target_pt_regs * regs, struct image_info *infop)
+int loader_exec(const char *filename, char **argv, char **envp,
+             struct target_pt_regs *regs, struct image_info *infop)
 {
     struct linux_binprm bprm;
     int retval;
diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 32378af7b2..35c340f13a 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -547,12 +547,12 @@ struct exec

 #define DLINFO_ITEMS 12

-static inline void memcpy_fromfs(void * to, const void * from, unsigned long n)
+static inline void memcpy_fromfs(void *to, const void *from, unsigned long n)
 {
         memcpy(to, from, n);
 }

-static int load_aout_interp(void * exptr, int interp_fd);
+static int load_aout_interp(void *exptr, int interp_fd);

 #ifdef BSWAP_NEEDED
 static void bswap_ehdr(struct elfhdr *ehdr)
@@ -613,7 +613,7 @@ static void bswap_sym(struct elf_sym *sym)
  * to be put directly into the top of new user memory.
  *
  */
-static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
+static abi_ulong copy_elf_strings(int argc, char **argv, void **page,
                                   abi_ulong p)
 {
     char *tmp, *tmp1, *pag = NULL;
@@ -756,7 +756,7 @@ static void padzero(abi_ulong elf_bss, abi_ulong last_bss)


 static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
-                                   struct elfhdr * exec,
+                                   struct elfhdr *exec,
                                    abi_ulong load_addr,
                                    abi_ulong load_bias,
                                    abi_ulong interp_load_addr, int ibcs,
@@ -834,7 +834,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
 }


-static abi_ulong load_elf_interp(struct elfhdr * interp_elf_ex,
+static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex,
                                  int interpreter_fd,
                                  abi_ulong *interp_load_addr)
 {
@@ -1143,8 +1143,8 @@ static void load_symbols(struct elfhdr *hdr, int fd)
     syminfos = s;
 }

-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info)
+int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info)
 {
     struct elfhdr elf_ex;
     struct elfhdr interp_elf_ex;
@@ -1155,11 +1155,11 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
     unsigned int interpreter_type = INTERPRETER_NONE;
     unsigned char ibcs2_interpreter;
     int i;
-    struct elf_phdr * elf_ppnt;
+    struct elf_phdr *elf_ppnt;
     struct elf_phdr *elf_phdata;
     abi_ulong elf_bss, k, elf_brk;
     int retval;
-    char * elf_interpreter;
+    char *elf_interpreter;
     abi_ulong elf_entry, interp_load_addr = 0;
     abi_ulong start_code, end_code, start_data, end_data;
     abi_ulong reloc_func_desc = 0;
@@ -1334,7 +1334,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
        and then start this sucker up */

     {
-        char * passed_p;
+        char *passed_p;

         if (interpreter_type == INTERPRETER_AOUT) {
             snprintf(passed_fileno, sizeof(passed_fileno), "%d", bprm->fd);
@@ -1553,7 +1553,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
     return 0;
 }

-static int load_aout_interp(void * exptr, int interp_fd)
+static int load_aout_interp(void *exptr, int interp_fd)
 {
     printf("a.out interpreter not yet supported\n");
     return(0);
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index f8bb1e5459..cbf42129e4 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -123,19 +123,19 @@ struct linux_binprm {
         int argc, envc;
         char **argv;
         char **envp;
-        char * filename;        /* Name of binary */
+        char *filename;        /* Name of binary */
 };

 void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
 abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
                               abi_ulong stringp, int push_ptr);
-int loader_exec(const char * filename, char ** argv, char ** envp,
-             struct target_pt_regs * regs, struct image_info *infop);
+int loader_exec(const char *filename, char **argv, char **envp,
+             struct target_pt_regs *regs, struct image_info *infop);

-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info);
-int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info);
+int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info);
+int load_flt_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info);

 abi_long memcpy_to_target(abi_ulong dest, const void *src,
                           unsigned long len);
-- 
2.29.1.59.gf9b6481aed



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V3 2/4] bsd-user: suspect code indent for conditional statements
  2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
  2021-01-13  9:31 ` [PATCH V3 1/4] bsd-user: "foo * bar" should be "foo *bar" shiliyang
@ 2021-01-13  9:32 ` shiliyang
  2021-01-13  9:32 ` [PATCH V3 3/4] bsd-user: space required after semicolon shiliyang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: shiliyang @ 2021-01-13  9:32 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alex.chen, hunongda

This patch fixes error style problems found by checkpatch.pl:
ERROR: suspect code indent for conditional statements

Signed-off-by: Liyang Shi <shiliyang@huawei.com>

---
 bsd-user/elfload.c | 10 +++++-----
 bsd-user/syscall.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index 35c340f13a..a121e71339 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -184,7 +184,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
     memset(regs, 0, sizeof(*regs));
     regs->ARM_cpsr = 0x10;
     if (infop->entry & 1)
-      regs->ARM_cpsr |= CPSR_T;
+        regs->ARM_cpsr |= CPSR_T;
     regs->ARM_pc = infop->entry & 0xfffffffe;
     regs->ARM_sp = infop->start_stack;
     /* FIXME - what to for failure of get_user()? */
@@ -784,7 +784,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
         sp = sp &~ (abi_ulong)15;
         size = (DLINFO_ITEMS + 1) * 2;
         if (k_platform)
-          size += 2;
+            size += 2;
 #ifdef DLINFO_ARCH_ITEMS
         size += DLINFO_ARCH_ITEMS * 2;
 #endif
@@ -871,7 +871,7 @@ static abi_ulong load_elf_interp(struct elfhdr *interp_elf_ex,
                 malloc(sizeof(struct elf_phdr) * interp_elf_ex->e_phnum);

         if (!elf_phdata)
-          return ~((abi_ulong)0UL);
+            return ~((abi_ulong)0UL);

         /*
          * If the size of this structure has changed, then punt, since
@@ -1267,7 +1267,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,

             if (strcmp(elf_interpreter,"/usr/lib/libc.so.1") == 0 ||
                 strcmp(elf_interpreter,"/usr/lib/ld.so.1") == 0) {
-              ibcs2_interpreter = 1;
+                ibcs2_interpreter = 1;
             }

 #if 0
@@ -1314,7 +1314,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,
         /* Now figure out which format our binary is */
         if ((N_MAGIC(interp_ex) != OMAGIC) && (N_MAGIC(interp_ex) != ZMAGIC) &&
                 (N_MAGIC(interp_ex) != QMAGIC)) {
-          interpreter_type = INTERPRETER_ELF;
+            interpreter_type = INTERPRETER_ELF;
         }

         if (interp_elf_ex.e_ident[0] != 0x7f ||
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index d38ec7a162..9b471b665c 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -241,7 +241,7 @@ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong ol
         return -TARGET_EFAULT;
     holdlen = oldlen;
     for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++)
-       *q++ = tswap32(*p);
+        *q++ = tswap32(*p);
     oidfmt(snamep, namelen, NULL, &kind);
     /* XXX swap hnewp */
     ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen));
-- 
2.29.1.59.gf9b6481aed



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V3 3/4] bsd-user: space required after semicolon
  2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
  2021-01-13  9:31 ` [PATCH V3 1/4] bsd-user: "foo * bar" should be "foo *bar" shiliyang
  2021-01-13  9:32 ` [PATCH V3 2/4] bsd-user: suspect code indent for conditional statements shiliyang
@ 2021-01-13  9:32 ` shiliyang
  2021-01-13  9:33 ` [PATCH V3 4/4] bsd-user: do not use C99 // comments shiliyang
  2021-01-13 22:03 ` [PATCH V3 0/4] bsd-user: Fix some code style problems Warner Losh
  4 siblings, 0 replies; 7+ messages in thread
From: shiliyang @ 2021-01-13  9:32 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alex.chen, hunongda

This patch fixes error style problems found by checkpatch.pl:
ERROR: space required after that ';'

Signed-off-by: Liyang Shi <shiliyang@huawei.com>

---
 bsd-user/elfload.c | 2 +-
 bsd-user/syscall.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index a121e71339..fab9da757c 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -1227,7 +1227,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct target_pt_regs *regs,
     end_data = 0;
     interp_ex.a_info = 0;

-    for(i=0;i < elf_ex.e_phnum; i++) {
+    for (i = 0; i < elf_ex.e_phnum; i++) {
         if (elf_ppnt->p_type == PT_INTERP) {
             if ( elf_interpreter != NULL )
             {
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 9b471b665c..e16dc80478 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -271,7 +271,7 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr,
     target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1);
     if (!target_vec)
         return -TARGET_EFAULT;
-    for(i = 0;i < count; i++) {
+    for (i = 0; i < count; i++) {
         base = tswapl(target_vec[i].iov_base);
         vec[i].iov_len = tswapl(target_vec[i].iov_len);
         if (vec[i].iov_len != 0) {
@@ -297,7 +297,7 @@ static abi_long unlock_iovec(struct iovec *vec, abi_ulong target_addr,
     target_vec = lock_user(VERIFY_READ, target_addr, count * sizeof(struct target_iovec), 1);
     if (!target_vec)
         return -TARGET_EFAULT;
-    for(i = 0;i < count; i++) {
+    for (i = 0; i < count; i++) {
         if (target_vec[i].iov_base) {
             base = tswapl(target_vec[i].iov_base);
             unlock_user(vec[i].iov_base, base, copy ? vec[i].iov_len : 0);
-- 
2.29.1.59.gf9b6481aed



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V3 4/4] bsd-user: do not use C99 // comments
  2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
                   ` (2 preceding siblings ...)
  2021-01-13  9:32 ` [PATCH V3 3/4] bsd-user: space required after semicolon shiliyang
@ 2021-01-13  9:33 ` shiliyang
  2021-01-13 22:03 ` [PATCH V3 0/4] bsd-user: Fix some code style problems Warner Losh
  4 siblings, 0 replies; 7+ messages in thread
From: shiliyang @ 2021-01-13  9:33 UTC (permalink / raw)
  To: qemu-devel, peter.maydell; +Cc: alex.chen, hunongda

This patch fixes error messages found by checkpatch.pl:
ERROR: do not use C99 // comments

Signed-off-by: Liyang Shi <shiliyang@huawei.com>

---
 bsd-user/elfload.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index fab9da757c..ff571088f7 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -1010,7 +1010,7 @@ static const char *lookup_symbolxx(struct syminfo *s, target_ulong orig_addr)
     struct elf_sym *syms = s->disas_symtab.elf64;
 #endif

-    // binary search
+    /* binary search */
     struct elf_sym *sym;

     sym = bsearch(&orig_addr, syms, s->disas_num_syms, sizeof(*syms), symfind);
@@ -1092,7 +1092,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)
 #ifdef BSWAP_NEEDED
         bswap_sym(syms + i);
 #endif
-        // Throw away entries which we do not need.
+        /* Throw away entries which we do not need. */
         if (syms[i].st_shndx == SHN_UNDEF ||
                 syms[i].st_shndx >= SHN_LORESERVE ||
                 ELF_ST_TYPE(syms[i].st_info) != STT_FUNC) {
-- 
2.29.1.59.gf9b6481aed



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 0/4] bsd-user: Fix some code style problems
  2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
                   ` (3 preceding siblings ...)
  2021-01-13  9:33 ` [PATCH V3 4/4] bsd-user: do not use C99 // comments shiliyang
@ 2021-01-13 22:03 ` Warner Losh
  2021-01-14  6:42   ` shiliyang
  4 siblings, 1 reply; 7+ messages in thread
From: Warner Losh @ 2021-01-13 22:03 UTC (permalink / raw)
  To: shiliyang; +Cc: alex.chen, Peter Maydell, QEMU Developers, hunongda

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

While these changes look good, can you submit this against the bsd-user
repository? White space changes like this in mainline make rebasing harder
than needed.

https://github.com/qemu-bsd-user/qemu-bsd-user branch
bsd-user-rebase-3.1and we'll make sure they get via our coming pull
requests..

Warner

On Wed, Jan 13, 2021 at 2:31 AM shiliyang <shiliyang@huawei.com> wrote:

> This patch series fixes error style problems found by checkpatch.pl.
>
> V2->V3:
> Make the patch into a series.
>
> V1->V2:
> Add cover letter message.
> Fix some style error in patch file before.
>
> Liyang Shi (4):
>   bsd-user: "foo * bar" should be "foo *bar"
>   bsd-user: suspect code indent for conditional statements
>   bsd-user: space required after semicolon
>   bsd-user: do not use C99 // comments
>
>  bsd-user/bsdload.c |  6 +++---
>  bsd-user/elfload.c | 38 +++++++++++++++++++-------------------
>  bsd-user/qemu.h    | 14 +++++++-------
>  bsd-user/syscall.c |  6 +++---
>  4 files changed, 32 insertions(+), 32 deletions(-)
>
> --
> 2.29.1.59.gf9b6481aed
>
>
>

[-- Attachment #2: Type: text/html, Size: 1648 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 0/4] bsd-user: Fix some code style problems
  2021-01-13 22:03 ` [PATCH V3 0/4] bsd-user: Fix some code style problems Warner Losh
@ 2021-01-14  6:42   ` shiliyang
  0 siblings, 0 replies; 7+ messages in thread
From: shiliyang @ 2021-01-14  6:42 UTC (permalink / raw)
  To: Warner Losh; +Cc: alex.chen, Peter Maydell, QEMU Developers, hunongda


On 2021/1/14 6:03, Warner Losh wrote:
> While these changes look good, can you submit this against the bsd-user repository? White space changes like this in mainline make rebasing harder than needed.
> 
> https://github.com/qemu-bsd-user/qemu-bsd-user <https://github.com/qemu-bsd-user/qemu-bsd-user> branch bsd-user-rebase-3.1and we'll make sure they get via our coming pull requests..
> 
> Warner
> 
> On Wed, Jan 13, 2021 at 2:31 AM shiliyang <shiliyang@huawei.com <mailto:shiliyang@huawei.com>> wrote:
> 
>     This patch series fixes error style problems found by checkpatch.pl <http://checkpatch.pl>.
> 
>     V2->V3:
>     Make the patch into a series.
> 
>     V1->V2:
>     Add cover letter message.
>     Fix some style error in patch file before.
> 
>     Liyang Shi (4):
>       bsd-user: "foo * bar" should be "foo *bar"
>       bsd-user: suspect code indent for conditional statements
>       bsd-user: space required after semicolon
>       bsd-user: do not use C99 // comments
> 
>      bsd-user/bsdload.c |  6 +++---
>      bsd-user/elfload.c | 38 +++++++++++++++++++-------------------
>      bsd-user/qemu.h    | 14 +++++++-------
>      bsd-user/syscall.c |  6 +++---
>      4 files changed, 32 insertions(+), 32 deletions(-)
> 
>     -- 
>     2.29.1.59.gf9b6481aed
> 
> 

OK, I get it, thanks!

Best regards.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-14  6:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-13  9:30 [PATCH V3 0/4] bsd-user: Fix some code style problems shiliyang
2021-01-13  9:31 ` [PATCH V3 1/4] bsd-user: "foo * bar" should be "foo *bar" shiliyang
2021-01-13  9:32 ` [PATCH V3 2/4] bsd-user: suspect code indent for conditional statements shiliyang
2021-01-13  9:32 ` [PATCH V3 3/4] bsd-user: space required after semicolon shiliyang
2021-01-13  9:33 ` [PATCH V3 4/4] bsd-user: do not use C99 // comments shiliyang
2021-01-13 22:03 ` [PATCH V3 0/4] bsd-user: Fix some code style problems Warner Losh
2021-01-14  6:42   ` shiliyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).