コード例 #1
0
ファイル: dm.c プロジェクト: 3sOx/asuswrt-merlin
static int __bind(struct mapped_device *md, struct dm_table *t)
{
	request_queue_t *q = md->queue;
	sector_t size;

	size = dm_table_get_size(t);

	/*
	 * Wipe any geometry if the size of the table changed.
	 */
	if (size != get_capacity(md->disk))
		memset(&md->geometry, 0, sizeof(md->geometry));

	if (md->suspended_bdev)
		__set_size(md, size);
	if (size == 0)
		return 0;

	dm_table_get(t);
	dm_table_event_callback(t, event_callback, md);

	write_lock(&md->map_lock);
	md->map = t;
	dm_table_set_restrictions(t, q);
	write_unlock(&md->map_lock);

	return 0;
}
コード例 #2
0
ファイル: dm.c プロジェクト: wxlong/Test
static void __unbind(struct mapped_device *md)
{
	struct dm_table *map = md->map;

	if (!map)
		return;

	dm_table_event_callback(map, NULL, NULL);
	write_lock(&md->map_lock);
	md->map = NULL;
	write_unlock(&md->map_lock);
	dm_table_put(map);
}
コード例 #3
0
ファイル: dm.c プロジェクト: wxlong/Test
static int __bind(struct mapped_device *md, struct dm_table *t)
{
	request_queue_t *q = md->queue;
	sector_t size;

	size = dm_table_get_size(t);
	__set_size(md->disk, size);
	if (size == 0)
		return 0;

	write_lock(&md->map_lock);
	md->map = t;
	write_unlock(&md->map_lock);

	dm_table_get(t);
	dm_table_event_callback(md->map, event_callback, md);
	dm_table_set_restrictions(t, q);
	return 0;
}