Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t
It is really size_t.  Everything else uses uint64_t, so move this to
uint64_t as well.  A size can't be negative anyways.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20230508130909.65420-5-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed May 15, 2023
1 parent 9d3ebbe commit bffc044
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions migration/qemu-file.c
Expand Up @@ -44,7 +44,7 @@ struct QEMUFile {
* Maximum amount of data in bytes to transfer during one
* rate limiting time window
*/
int64_t rate_limit_max;
uint64_t rate_limit_max;
/*
* Total amount of data in bytes queued for transfer
* during this rate limiting time window
Expand Down Expand Up @@ -738,12 +738,12 @@ int qemu_file_rate_limit(QEMUFile *f)
return 0;
}

int64_t qemu_file_get_rate_limit(QEMUFile *f)
uint64_t qemu_file_get_rate_limit(QEMUFile *f)
{
return f->rate_limit_max;
}

void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit)
void qemu_file_set_rate_limit(QEMUFile *f, uint64_t limit)
{
/*
* 'limit' is per second. But we check it each 100 miliseconds.
Expand Down
4 changes: 2 additions & 2 deletions migration/qemu-file.h
Expand Up @@ -139,8 +139,8 @@ void qemu_file_reset_rate_limit(QEMUFile *f);
* need to be applied to the rate limiting calcuations
*/
void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len);
void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
int64_t qemu_file_get_rate_limit(QEMUFile *f);
void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate);
uint64_t qemu_file_get_rate_limit(QEMUFile *f);
int qemu_file_get_error_obj(QEMUFile *f, Error **errp);
int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp);
void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err);
Expand Down

0 comments on commit bffc044

Please sign in to comment.