kernels/linux-2.4.0/drivers/md/lvm.c
/*
 * character device support function logical volume status by index
 */
character device support function logical volume status by index
character device support function logical volume status by index
static int lvm_do_lv_status_byindex(vg_t *vg_ptr,void *arg)
{
	ulong size;
	lv_t lv;
	lv_t *lv_ptr;
	lv_status_byindex_req_t lv_status_byindex_req;
	if (vg_ptr == NULL) return -ENXIO;
	if (copy_from_user(&lv_status_byindex_req, arg,
			   sizeof(lv_status_byindex_req)) != 0)
		return -EFAULT;
	if ((lvp = lv_status_byindex_req.lv) == NULL)
		return -EINVAL;
	if ( ( lv_ptr = vg_ptr->lv[lv_status_byindex_req.lv_index]) == NULL)
		return -ENXIO;
	if (copy_from_user(&lv, lvp, sizeof(lv_t)) != 0)
		return -EFAULT;
	if (copy_to_user(lvp, lv_ptr, sizeof(lv_t)) != 0)
		return -EFAULT;
	if (lv.lv_current_pe != NULL) {
		size = lv_ptr->lv_allocated_le * sizeof(pe_t);
		if (copy_to_user(lv.lv_current_pe,
			 	 lv_ptr->lv_current_pe,
				 size) != 0)
			return -EFAULT;
	}
	return 0;
}
static int lvm_do_lv_status_byindex ( vg_t * vg_ptr , void * arg ) { ulong size ; lv_t lv ; lv_t * lv_ptr ; lv_status_byindex_req_t lv_status_byindex_req ; if ( vg_ptr == NULL ) return - ENXIO ; if ( copy_from_user ( & lv_status_byindex_req , arg , sizeof ( lv_status_byindex_req ) ) != 0 ) return - EFAULT ; if ( ( lvp = lv_status_byindex_req . lv ) == NULL ) return - EINVAL ; if ( ( lv_ptr = vg_ptr -> lv [ lv_status_byindex_req . lv_index ] ) == NULL ) return - ENXIO ; if ( copy_from_user ( & lv , lvp , sizeof ( lv_t ) ) != 0 ) return - EFAULT ; if ( copy_to_user ( lvp , lv_ptr , sizeof ( lv_t ) ) != 0 ) return - EFAULT ; if ( lv . lv_current_pe != NULL ) { size = lv_ptr -> lv_allocated_le * sizeof ( pe_t ) ; if ( copy_to_user ( lv . lv_current_pe , lv_ptr -> lv_current_pe , size ) != 0 ) return - EFAULT ; } return 0 ; }
character device support function logical volume status by index
character device support function logical volume status by index