mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
fixed setvnnmap to use wire structures too
(This used to be ctdb commit 1208e4219d220b80e2f74974cac8ed2b8956d3ef)
This commit is contained in:
parent
682df74d59
commit
2a82665532
@ -990,9 +990,19 @@ int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
|
||||
int ret;
|
||||
TDB_DATA data, outdata;
|
||||
int32_t res;
|
||||
struct ctdb_vnn_map_wire *map;
|
||||
size_t len;
|
||||
|
||||
data.dsize = offsetof(struct ctdb_vnn_map, map) + 4*vnnmap->size;
|
||||
data.dptr = (unsigned char *)vnnmap;
|
||||
len = offsetof(struct ctdb_vnn_map_wire, map) + sizeof(uint32_t)*vnnmap->size;
|
||||
map = talloc_size(mem_ctx, len);
|
||||
CTDB_NO_MEMORY_VOID(ctdb, map);
|
||||
|
||||
map->generation = vnnmap->generation;
|
||||
map->size = vnnmap->size;
|
||||
memcpy(map->map, vnnmap->map, sizeof(uint32_t)*map->size);
|
||||
|
||||
data.dsize = len;
|
||||
data.dptr = (uint8_t *)map;
|
||||
|
||||
ret = ctdb_control(ctdb, destnode, 0,
|
||||
CTDB_CONTROL_SETVNNMAP, 0, data,
|
||||
@ -1002,6 +1012,8 @@ int ctdb_ctrl_setvnnmap(struct ctdb_context *ctdb, struct timeval timeout, uint3
|
||||
return -1;
|
||||
}
|
||||
|
||||
talloc_free(map);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -52,12 +52,19 @@ ctdb_control_getvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA inda
|
||||
int
|
||||
ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
|
||||
{
|
||||
if (ctdb->vnn_map) {
|
||||
talloc_free(ctdb->vnn_map);
|
||||
ctdb->vnn_map = NULL;
|
||||
}
|
||||
struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
|
||||
|
||||
ctdb->vnn_map = (struct ctdb_vnn_map *)talloc_memdup(ctdb, indata.dptr, indata.dsize);
|
||||
talloc_free(ctdb->vnn_map);
|
||||
|
||||
ctdb->vnn_map = talloc(ctdb, struct ctdb_vnn_map);
|
||||
CTDB_NO_MEMORY(ctdb, ctdb->vnn_map);
|
||||
|
||||
ctdb->vnn_map->generation = map->generation;
|
||||
ctdb->vnn_map->size = map->size;
|
||||
ctdb->vnn_map->map = talloc_array(ctdb->vnn_map, uint32_t, map->size);
|
||||
CTDB_NO_MEMORY(ctdb, ctdb->vnn_map->map);
|
||||
|
||||
memcpy(ctdb->vnn_map->map, map->map, sizeof(uint32_t)*map->size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user