]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
orangefs: turn param response value into union
authorMartin Brandenburg <martin@omnibond.com>
Tue, 2 Aug 2016 20:33:34 +0000 (16:33 -0400)
committerMartin Brandenburg <martin@omnibond.com>
Mon, 8 Aug 2016 19:12:28 +0000 (15:12 -0400)
This will support a upcoming request where two related values need to be
updated atomically.

This was done without a union in the OrangeFS server source already. Since
that will break the kernel protocol, it has been fixed there and done here
in a way that does not break the kernel protocol.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
fs/orangefs/downcall.h
fs/orangefs/orangefs-sysfs.c
fs/orangefs/upcall.h

index 66b99210f1f954c000d60ed1f75def010b2a95cf..db6e8722a89e64876d8eb21b2ac11f0f96040f63 100644 (file)
@@ -83,7 +83,10 @@ struct orangefs_listxattr_response {
 };
 
 struct orangefs_param_response {
-       __s64 value;
+       union {
+               __s64 value64;
+               __s32 value32[2];
+       } u;
 };
 
 #define PERF_COUNT_BUF_SIZE 4096
index 375708c2db87c728eacde70d6a0aba1458610e32..044ca6506775cd92546127ee3fd3a18f9999a71f 100644 (file)
@@ -949,10 +949,8 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
 out:
        if (!rc) {
                if (strcmp(kobj_id, PC_KOBJ_ID)) {
-                       rc = scnprintf(buf,
-                                      PAGE_SIZE,
-                                      "%d\n",
-                                      (int)new_op->downcall.resp.param.value);
+                       rc = scnprintf(buf, PAGE_SIZE, "%d\n",
+                           (int)new_op->downcall.resp.param.u.value64);
                } else {
                        rc = scnprintf(
                                buf,
@@ -1277,7 +1275,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
 
        new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
 
-       new_op->upcall.req.param.value = val;
+       new_op->upcall.req.param.u.value64 = val;
 
        /*
         * The service_operation will return a errno return code on
index 03a4360dcd385f1757c60cda7c69cd05a2945f38..7c29fdf08ec51ef7771e4a6f36908c20cf9437cc 100644 (file)
@@ -187,7 +187,10 @@ enum orangefs_param_request_op {
 struct orangefs_param_request_s {
        enum orangefs_param_request_type type;
        enum orangefs_param_request_op op;
-       __s64 value;
+       union {
+               __s64 value64;
+               __s32 value32[2];
+       } u;
        char s_value[ORANGEFS_MAX_DEBUG_STRING_LEN];
 };