kernels/linux-2.4.0/drivers/md/lvm.c
/*
 * character device support function logical extend remap
 */
character device support function logical extend remap
character device support function logical extend remap
static int lvm_do_le_remap(vg_t *vg_ptr, void *arg)
{
	uint l, le;
	lv_t *lv_ptr;
	if (vg_ptr == NULL) return -ENXIO;
	if (copy_from_user(&le_remap_req, arg,
			   sizeof(le_remap_req_t)) != 0)
		return -EFAULT;
	for (l = 0; l < vg_ptr->lv_max; l++) {
		lv_ptr = vg_ptr->lv[l];
		if (lv_ptr != NULL &&
		    strcmp(lv_ptr->lv_name,
			       le_remap_req.lv_name) == 0) {
			for (le = 0; le < lv_ptr->lv_allocated_le; le++) {
				if (lv_ptr->lv_current_pe[le].dev ==
				    le_remap_req.old_dev &&
				    lv_ptr->lv_current_pe[le].pe ==
				    le_remap_req.old_pe) {
					lv_ptr->lv_current_pe[le].dev =
					    le_remap_req.new_dev;
					lv_ptr->lv_current_pe[le].pe =
					    le_remap_req.new_pe;
					return 0;
				}
			}
			return -EINVAL;
		}
	}
	return -ENXIO;
}
static int lvm_do_le_remap ( vg_t * vg_ptr , void * arg ) { uint l , le ; lv_t * lv_ptr ; if ( vg_ptr == NULL ) return - ENXIO ; if ( copy_from_user ( & le_remap_req , arg , sizeof ( le_remap_req_t ) ) != 0 ) return - EFAULT ; for ( l = 0 ; l < vg_ptr -> lv_max ; l ++ ) { lv_ptr = vg_ptr -> lv [ l ] ; if ( lv_ptr != NULL && strcmp ( lv_ptr -> lv_name , le_remap_req . lv_name ) == 0 ) { for ( le = 0 ; le < lv_ptr -> lv_allocated_le ; le ++ ) { if ( lv_ptr -> lv_current_pe [ le ] . dev == le_remap_req . old_dev && lv_ptr -> lv_current_pe [ le ] . pe == le_remap_req . old_pe ) { lv_ptr -> lv_current_pe [ le ] . dev = le_remap_req . new_dev ; lv_ptr -> lv_current_pe [ le ] . pe = le_remap_req . new_pe ; return 0 ; } } return - EINVAL ; } } return - ENXIO ; }
character device support function logical extend remap
character device support function logical extend remap