1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Use size_t return type

Since these function returns buffer size - use size_t type for them.
This commit is contained in:
Zdenek Kabelac 2011-09-01 10:25:22 +00:00
parent 2d70959c86
commit 3caa77f831
5 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
Use size_t return type for text_vg_export_raw() and export_vg_to_buffer().
Add configure --enable-lvmetad for building the (experimental) LVMetaD.
Fix resource leak when strdup fails in _get_device_status() (2.02.85).
Directly allocate buffer memory in a pvck scan instead of using a mempool.

View File

@ -102,7 +102,7 @@ static void _store_metadata(struct volume_group *vg, unsigned precommitted)
char uuid[64] __attribute__((aligned(8)));
struct lvmcache_vginfo *vginfo;
char *data;
int size;
size_t size;
if (!(vginfo = vginfo_from_vgid((const char *)&vg->id))) {
stack;
@ -132,7 +132,7 @@ static void _store_metadata(struct volume_group *vg, unsigned precommitted)
return;
}
log_debug("Metadata cache: VG %s (%s) stored (%d bytes%s).",
log_debug("Metadata cache: VG %s (%s) stored (%" PRIsize_t " bytes%s).",
vginfo->vgname, uuid, size,
precommitted ? ", precommitted" : "");
}

View File

@ -775,10 +775,10 @@ int text_vg_export_file(struct volume_group *vg, const char *desc, FILE *fp)
}
/* Returns amount of buffer used incl. terminating NUL */
int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
{
struct formatter *f;
int r = 0;
size_t r = 0;
_init();
@ -809,7 +809,7 @@ int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
return r;
}
int export_vg_to_buffer(struct volume_group *vg, char **buf)
size_t export_vg_to_buffer(struct volume_group *vg, char **buf)
{
return text_vg_export_raw(vg, "", buf);
}

View File

@ -65,7 +65,7 @@ char *alloc_printed_tags(struct dm_list *tags);
int read_tags(struct dm_pool *mem, struct dm_list *tags, const struct dm_config_value *cv);
int text_vg_export_file(struct volume_group *vg, const char *desc, FILE *fp);
int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf);
size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf);
struct volume_group *text_vg_import_file(struct format_instance *fid,
const char *file,
time_t *when, char **desc);

View File

@ -454,7 +454,7 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
/*
* For internal metadata caching.
*/
int export_vg_to_buffer(struct volume_group *vg, char **buf);
size_t export_vg_to_buffer(struct volume_group *vg, char **buf);
int export_vg_to_config_tree(struct volume_group *vg, struct dm_config_tree **cft);
struct volume_group *import_vg_from_buffer(const char *buf,
struct format_instance *fid);