diff --git a/client.c b/client.c index f5d3b75..625dc74 100644 --- a/client.c +++ b/client.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -9,7 +10,7 @@ int main() { - long long sz; + ssize_t sz; char buf[1]; char write_buf[] = "testing writing"; @@ -23,7 +24,7 @@ int main() for (int i = 0; i <= offset; i++) { sz = write(fd, write_buf, strlen(write_buf)); - printf("Writing to " FIB_DEV ", returned the sequence %lld\n", sz); + printf("Writing to " FIB_DEV ", returned the sequence %zd\n", sz); } for (int i = 0; i <= offset; i++) { @@ -31,7 +32,7 @@ int main() sz = read(fd, buf, 1); printf("Reading from " FIB_DEV " at offset %d, returned the sequence " - "%lld.\n", + "%zd.\n", i, sz); } @@ -40,7 +41,7 @@ int main() sz = read(fd, buf, 1); printf("Reading from " FIB_DEV " at offset %d, returned the sequence " - "%lld.\n", + "%zd.\n", i, sz); } diff --git a/fibdrv.c b/fibdrv.c index e6af9d9..d1c7a42 100644 --- a/fibdrv.c +++ b/fibdrv.c @@ -33,9 +33,9 @@ static int major = 0, minor = 0; * Return: The k-th Fibonacci number on success, -ENOMEM on memory allocation * failure. */ -static long long fib_sequence(long long k) +static uint64_t fib_sequence(uint64_t k) { - long long *f = kmalloc(sizeof(*f) * (k + 2), GFP_KERNEL); + uint64_t *f = kmalloc(sizeof(*f) * (k + 2), GFP_KERNEL); if (!f) return -ENOMEM; @@ -46,7 +46,7 @@ static long long fib_sequence(long long k) f[i] = f[i - 1] + f[i - 2]; } - long long ret = f[k]; + uint64_t ret = f[k]; kfree(f);