We want patches done with diff -uNp please.

On Sun, Sep 12, 2010 at 10:56:22PM +0200, Merlyn wrote:
> sending the patch fot bioctl
> I'm quite a newbie, so if you find some problem (and you certainly will),
> could you please explain it for me?
> there is a little change from the previous patch - parameter
> has been renamed to -t and expects the number of retries (0 means infinitely).
> 
> 
> *** /usr/src/sbin/bioctl/bioctl.c     Sun Sep 12 00:15:18 2010
> --- /usr/src/sbin/bioctl/bioctl.c     Sun Sep 12 23:41:27 2010
> ***************
> *** 71,77 ****
>   void                        bio_setstate(char *, int, char *);
>   void                        bio_setblink(char *, char *, int);
>   void                        bio_blink(char *, int, int);
> ! void                        bio_createraid(u_int16_t, char *, char *);
>   void                        bio_deleteraid(char *);
>   void                        bio_changepass(char *);
>   u_int32_t           bio_createflags(char *);
> --- 71,77 ----
>   void                        bio_setstate(char *, int, char *);
>   void                        bio_setblink(char *, char *, int);
>   void                        bio_blink(char *, int, int);
> ! int                 bio_createraid(u_int16_t, char *, char *);
>   void                        bio_deleteraid(char *);
>   void                        bio_changepass(char *);
>   u_int32_t           bio_createflags(char *);
> ***************
> *** 102,112 ****
>       int                     ss_func = 0;
>       u_int16_t               cr_level = 0;
>       int                     biodev = 0;
> 
>       if (argc < 2)
>               usage();
> 
> !     while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:vu:")) !=
>           -1) {
>               switch (ch) {
>               case 'a': /* alarm */
> --- 102,115 ----
>       int                     ss_func = 0;
>       u_int16_t               cr_level = 0;
>       int                     biodev = 0;
> +     int                     success = 0;
> +     int                     more_tries = 0;
> +     int                     retries = 0;
> 
>       if (argc < 2)
>               usage();
> 
> !     while ((ch = getopt(argc, argv, "a:b:C:c:dH:hik:l:Pp:qr:R:t:vu:")) !=
>           -1) {
>               switch (ch) {
>               case 'a': /* alarm */
> ***************
> *** 132,137 ****
> --- 135,148 ----
>                       /* delete volume */
>                       func |= BIOC_DELETERAID;
>                       break;
> +             case 't':
> +                     /* ask for password retries-times */
> +                     more_tries = 1;
> +                     retries = strtonum(optarg, 0, 1000, &errstr);
> +                     if (errstr != NULL)
> +                             errx(1, "Number of retries is %s: %s",
> +                                     errstr, optarg);
> +                     break;
>               case 'u': /* unblink */
>                       func |= BIOC_BLINK;
>                       blink = BIOC_SBUNBLINK;
> ***************
> *** 234,240 ****
>                       errx(1, "need -l parameter");
>               if (!biodev)
>                       errx(1, "must use bio device");
> !             bio_createraid(cr_level, dev_list, key_disk);
>       }
> 
>       return (0);
> --- 245,264 ----
>                       errx(1, "need -l parameter");
>               if (!biodev)
>                       errx(1, "must use bio device");
> !             if (more_tries == 1){
> !                     if ( retries == 0 ){
> !                             do {
> !                                     success=bio_createraid(cr_level, 
> dev_list, key_disk);
> !                             } while ( success == -1 );
> !                     } else {
> !                             do {
> !                                     success=bio_createraid(cr_level, 
> dev_list, key_disk);
> !                             } while ( --retries > 0 && success == -1 );
> !                     }
> !             } else {
> !                     bio_createraid(cr_level, dev_list, key_disk);
> !             }
> !     
>       }
> 
>       return (0);
> ***************
> *** 685,691 ****
>       close(bioh);
>   }
> 
> ! void
>   bio_createraid(u_int16_t level, char *dev_list, char *key_disk)
>   {
>       struct bioc_createraid  create;
> --- 709,715 ----
>       close(bioh);
>   }
> 
> ! int
>   bio_createraid(u_int16_t level, char *dev_list, char *key_disk)
>   {
>       struct bioc_createraid  create;
> ***************
> *** 798,805 ****
>       memset(&kdfinfo, 0, sizeof(kdfinfo));
>       memset(&create, 0, sizeof(create));
>       if (rv == -1) {
> !             if (errno == EPERM)
> !                     errx(1, "Incorrect passphrase");
>               err(1, "BIOCCREATERAID");
>       }
> 
> --- 822,831 ----
>       memset(&kdfinfo, 0, sizeof(kdfinfo));
>       memset(&create, 0, sizeof(create));
>       if (rv == -1) {
> !             if (errno == EPERM) {
> !                     fprintf(stderr,"Incorrect passphrase\n");
> !                     return -1;
> !             }
>               err(1, "BIOCCREATERAID");
>       }

Reply via email to