mirror of
https://github.com/openharmony/third_party_liburing.git
synced 2026-07-19 18:54:12 -04:00
liburing: Clean up -Wshorten-64-to-32 warnings from clang
liburing has a couple of int shortening issues found by clang. Clean them all. This cleanup is particularly useful for build systems that include these files and run with that error enabled. Link: https://lore.kernel.org/io-uring/20221019145042.446477-1-dylany@meta.com Signed-off-by: Dylan Yudaken <dylany@fb.com> Co-authored-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221020131118.13828-2-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
51884ab934
commit
179623d73f
@@ -11,9 +11,9 @@ static inline int __sys_open(const char *pathname, int flags, mode_t mode)
|
||||
* Some architectures don't have __NR_open, but __NR_openat.
|
||||
*/
|
||||
#ifdef __NR_open
|
||||
return __do_syscall3(__NR_open, pathname, flags, mode);
|
||||
return (int) __do_syscall3(__NR_open, pathname, flags, mode);
|
||||
#else
|
||||
return __do_syscall4(__NR_openat, AT_FDCWD, pathname, flags, mode);
|
||||
return (int) __do_syscall4(__NR_openat, AT_FDCWD, pathname, flags, mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -277,8 +277,11 @@ int io_uring_enable_rings(struct io_uring *ring)
|
||||
int io_uring_register_iowq_aff(struct io_uring *ring, size_t cpusz,
|
||||
const cpu_set_t *mask)
|
||||
{
|
||||
if (cpusz >= (1U << 31))
|
||||
return -EINVAL;
|
||||
|
||||
return __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_IOWQ_AFF,
|
||||
mask, cpusz);
|
||||
mask, (int) cpusz);
|
||||
}
|
||||
|
||||
int io_uring_unregister_iowq_aff(struct io_uring *ring)
|
||||
|
||||
+6
-6
@@ -248,29 +248,29 @@ __cold void io_uring_free_probe(struct io_uring_probe *probe)
|
||||
uring_free(probe);
|
||||
}
|
||||
|
||||
static inline int __fls(int x)
|
||||
static inline int __fls(unsigned long x)
|
||||
{
|
||||
if (!x)
|
||||
return 0;
|
||||
return 8 * sizeof(x) - __builtin_clz(x);
|
||||
return 8 * sizeof(x) - __builtin_clzl(x);
|
||||
}
|
||||
|
||||
static unsigned roundup_pow2(unsigned depth)
|
||||
{
|
||||
return 1UL << __fls(depth - 1);
|
||||
return 1U << __fls(depth - 1);
|
||||
}
|
||||
|
||||
static size_t npages(size_t size, unsigned page_size)
|
||||
static size_t npages(size_t size, long page_size)
|
||||
{
|
||||
size--;
|
||||
size /= page_size;
|
||||
return __fls(size);
|
||||
return __fls((int) size);
|
||||
}
|
||||
|
||||
#define KRING_SIZE 320
|
||||
|
||||
static size_t rings_size(struct io_uring_params *p, unsigned entries,
|
||||
unsigned cq_entries, unsigned page_size)
|
||||
unsigned cq_entries, long page_size)
|
||||
{
|
||||
size_t pages, sq_size, cq_size;
|
||||
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ static inline void *ERR_PTR(intptr_t n)
|
||||
return (void *) n;
|
||||
}
|
||||
|
||||
static inline intptr_t PTR_ERR(const void *ptr)
|
||||
static inline int PTR_ERR(const void *ptr)
|
||||
{
|
||||
return (intptr_t) ptr;
|
||||
return (int) (intptr_t) ptr;
|
||||
}
|
||||
|
||||
static inline bool IS_ERR(const void *ptr)
|
||||
|
||||
Reference in New Issue
Block a user