vinum.patch

rumcic, 10/10/2009 05:22 PM

Download (3.38 KB)

View differences:

sys/dev/raid/vinum/vinumio.c
327 327
    int result;
328 328
    struct vinum_hdr *vhdr;
329 329

  
330
    error = init_drive(drive, 0);			    /* find the drive */
330
    error = init_drive(drive, verbose);			    /* find the drive */
331 331
    if (error)						    /* find the drive */
332 332
	return DL_CANT_OPEN;				    /* not ours */
333 333

  
......
702 702
	char part;					    /* UNIX partition */
703 703
	int slice;
704 704
	int founddrive;					    /* flag when we find a vinum drive */
705
	int has_slice = 0;
705
	int has_slice = -1;
706 706
	int has_part = 0;
707 707
	char *tmp;
708 708

  
......
715 715
	 */
716 716
	if ((tmp = rindex(devicename[driveno], '/')) == NULL)
717 717
	    tmp = devicename[driveno];
718
	while (*tmp && (*tmp < '0' || *tmp > '9'))
719
	    ++tmp;
720
	while (*tmp && *tmp >= '0' && *tmp <= '9')
721
	    ++tmp;
722
	if (*tmp == 's')
723
	    has_slice = strtol(tmp + 1, &tmp, 0);
724
	if (*tmp >= 'a' && *tmp <= 'p')
725
	    has_part = *tmp;
718
	else
719
		tmp++;
720
	ksscanf(tmp, "%*[a-z]%*d%*[s]%d%c", &has_slice, &has_part);
726 721

  
727
	/*
728
	 * Scan slices if no slice was specified, only if no partition was
729
	 * specified.
730
	 */
731
	if (has_slice == 0 && has_part == 0)
732 722
	for (slice = 0; slice < MAX_SLICES; slice++) {
733
	    if (has_slice && slice != has_slice)
723
	    if (has_slice >= 0 && slice != has_slice)
734 724
		continue;
735 725

  
736 726
	    for (part = 'a'; part < 'a' + MAXPARTITIONS; part++) {
737
		if (has_part && part != has_part)
738
		    continue;
739 727
		if (part == 'c')
740 728
		    continue;
741
		ksnprintf(partname, DRIVENAMELEN,
742
			"%ss%d%c", devicename[driveno], slice, part);
729
		if (has_part && part != has_part)
730
		    continue;
731
		if (has_slice >= 0 && has_part)
732
			strncpy(partname, devicename[driveno], DRIVENAMELEN);
733
		else if (has_slice >= 0)
734
			ksnprintf(partname, DRIVENAMELEN,
735
				"%s%c", devicename[driveno], part);
736
		else
737
			ksnprintf(partname, DRIVENAMELEN,
738
				"%ss%d%c", devicename[driveno], slice, part);
743 739
		drive = check_drive(partname);	    /* try to open it */
744 740
		if ((drive->lasterror != 0)		    /* didn't work, */
745 741
		    ||(drive->state != drive_up))
......
756 752
		}
757 753
	    }
758 754
	}
759
	if (founddrive == 0 && has_slice == 0) {	    /* didn't find anything, */
760
	    for (part = 'a'; part < 'a' + MAXPARTITIONS; part++) {	    /* try the compatibility partition */
761
		if (has_part && has_part != part)
762
		    continue;
763
		if (part == 'c')
764
		    continue;
765
		if (has_part) {
766
		    ksnprintf(partname, DRIVENAMELEN,
767
			    "%s", devicename[driveno]);
768
		} else {
769
		    ksnprintf(partname, DRIVENAMELEN,
770
			    "%s%c", devicename[driveno], part);
771
		}
772
		drive = check_drive(partname);	    /* try to open it */
773
		if ((drive->lasterror != 0)		    /* didn't work, */
774
		||(drive->state != drive_up))
775
		    free_drive(drive);		    /* get rid of it */
776
		else if (drive->flags & VF_CONFIGURED)  /* already read this config, */
777
		    log(LOG_WARNING,
778
			"vinum: already read config from %s\n", /* say so */
779
			drive->label.name);
780
		else {
781
		    drivelist[gooddrives] = drive->driveno;	/* keep the drive index */
782
		    drive->flags &= ~VF_NEWBORN;	    /* which is no longer newly born */
783
		    gooddrives++;
784
		}
785
	    }
786
	}
787 755
    }
788 756

  
789 757
    if (gooddrives == 0) {