Code

zfs_arc: pass reference in llist instead of value
authorMarc Fournier <marc.fournier@camptocamp.com>
Mon, 28 Jul 2014 13:04:24 +0000 (15:04 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Mon, 28 Jul 2014 13:04:24 +0000 (15:04 +0200)
This avoids using a void pointer, which size depends on the
architecture.

Thanks to @dothebart for pointing this out!

src/zfs_arc.c

index e32e829d5a10b5a6d4a6577dc6bcda7de5323f88..168d566bb47ff406f0deb183c5c9d7550211e969 100644 (file)
@@ -53,7 +53,7 @@ static long long get_zfs_value(kstat_t *zfs_stats  __attribute__((unused)),
                return (-1);
        }
 
-       return ((long long int)e->value);
+       return (*(long long int*)e->value);
 }
 
 #elif !defined(__FreeBSD__) // Solaris
@@ -222,7 +222,7 @@ static int za_read (void)
                                {
                                        llvalues[i] = atoll (fields[2]);
 
-                                       e = llentry_create (fields[0], (void *)llvalues[i]);
+                                       e = llentry_create (fields[0], &llvalues[i]);
                                        if (e == NULL)
                                        {
                                                ERROR ("zfs_arc plugin: `llentry_create' failed.");