kernels/linux-2.4.0/drivers/md/lvm.c
/*
 * character device support function physical volume change
 */
character device support function physical volume change
character device support function physical volume change
static int lvm_do_pv_change(vg_t *vg_ptr, void *arg)
{
	uint p;
	pv_t *pv_ptr;
#ifdef LVM_GET_INODE
	struct inode *inode_sav;
#endif
	if (vg_ptr == NULL) return -ENXIO;
	if (copy_from_user(&pv_change_req, arg,
			   sizeof(pv_change_req)) != 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_change_req.pv_name) == 0) {
#ifdef LVM_GET_INODE
			inode_sav = pv_ptr->inode;
#endif
			if (copy_from_user(pv_ptr,
					   pv_change_req.pv,
					   sizeof(pv_t)) != 0)
				return -EFAULT;
			pv_ptr->pe = NULL;
#ifdef LVM_GET_INODE
			pv_ptr->inode = inode_sav;
#endif
			return 0;
		}
	}
	return -ENXIO;
}
static int lvm_do_pv_change ( vg_t * vg_ptr , void * arg ) { uint p ; pv_t * pv_ptr ; #ifdef LVM_GET_INODE struct inode * inode_sav ; #endif if ( vg_ptr == NULL ) return - ENXIO ; if ( copy_from_user ( & pv_change_req , arg , sizeof ( pv_change_req ) ) != 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_change_req . pv_name ) == 0 ) { #ifdef LVM_GET_INODE inode_sav = pv_ptr -> inode ; #endif if ( copy_from_user ( pv_ptr , pv_change_req . pv , sizeof ( pv_t ) ) != 0 ) return - EFAULT ; pv_ptr -> pe = NULL ; #ifdef LVM_GET_INODE pv_ptr -> inode = inode_sav ; #endif return 0 ; } } return - ENXIO ; }
character device support function physical volume change
character device support function physical volume change
/* We don't need the PE list
			   in kernel space as with LVs pe_t list */