@@ -216,7 +216,7 @@ struct timeval {
216216 long tv_usec ; /* microseconds */
217217};
218218
219- unsigned long timeval_to_jiffies (const struct timeval * tv )
219+ static inline unsigned long timeval_to_jiffies (const struct timeval * tv )
220220{
221221 return timespec64_to_jiffies (& (struct timespec64 ){
222222 tv -> tv_sec ,
@@ -225,6 +225,20 @@ unsigned long timeval_to_jiffies(const struct timeval *tv)
225225}
226226#endif
227227
228+ #ifndef HAVE_STRLCPY
229+ static inline size_t strlcpy (char * dest , const char * src , size_t size )
230+ {
231+ size_t ret = strlen (src );
232+
233+ if (size ) {
234+ size_t len = (ret >= size ) ? size - 1 : ret ;
235+ __builtin_memcpy (dest , src , len );
236+ dest [len ] = '\0' ;
237+ }
238+ return ret ;
239+ }
240+ #endif
241+
228242#if LINUX_VERSION_CODE < KERNEL_VERSION (2 ,6 ,35 )
229243# ifdef ktime_to_timeval
230244/* ktime_to_timeval is defined on 64bit and inline on 32bit cpu */
@@ -380,10 +394,10 @@ static int sockaddr_cmp(const struct sockaddr_storage *sa1, const struct sockadd
380394 return 0 ;
381395}
382396
383- #ifndef IN6PTON_XDIGIT
397+ #ifndef HAVE_IN6_PTON
384398#define hex_to_bin compat_hex_to_bin
385399/* lib/hexdump.c */
386- int hex_to_bin (char ch )
400+ static inline int hex_to_bin (char ch )
387401{
388402 if ((ch >= '0' ) && (ch <= '9' ))
389403 return ch - '0' ;
@@ -593,7 +607,7 @@ int in6_pton(const char *src, int srclen,
593607 * end = s ;
594608 return ret ;
595609}
596- #endif /* IN6PTON_XDIGIT */
610+ #endif /* HAVE_IN6_PTON */
597611
598612#if LINUX_VERSION_CODE >= KERNEL_VERSION (4 ,2 ,0 )
599613# define sock_create_kern (f , t , p , s ) sock_create_kern(&init_net, f, t, p, s)
@@ -712,40 +726,6 @@ static inline void do_gettimeofday(struct timeval *tv)
712726}
713727#endif
714728
715- #define TOLOWER (x ) ((x) | 0x20)
716- unsigned long long strtoul (const char * cp , char * * endp , unsigned int base )
717- {
718- unsigned long long result = 0 ;
719-
720- if (!base ) {
721- if (cp [0 ] == '0' ) {
722- if (TOLOWER (cp [1 ]) == 'x' && isxdigit (cp [2 ]))
723- base = 16 ;
724- else
725- base = 8 ;
726- } else {
727- base = 10 ;
728- }
729- }
730-
731- if (base == 16 && cp [0 ] == '0' && TOLOWER (cp [1 ]) == 'x' )
732- cp += 2 ;
733-
734- while (isxdigit (* cp )) {
735- unsigned int value ;
736-
737- value = isdigit (* cp ) ? * cp - '0' : TOLOWER (* cp ) - 'a' + 10 ;
738- if (value >= base )
739- break ;
740- result = result * base + value ;
741- cp ++ ;
742- }
743- if (endp )
744- * endp = (char * )cp ;
745-
746- return result ;
747- }
748-
749729#if LINUX_VERSION_CODE >= KERNEL_VERSION (5 ,12 ,0 )
750730/*
751731 * find_module() is unexported in v5.12:
0 commit comments