The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6346

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #6345

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From cc2aa806307cb700606d0786208d60ccea7cfd3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 23 Oct 2019 14:11:27 -0400
Subject: [PATCH] lxd/storage/quota: Fix bad typing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6345

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/storage/quota/projectquota.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lxd/storage/quota/projectquota.go 
b/lxd/storage/quota/projectquota.go
index f96032009d..c1b6b1ad1b 100644
--- a/lxd/storage/quota/projectquota.go
+++ b/lxd/storage/quota/projectquota.go
@@ -74,7 +74,7 @@ int quota_supported(char *dev_path) {
        return quotactl(QCMD(Q_GETINFO, PRJQUOTA), dev_path, 0, 
(caddr_t)&dqinfo);
 }
 
-int quota_get_usage(char *dev_path, uint32_t id) {
+int64_t quota_get_usage(char *dev_path, uint32_t id) {
        struct if_dqblk quota;
 
        if (quotactl(QCMD(Q_GETQUOTA, PRJQUOTA), dev_path, id, (caddr_t)&quota) 
< 0) {
@@ -85,7 +85,7 @@ int quota_get_usage(char *dev_path, uint32_t id) {
 }
 
 
-int quota_set(char *dev_path, uint32_t id, int hard_bytes) {
+int quota_set(char *dev_path, uint32_t id, uint64_t hard_bytes) {
        struct if_dqblk quota;
        fs_disk_quota_t xfsquota;
 
@@ -266,7 +266,7 @@ func GetProjectUsage(path string, id uint32) (int64, error) 
{
 
        size := C.quota_get_usage(cDevPath, C.uint32_t(id))
        if size < 0 {
-               return -1, fmt.Errorf("Failed to get project consumption for id 
'%d' on '%s'", id, path)
+               return -1, fmt.Errorf("Failed to get project consumption for id 
'%d' on '%s'", id, devPath)
        }
 
        return int64(size), nil
@@ -284,8 +284,8 @@ func SetProjectQuota(path string, id uint32, bytes int64) 
error {
        cDevPath := C.CString(devPath)
        defer C.free(unsafe.Pointer(cDevPath))
 
-       if C.quota_set(cDevPath, C.uint32_t(id), C.int(bytes/1024)) != 0 {
-               return fmt.Errorf("Failed to set project quota for id '%d' on 
'%s'", id, path)
+       if C.quota_set(cDevPath, C.uint32_t(id), C.uint64_t(bytes/1024)) != 0 {
+               return fmt.Errorf("Failed to set project quota for id '%d' on 
'%s'", id, devPath)
        }
 
        return nil
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to