kernels/linux-2.4.0/drivers/md/lvm.c
/*
 * character device support function rename a logical volume
 */
character device support function rename a logical volume
character device support function rename a logical volume
static int lvm_do_lv_rename(vg_t *vg_ptr, lv_req_t *lv_req, lv_t *lv)
{
	int l = 0;
	int ret = 0;
	lv_t *lv_ptr = NULL;
	for (l = 0; l < vg_ptr->lv_max; l++)
	{
		if ( (lv_ptr = vg_ptr->lv[l]) == NULL) continue;
		if (lv_ptr->lv_dev == lv->lv_dev)
		{
#if defined CONFIG_LVM_PROC_FS && defined CONFIG_PROC_FS
			lvm_do_remove_proc_entry_of_lv ( vg_ptr, lv_ptr);
#endif
			strncpy(lv_ptr->lv_name,
				lv_req->lv_name,
				NAME_LEN);
#if defined CONFIG_LVM_PROC_FS && defined CONFIG_PROC_FS
			lvm_do_create_proc_entry_of_lv ( vg_ptr, lv_ptr);
#endif
			break;
		}
	}
	if (l == vg_ptr->lv_max) ret = -ENODEV;
	return ret;
}
static int lvm_do_lv_rename ( vg_t * vg_ptr , lv_req_t * lv_req , lv_t * lv ) { int l = 0 ; int ret = 0 ; lv_t * lv_ptr = NULL ; for ( l = 0 ; l < vg_ptr -> lv_max ; l ++ ) { if ( ( lv_ptr = vg_ptr -> lv [ l ] ) == NULL ) continue ; if ( lv_ptr -> lv_dev == lv -> lv_dev ) { #if defined CONFIG_LVM_PROC_FS && defined CONFIG_PROC_FS lvm_do_remove_proc_entry_of_lv ( vg_ptr , lv_ptr ) ; #endif strncpy ( lv_ptr -> lv_name , lv_req -> lv_name , NAME_LEN ) ; #if defined CONFIG_LVM_PROC_FS && defined CONFIG_PROC_FS lvm_do_create_proc_entry_of_lv ( vg_ptr , lv_ptr ) ; #endif break ; } } if ( l == vg_ptr -> lv_max ) ret = - ENODEV ; return ret ; }
character device support function rename a logical volume
character device support function rename a logical volume