Hi Pierpaolo.

On Tue, Aug 11, 2009 at 07:01:47PM +0000, pierpaolo giacomin ([email protected]) 
wrote:
> Unfortunately I can't spot wrong spaces and braces placement.
> Indent man reports for kernel code:
> -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1
> -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob
> -nfca -cp33 -ss -ts8 -il1
> 
> which breaks lines shorter than 80 chars and use a different indentation
> for switch/case and labels, which is not what you do, so it generates a
> garbage patch.
> Do you use some indent configuration to conform to kernel code style? 

Nope, just either checkpatch.pl or manual.

> > Please also provide signed-off line as described in
> > Documentation/SubmittingPatches
> 
> Included.
> 
> Best regards,
> Pierpaolo

> --- pohmelfs-server/cfg/cfg.c 2009-08-05 14:50:37.000000000 +0300
> +++ pohmelfs-server.y/cfg/cfg.c       2009-08-05 14:49:18.000000000 +0300
> @@ -53,12 +53,15 @@ static unsigned int pohmelfs_seq;
>  static void pohmelfs_display_function(struct pohmelfs_ctl *ctl)
>  {
>       static int display_banner;
> +     static unsigned int last_config_index;
>       struct sockaddr_in *sa;
>       struct sockaddr_in6 *sa6;
>       struct in6_addr *in6;
>       struct sockaddr *saddr;
>       char inet6_addr[128];
>  
> +     if (last_config_index != ctl->idx) display_banner = 0;
> +     

Trailing space here. Please also put execution statement to the next
line.

>       if (!display_banner) {
>               printf("Config Index = %d\n", ctl->idx);
>               printf("Family    Server IP                                     
>        Port     \n");
> @@ -138,7 +141,7 @@ static int pohmelfs_recv_ack(int s, unsi
>                               errno = ack->error;
>                               if(errno)
>                                       return errno;
> -                             if (flags == POHMELFS_FLAGS_SHOW) {
> +                             if (flags == POHMELFS_FLAGS_SHOW || 
> POHMELFS_FLAGS_DUMP) {
>                                        pohmelfs_display_function(&ack->ctl);
>                               }
>                               if (!ack->msg_num)
> @@ -252,6 +255,29 @@ static int pohmelfs_show_remote(int s, u
>       return err;
>  }
>  
> +static int pohmelfs_dump_remote(int s)
> +{
> +     struct pohmelfs_ctl ctl;
> +     int err;
> +     memset(&ctl, 0, sizeof(struct pohmelfs_ctl));
> +     err =  pohmelfs_netlink_send(s, POHMELFS_FLAGS_DUMP, 
> +                     &ctl, sizeof(struct pohmelfs_ctl));
> +
> +     return err;
> +}
> +
> +static int pohmelfs_flush_remote(int s, unsigned int idx)
> +{
> +     struct pohmelfs_ctl ctl;
> +     int err;
> +     memset(&ctl, 0, sizeof(struct pohmelfs_ctl));
> +     ctl.idx = idx;
> +     err =  pohmelfs_netlink_send(s, POHMELFS_FLAGS_FLUSH, 
> +                     &ctl, sizeof(struct pohmelfs_ctl));
> +
> +     return err;
> +}
> +
>  static int pohmelfs_add_remote(int s, char *addr, int port, unsigned int 
> idx, int perm, int prio, int action)
>  {
>       int err;
> @@ -302,20 +328,21 @@ static int pohmelfs_add_crypto(int s, ch
>  
>  static void pohmelfs_usage(char *p)
>  {
> -     fprintf(stderr, "Usage: %s -A[ction] {add/del/show/modify} -a[ddress] 
> {ipv4/ipv6} -p[ort] -i[ndex]"
> +     fprintf(stderr, "Usage: %s -A[ction] {add/del/show/modify/dump/flush} 
> -a[ddress] {ipv4/ipv6} -p[ort] -i[ndex]"
>               " -k[cipher_key_file] -K [hash_key_file] -C[ipher] -H[ash] 
> -P[riority] -I[nput/output permissions] -h\n", p);
> +     fprintf(stderr, "\tindex %d reserved as null idx\n", POHMELFS_NULL_IDX);
>  }
>  
>  int main(int argc, char *argv[])
>  {
>       int ch, port, err, s, prio, perm;
> -     unsigned int idx;
> +     int idx;
>       char *addr, *action, *cipher_key, *hash_key, *cipher, *hash;
>       struct sockaddr_nl l_local;
>  
>       addr = NULL;
>       port = -1;
> -     idx = 0;
> +     idx = POHMELFS_NULL_IDX;
>       action = cipher_key = hash_key = cipher = hash = NULL;
>       perm = POHMELFS_IO_PERM_READ | POHMELFS_IO_PERM_WRITE;
>       prio = 0;
> @@ -334,6 +361,11 @@ int main(int argc, char *argv[])
>                               prio = atoi(optarg);
>                               break;
>                       case 'i':
> +                             if(atoi(optarg) == POHMELFS_NULL_IDX)
> +                             {

Please put it on the same line as if () and add a space after 'if'
itself.

> +                                     pohmelfs_usage(argv[0]);
> +                                     return -1;
> +                             }
>                               idx = atoi(optarg);
>                               break;
>                       case 'C':
> @@ -390,6 +422,11 @@ int main(int argc, char *argv[])
>       err = -EINVAL;
>  
>       if (action) {
> +             if (strncmp(action, "flush", 5)) {
> +                     if(idx == -1)
> +                             idx = 0;
> +             }
> +     
>               if (!strncmp(action, "add", 3)) {
>                       if (addr && port != -1)
>                               err = pohmelfs_add_remote(s, addr, port, idx, 
> perm, prio, POHMELFS_FLAGS_ADD);
> @@ -419,6 +456,14 @@ int main(int argc, char *argv[])
>                               if (err)
>                                       goto out;
>                       }
> +             } else if (!strncmp(action, "dump", 4)) {
> +                     err = pohmelfs_dump_remote(s);
> +                     if (err)
> +                             goto out;
> +             } else if (!strncmp(action, "flush", 5)) {
> +                     err = pohmelfs_flush_remote(s, idx);
> +                     if (err)
> +                             goto out;
>               } else if (!strncmp(action, "modify", 6)) {
>                       err = pohmelfs_add_remote(s, addr, port, idx, perm, 
> prio, POHMELFS_FLAGS_MODIFY);
>                       if (err)
> Signed-off-by: Pierpaolo Giacomin <[email protected]>

This should be first in the serie. It is enough to put it into the mail
itself.

> diff -uprN -X linux-2.6.30.4.ori/Documentation/dontdiff 
> linux-2.6.30.4.ori/drivers/staging/pohmelfs/config.c 
> linux-2.6.30.4/drivers/staging/pohmelfs/config.c
> --- linux-2.6.30.4.ori/drivers/staging/pohmelfs/config.c      2009-08-11 
> 20:48:06.000000000 +0300
> +++ linux-2.6.30.4/drivers/staging/pohmelfs/config.c  2009-08-11 
> 20:53:22.000000000 +0300
> @@ -38,9 +38,9 @@ static DEFINE_MUTEX(pohmelfs_config_lock
>  static inline int pohmelfs_config_eql(struct pohmelfs_ctl *sc, struct 
> pohmelfs_ctl *ctl)
>  {
>       if (sc->idx == ctl->idx && sc->type == ctl->type &&
> -             sc->proto == ctl->proto &&
> -             sc->addrlen == ctl->addrlen &&
> -             !memcmp(&sc->addr, &ctl->addr, ctl->addrlen))
> +                 sc->proto == ctl->proto &&
> +                 sc->addrlen == ctl->addrlen &&
> +                 !memcmp(&sc->addr, &ctl->addr, ctl->addrlen))

Why did you move those lines?


-- 
        Evgeniy Polyakov
_______________________________________________
Pohmelfs mailing list
[email protected]
http://www.ioremap.net/cgi-bin/mailman/listinfo/pohmelfs

Reply via email to