kernels/linux-2.4.0/drivers/md/lvm.c
/*
 * character device support function VGDA reduce
 */
character device support function VGDA reduce
character device support function VGDA reduce
static int lvm_do_vg_reduce(vg_t *vg_ptr, void *arg) {
	uint p;
	pv_t *pv_ptr;
	if (vg_ptr == NULL) return -ENXIO;
	if (copy_from_user(pv_name, arg, sizeof(pv_name)) != 0)
		return -EFAULT;
	for (p = 0; p < vg_ptr->pv_max; p++) {
		pv_ptr = vg_ptr->pv[p];
		if (pv_ptr != NULL &&
		    strcmp(pv_ptr->pv_name,
			       pv_name) == 0) {
			if (pv_ptr->lv_cur > 0) return -EPERM;
			vg_ptr->pe_total -=
			    pv_ptr->pe_total;
			vg_ptr->pv_cur--;
			vg_ptr->pv_act--;
			lvm_do_pv_remove(vg_ptr, p);
			for (; p < vg_ptr->pv_max - 1; p++)
				vg_ptr->pv[p] = vg_ptr->pv[p + 1];
			vg_ptr->pv[p + 1] = NULL;
			return 0;
		}
	}
	return -ENXIO;
}
static int lvm_do_vg_reduce ( vg_t * vg_ptr , void * arg ) { uint p ; pv_t * pv_ptr ; if ( vg_ptr == NULL ) return - ENXIO ; if ( copy_from_user ( pv_name , arg , sizeof ( pv_name ) ) != 0 ) return - EFAULT ; for ( p = 0 ; p < vg_ptr -> pv_max ; p ++ ) { pv_ptr = vg_ptr -> pv [ p ] ; if ( pv_ptr != NULL && strcmp ( pv_ptr -> pv_name , pv_name ) == 0 ) { if ( pv_ptr -> lv_cur > 0 ) return - EPERM ; vg_ptr -> pe_total -= pv_ptr -> pe_total ; vg_ptr -> pv_cur -- ; vg_ptr -> pv_act -- ; lvm_do_pv_remove ( vg_ptr , p ) ; for ( ; p < vg_ptr -> pv_max - 1 ; p ++ ) vg_ptr -> pv [ p ] = vg_ptr -> pv [ p + 1 ] ; vg_ptr -> pv [ p + 1 ] = NULL ; return 0 ; } } return - ENXIO ; }
character device support function VGDA reduce
character device support function VGDA reduce
/* Make PV pointer array contiguous */