rem: mutex_unlock(&thedevfs->lock);
add: mutex_unlock(&gDeviceFileSystem->lock);
context: static int devfs_set_partition( struct devfs *fs, struct devfs_vnode *v, 	struct devfs_cookie *cookie, void *buf, size_t len){	struct devfs_part_map *part_map;	struct devfs_vnode *part_node;	int res;	char part_name[30];	devfs_partition_info info;		info = *(devfs_partition_info *)buf;		if( v->stream.type != STREAM_TYPE_DEVICE )		return EINVAL;			// we don't support nested partitions	if( v->stream.u.dev.part_map )		return EINVAL;		// reduce checks to a minimum - things like negative offsets could be useful	if( info.size < 0)		return EINVAL;					// create partition map	part_map = kmalloc( sizeof( *part_map ));	if( !part_map )		return ENOMEM;			part_map->offset = info.offset;	part_map->size = info.size;	part_map->logical_block_size = info.logical_block_size;	part_map->session = info.session;	part_map->partition = info.partition;			sprintf( part_name, "%i_%i", info.session, info.partition );	mutex_lock(&thedevfs->lock);		// you cannot change a partition once set	if( devfs_find_in_dir( v->parent, part_name )) {		res = EINVAL;		goto err1;	}		// increase reference count of raw device - 	// the partition device really needs it 	// (at least to resolve its name on GET_PARTITION_INFO)	res = vfs_get_vnode( fs->id, v->id, (fs_vnode *)&part_map->raw_vnode );	if( res < 0 )		goto err1;	// now create the partition node		part_node = devfs_create_vnode( fs, part_name );		if( part_node == NULL ) {		res = ENOMEM;		goto err2;	}	part_node->stream.type = STREAM_TYPE_DEVICE;	part_node->stream.u.dev.ident = v->stream.u.dev.ident;	part_node->stream.u.dev.calls = v->stream.u.dev.calls;	part_node->stream.u.dev.part_map = part_map;	hash_insert( fs->vnode_list_hash, part_node );	devfs_insert_in_dir( v->parent, part_node );	mutex_unlock(&thedevfs->lock);		dprintf( "SET_PARTITION: Added partition\n" );	return B_NO_ERROR;	err1:	mutex_unlock(&thedevfs->lock);	kfree( part_map );	return res;		err2:	mutex_unlock(&thedevfs->lock);	vfs_put_vnode( fs->id, v->id );	kfree( part_map );	return res;}