ublk-org / ublksrv

ublk: userspace block device driver
MIT License
147 stars 50 forks source link

tgt_loop: add missing header <climits> #7

Closed old-memories closed 2 years ago

old-memories commented 2 years ago

Compiler error occurs since UINT_MAX is not declared in tgt_loop.c on gcc 10.2.1. Expliclitly including header solves the problem.

g++ -c -g -O2 -D_GNU_SOURCE -MMD -I include -fcoroutines -std=c++20 tgt_loop.c -o tgt_loop.o tgt_loop.c: In function ‘int loop_init_tgt(ublksrv_dev, int, int, char)’: tgt_loop.c:64:27: error: ‘UINT_MAX’ was not declared in this scope 64 | .max_discard_sectors = UINT_MAX >> 9, | ^~~~ tgt_loop.c:4:1: note: ‘UINT_MAX’ is defined in header ‘’; did you forget to ‘#include ’? 3 | #include "ublksrv_tgt.h" +++ |+#include 4 | make: [Makefile:20: tgt_loop.o] Error 1

Signed-off-by: ZiyangZhang ZiyangZhang@linux.alibaba.com