[PATCH] md: add write-intent-bitmap support to raid5
[linux-2.6/verdex.git] / include / asm-m32r / uaccess.h
blob93d863c455a19ff302af1e231a578616bc1d9270
1 #ifndef _ASM_M32R_UACCESS_H
2 #define _ASM_M32R_UACCESS_H
4 /*
5 * linux/include/asm-m32r/uaccess.h
7 * M32R version.
8 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
9 */
11 #undef UACCESS_DEBUG
13 #ifdef UACCESS_DEBUG
14 #define UAPRINTK(args...) printk(args)
15 #else
16 #define UAPRINTK(args...)
17 #endif /* UACCESS_DEBUG */
20 * User space memory access functions
22 #include <linux/config.h>
23 #include <linux/errno.h>
24 #include <linux/thread_info.h>
25 #include <asm/page.h>
27 #define VERIFY_READ 0
28 #define VERIFY_WRITE 1
31 * The fs value determines whether argument validity checking should be
32 * performed or not. If get_fs() == USER_DS, checking is performed, with
33 * get_fs() == KERNEL_DS, checking is bypassed.
35 * For historical reasons, these macros are grossly misnamed.
38 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
40 #ifdef CONFIG_MMU
41 #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
42 #define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
43 #else
44 #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
45 #define USER_DS MAKE_MM_SEG(0xFFFFFFFF)
46 #endif /* CONFIG_MMU */
48 #define get_ds() (KERNEL_DS)
49 #ifdef CONFIG_MMU
50 #define get_fs() (current_thread_info()->addr_limit)
51 #define set_fs(x) (current_thread_info()->addr_limit = (x))
52 #else
53 static inline mm_segment_t get_fs(void)
55 return USER_DS;
58 static inline void set_fs(mm_segment_t s)
61 #endif /* CONFIG_MMU */
63 #define segment_eq(a,b) ((a).seg == (b).seg)
65 #define __addr_ok(addr) \
66 ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
69 * Test whether a block of memory is a valid user space address.
70 * Returns 0 if the range is valid, nonzero otherwise.
72 * This is equivalent to the following test:
73 * (u33)addr + (u33)size >= (u33)current->addr_limit.seg
75 * This needs 33-bit arithmetic. We have a carry...
77 #define __range_ok(addr,size) ({ \
78 unsigned long flag, sum; \
79 __chk_user_ptr(addr); \
80 asm ( \
81 " cmpu %1, %1 ; clear cbit\n" \
82 " addx %1, %3 ; set cbit if overflow\n" \
83 " subx %0, %0\n" \
84 " cmpu %4, %1\n" \
85 " subx %0, %5\n" \
86 : "=&r"(flag), "=r"(sum) \
87 : "1"(addr), "r"((int)(size)), \
88 "r"(current_thread_info()->addr_limit.seg), "r"(0) \
89 : "cbit" ); \
90 flag; })
92 /**
93 * access_ok: - Checks if a user space pointer is valid
94 * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that
95 * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
96 * to write to a block, it is always safe to read from it.
97 * @addr: User space pointer to start of block to check
98 * @size: Size of block to check
100 * Context: User context only. This function may sleep.
102 * Checks if a pointer to a block of memory in user space is valid.
104 * Returns true (nonzero) if the memory block may be valid, false (zero)
105 * if it is definitely invalid.
107 * Note that, depending on architecture, this function probably just
108 * checks that the pointer is in the user space range - after calling
109 * this function, memory access functions may still return -EFAULT.
111 #ifdef CONFIG_MMU
112 #define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0))
113 #else
114 static inline int access_ok(int type, const void *addr, unsigned long size)
116 extern unsigned long memory_start, memory_end;
117 unsigned long val = (unsigned long)addr;
119 return ((val >= memory_start) && ((val + size) < memory_end));
121 #endif /* CONFIG_MMU */
124 * The exception table consists of pairs of addresses: the first is the
125 * address of an instruction that is allowed to fault, and the second is
126 * the address at which the program should continue. No registers are
127 * modified, so it is entirely up to the continuation code to figure out
128 * what to do.
130 * All the routines below use bits of fixup code that are out of line
131 * with the main instruction path. This means when everything is well,
132 * we don't even have to jump over them. Further, they do not intrude
133 * on our cache or tlb entries.
136 struct exception_table_entry
138 unsigned long insn, fixup;
141 extern int fixup_exception(struct pt_regs *regs);
144 * These are the main single-value transfer routines. They automatically
145 * use the right size if we just have the right pointer type.
147 * This gets kind of ugly. We want to return _two_ values in "get_user()"
148 * and yet we don't want to do any pointers, because that is too much
149 * of a performance impact. Thus we have a few rather ugly macros here,
150 * and hide all the uglyness from the user.
152 * The "__xxx" versions of the user access functions are versions that
153 * do not verify the address space, that must have been done previously
154 * with a separate "access_ok()" call (this is used when we do multiple
155 * accesses to the same area of user memory).
158 extern void __get_user_1(void);
159 extern void __get_user_2(void);
160 extern void __get_user_4(void);
162 #ifndef MODULE
163 #define __get_user_x(size,ret,x,ptr) \
164 __asm__ __volatile__( \
165 " mv r0, %0\n" \
166 " mv r1, %1\n" \
167 " bl __get_user_" #size "\n" \
168 " mv %0, r0\n" \
169 " mv %1, r1\n" \
170 : "=r"(ret), "=r"(x) \
171 : "0"(ptr) \
172 : "r0", "r1", "r14" )
173 #else /* MODULE */
175 * Use "jl" instead of "bl" for MODULE
177 #define __get_user_x(size,ret,x,ptr) \
178 __asm__ __volatile__( \
179 " mv r0, %0\n" \
180 " mv r1, %1\n" \
181 " seth lr, #high(__get_user_" #size ")\n" \
182 " or3 lr, lr, #low(__get_user_" #size ")\n" \
183 " jl lr\n" \
184 " mv %0, r0\n" \
185 " mv %1, r1\n" \
186 : "=r"(ret), "=r"(x) \
187 : "0"(ptr) \
188 : "r0", "r1", "r14" )
189 #endif
191 /* Careful: we have to cast the result to the type of the pointer for sign
192 reasons */
194 * get_user: - Get a simple variable from user space.
195 * @x: Variable to store result.
196 * @ptr: Source address, in user space.
198 * Context: User context only. This function may sleep.
200 * This macro copies a single simple variable from user space to kernel
201 * space. It supports simple types like char and int, but not larger
202 * data types like structures or arrays.
204 * @ptr must have pointer-to-simple-variable type, and the result of
205 * dereferencing @ptr must be assignable to @x without a cast.
207 * Returns zero on success, or -EFAULT on error.
208 * On error, the variable @x is set to zero.
210 #define get_user(x,ptr) \
211 ({ int __ret_gu,__val_gu; \
212 __chk_user_ptr(ptr); \
213 switch(sizeof (*(ptr))) { \
214 case 1: __get_user_x(1,__ret_gu,__val_gu,ptr); break; \
215 case 2: __get_user_x(2,__ret_gu,__val_gu,ptr); break; \
216 case 4: __get_user_x(4,__ret_gu,__val_gu,ptr); break; \
217 default: __get_user_x(X,__ret_gu,__val_gu,ptr); break; \
219 (x) = (__typeof__(*(ptr)))__val_gu; \
220 __ret_gu; \
223 extern void __put_user_bad(void);
226 * put_user: - Write a simple value into user space.
227 * @x: Value to copy to user space.
228 * @ptr: Destination address, in user space.
230 * Context: User context only. This function may sleep.
232 * This macro copies a single simple value from kernel space to user
233 * space. It supports simple types like char and int, but not larger
234 * data types like structures or arrays.
236 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
237 * to the result of dereferencing @ptr.
239 * Returns zero on success, or -EFAULT on error.
241 #define put_user(x,ptr) \
242 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
246 * __get_user: - Get a simple variable from user space, with less checking.
247 * @x: Variable to store result.
248 * @ptr: Source address, in user space.
250 * Context: User context only. This function may sleep.
252 * This macro copies a single simple variable from user space to kernel
253 * space. It supports simple types like char and int, but not larger
254 * data types like structures or arrays.
256 * @ptr must have pointer-to-simple-variable type, and the result of
257 * dereferencing @ptr must be assignable to @x without a cast.
259 * Caller must check the pointer with access_ok() before calling this
260 * function.
262 * Returns zero on success, or -EFAULT on error.
263 * On error, the variable @x is set to zero.
265 #define __get_user(x,ptr) \
266 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
270 * __put_user: - Write a simple value into user space, with less checking.
271 * @x: Value to copy to user space.
272 * @ptr: Destination address, in user space.
274 * Context: User context only. This function may sleep.
276 * This macro copies a single simple value from kernel space to user
277 * space. It supports simple types like char and int, but not larger
278 * data types like structures or arrays.
280 * @ptr must have pointer-to-simple-variable type, and @x must be assignable
281 * to the result of dereferencing @ptr.
283 * Caller must check the pointer with access_ok() before calling this
284 * function.
286 * Returns zero on success, or -EFAULT on error.
288 #define __put_user(x,ptr) \
289 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
291 #define __put_user_nocheck(x,ptr,size) \
292 ({ \
293 long __pu_err; \
294 __put_user_size((x),(ptr),(size),__pu_err); \
295 __pu_err; \
299 #define __put_user_check(x,ptr,size) \
300 ({ \
301 long __pu_err = -EFAULT; \
302 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
303 might_sleep(); \
304 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
305 __put_user_size((x),__pu_addr,(size),__pu_err); \
306 __pu_err; \
309 #if defined(__LITTLE_ENDIAN__)
310 #define __put_user_u64(x, addr, err) \
311 __asm__ __volatile__( \
312 " .fillinsn\n" \
313 "1: st %L1,@%2\n" \
314 " .fillinsn\n" \
315 "2: st %H1,@(4,%2)\n" \
316 " .fillinsn\n" \
317 "3:\n" \
318 ".section .fixup,\"ax\"\n" \
319 " .balign 4\n" \
320 "4: ldi %0,%3\n" \
321 " seth r14,#high(3b)\n" \
322 " or3 r14,r14,#low(3b)\n" \
323 " jmp r14\n" \
324 ".previous\n" \
325 ".section __ex_table,\"a\"\n" \
326 " .balign 4\n" \
327 " .long 1b,4b\n" \
328 " .long 2b,4b\n" \
329 ".previous" \
330 : "=r"(err) \
331 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
332 : "r14", "memory")
334 #elif defined(__BIG_ENDIAN__)
335 #define __put_user_u64(x, addr, err) \
336 __asm__ __volatile__( \
337 " .fillinsn\n" \
338 "1: st %H1,@%2\n" \
339 " .fillinsn\n" \
340 "2: st %L1,@(4,%2)\n" \
341 " .fillinsn\n" \
342 "3:\n" \
343 ".section .fixup,\"ax\"\n" \
344 " .balign 4\n" \
345 "4: ldi %0,%3\n" \
346 " seth r14,#high(3b)\n" \
347 " or3 r14,r14,#low(3b)\n" \
348 " jmp r14\n" \
349 ".previous\n" \
350 ".section __ex_table,\"a\"\n" \
351 " .balign 4\n" \
352 " .long 1b,4b\n" \
353 " .long 2b,4b\n" \
354 ".previous" \
355 : "=r"(err) \
356 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
357 : "r14", "memory")
358 #else
359 #error no endian defined
360 #endif
362 #define __put_user_size(x,ptr,size,retval) \
363 do { \
364 retval = 0; \
365 __chk_user_ptr(ptr); \
366 switch (size) { \
367 case 1: __put_user_asm(x,ptr,retval,"b"); break; \
368 case 2: __put_user_asm(x,ptr,retval,"h"); break; \
369 case 4: __put_user_asm(x,ptr,retval,""); break; \
370 case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\
371 default: __put_user_bad(); \
373 } while (0)
375 struct __large_struct { unsigned long buf[100]; };
376 #define __m(x) (*(struct __large_struct *)(x))
379 * Tell gcc we read from memory instead of writing: this is because
380 * we do not write to any memory gcc knows about, so there are no
381 * aliasing issues.
383 #define __put_user_asm(x, addr, err, itype) \
384 __asm__ __volatile__( \
385 " .fillinsn\n" \
386 "1: st"itype" %1,@%2\n" \
387 " .fillinsn\n" \
388 "2:\n" \
389 ".section .fixup,\"ax\"\n" \
390 " .balign 4\n" \
391 "3: ldi %0,%3\n" \
392 " seth r14,#high(2b)\n" \
393 " or3 r14,r14,#low(2b)\n" \
394 " jmp r14\n" \
395 ".previous\n" \
396 ".section __ex_table,\"a\"\n" \
397 " .balign 4\n" \
398 " .long 1b,3b\n" \
399 ".previous" \
400 : "=r"(err) \
401 : "r"(x), "r"(addr), "i"(-EFAULT), "0"(err) \
402 : "r14", "memory")
404 #define __get_user_nocheck(x,ptr,size) \
405 ({ \
406 long __gu_err, __gu_val; \
407 __get_user_size(__gu_val,(ptr),(size),__gu_err); \
408 (x) = (__typeof__(*(ptr)))__gu_val; \
409 __gu_err; \
412 extern long __get_user_bad(void);
414 #define __get_user_size(x,ptr,size,retval) \
415 do { \
416 retval = 0; \
417 __chk_user_ptr(ptr); \
418 switch (size) { \
419 case 1: __get_user_asm(x,ptr,retval,"ub"); break; \
420 case 2: __get_user_asm(x,ptr,retval,"uh"); break; \
421 case 4: __get_user_asm(x,ptr,retval,""); break; \
422 default: (x) = __get_user_bad(); \
424 } while (0)
426 #define __get_user_asm(x, addr, err, itype) \
427 __asm__ __volatile__( \
428 " .fillinsn\n" \
429 "1: ld"itype" %1,@%2\n" \
430 " .fillinsn\n" \
431 "2:\n" \
432 ".section .fixup,\"ax\"\n" \
433 " .balign 4\n" \
434 "3: ldi %0,%3\n" \
435 " seth r14,#high(2b)\n" \
436 " or3 r14,r14,#low(2b)\n" \
437 " jmp r14\n" \
438 ".previous\n" \
439 ".section __ex_table,\"a\"\n" \
440 " .balign 4\n" \
441 " .long 1b,3b\n" \
442 ".previous" \
443 : "=r"(err), "=&r"(x) \
444 : "r"(addr), "i"(-EFAULT), "0"(err) \
445 : "r14", "memory")
448 * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault
449 * we return the initial request size (1, 2 or 4), as copy_*_user should do.
450 * If a store crosses a page boundary and gets a fault, the m32r will not write
451 * anything, so this is accurate.
456 * Copy To/From Userspace
459 /* Generic arbitrary sized copy. */
460 /* Return the number of bytes NOT copied. */
461 #define __copy_user(to,from,size) \
462 do { \
463 unsigned long __dst, __src, __c; \
464 __asm__ __volatile__ ( \
465 " mv r14, %0\n" \
466 " or r14, %1\n" \
467 " beq %0, %1, 9f\n" \
468 " beqz %2, 9f\n" \
469 " and3 r14, r14, #3\n" \
470 " bnez r14, 2f\n" \
471 " and3 %2, %2, #3\n" \
472 " beqz %3, 2f\n" \
473 " addi %0, #-4 ; word_copy \n" \
474 " .fillinsn\n" \
475 "0: ld r14, @%1+\n" \
476 " addi %3, #-1\n" \
477 " .fillinsn\n" \
478 "1: st r14, @+%0\n" \
479 " bnez %3, 0b\n" \
480 " beqz %2, 9f\n" \
481 " addi %0, #4\n" \
482 " .fillinsn\n" \
483 "2: ldb r14, @%1 ; byte_copy \n" \
484 " .fillinsn\n" \
485 "3: stb r14, @%0\n" \
486 " addi %1, #1\n" \
487 " addi %2, #-1\n" \
488 " addi %0, #1\n" \
489 " bnez %2, 2b\n" \
490 " .fillinsn\n" \
491 "9:\n" \
492 ".section .fixup,\"ax\"\n" \
493 " .balign 4\n" \
494 "5: addi %3, #1\n" \
495 " addi %1, #-4\n" \
496 " .fillinsn\n" \
497 "6: slli %3, #2\n" \
498 " add %2, %3\n" \
499 " addi %0, #4\n" \
500 " .fillinsn\n" \
501 "7: seth r14, #high(9b)\n" \
502 " or3 r14, r14, #low(9b)\n" \
503 " jmp r14\n" \
504 ".previous\n" \
505 ".section __ex_table,\"a\"\n" \
506 " .balign 4\n" \
507 " .long 0b,6b\n" \
508 " .long 1b,5b\n" \
509 " .long 2b,9b\n" \
510 " .long 3b,9b\n" \
511 ".previous\n" \
512 : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \
513 : "0"(to), "1"(from), "2"(size), "3"(size / 4) \
514 : "r14", "memory"); \
515 } while (0)
517 #define __copy_user_zeroing(to,from,size) \
518 do { \
519 unsigned long __dst, __src, __c; \
520 __asm__ __volatile__ ( \
521 " mv r14, %0\n" \
522 " or r14, %1\n" \
523 " beq %0, %1, 9f\n" \
524 " beqz %2, 9f\n" \
525 " and3 r14, r14, #3\n" \
526 " bnez r14, 2f\n" \
527 " and3 %2, %2, #3\n" \
528 " beqz %3, 2f\n" \
529 " addi %0, #-4 ; word_copy \n" \
530 " .fillinsn\n" \
531 "0: ld r14, @%1+\n" \
532 " addi %3, #-1\n" \
533 " .fillinsn\n" \
534 "1: st r14, @+%0\n" \
535 " bnez %3, 0b\n" \
536 " beqz %2, 9f\n" \
537 " addi %0, #4\n" \
538 " .fillinsn\n" \
539 "2: ldb r14, @%1 ; byte_copy \n" \
540 " .fillinsn\n" \
541 "3: stb r14, @%0\n" \
542 " addi %1, #1\n" \
543 " addi %2, #-1\n" \
544 " addi %0, #1\n" \
545 " bnez %2, 2b\n" \
546 " .fillinsn\n" \
547 "9:\n" \
548 ".section .fixup,\"ax\"\n" \
549 " .balign 4\n" \
550 "5: addi %3, #1\n" \
551 " addi %1, #-4\n" \
552 " .fillinsn\n" \
553 "6: slli %3, #2\n" \
554 " add %2, %3\n" \
555 " addi %0, #4\n" \
556 " .fillinsn\n" \
557 "7: ldi r14, #0 ; store zero \n" \
558 " .fillinsn\n" \
559 "8: addi %2, #-1\n" \
560 " stb r14, @%0 ; ACE? \n" \
561 " addi %0, #1\n" \
562 " bnez %2, 8b\n" \
563 " seth r14, #high(9b)\n" \
564 " or3 r14, r14, #low(9b)\n" \
565 " jmp r14\n" \
566 ".previous\n" \
567 ".section __ex_table,\"a\"\n" \
568 " .balign 4\n" \
569 " .long 0b,6b\n" \
570 " .long 1b,5b\n" \
571 " .long 2b,7b\n" \
572 " .long 3b,7b\n" \
573 ".previous\n" \
574 : "=&r"(__dst), "=&r"(__src), "=&r"(size), "=&r"(__c) \
575 : "0"(to), "1"(from), "2"(size), "3"(size / 4) \
576 : "r14", "memory"); \
577 } while (0)
580 /* We let the __ versions of copy_from/to_user inline, because they're often
581 * used in fast paths and have only a small space overhead.
583 static inline unsigned long __generic_copy_from_user_nocheck(void *to,
584 const void __user *from, unsigned long n)
586 __copy_user_zeroing(to,from,n);
587 return n;
590 static inline unsigned long __generic_copy_to_user_nocheck(void __user *to,
591 const void *from, unsigned long n)
593 __copy_user(to,from,n);
594 return n;
597 unsigned long __generic_copy_to_user(void *, const void *, unsigned long);
598 unsigned long __generic_copy_from_user(void *, const void *, unsigned long);
601 * __copy_to_user: - Copy a block of data into user space, with less checking.
602 * @to: Destination address, in user space.
603 * @from: Source address, in kernel space.
604 * @n: Number of bytes to copy.
606 * Context: User context only. This function may sleep.
608 * Copy data from kernel space to user space. Caller must check
609 * the specified block with access_ok() before calling this function.
611 * Returns number of bytes that could not be copied.
612 * On success, this will be zero.
614 #define __copy_to_user(to,from,n) \
615 __generic_copy_to_user_nocheck((to),(from),(n))
617 #define __copy_to_user_inatomic __copy_to_user
618 #define __copy_from_user_inatomic __copy_from_user
621 * copy_to_user: - Copy a block of data into user space.
622 * @to: Destination address, in user space.
623 * @from: Source address, in kernel space.
624 * @n: Number of bytes to copy.
626 * Context: User context only. This function may sleep.
628 * Copy data from kernel space to user space.
630 * Returns number of bytes that could not be copied.
631 * On success, this will be zero.
633 #define copy_to_user(to,from,n) \
634 ({ \
635 might_sleep(); \
636 __generic_copy_to_user((to),(from),(n)); \
640 * __copy_from_user: - Copy a block of data from user space, with less checking. * @to: Destination address, in kernel space.
641 * @from: Source address, in user space.
642 * @n: Number of bytes to copy.
644 * Context: User context only. This function may sleep.
646 * Copy data from user space to kernel space. Caller must check
647 * the specified block with access_ok() before calling this function.
649 * Returns number of bytes that could not be copied.
650 * On success, this will be zero.
652 * If some data could not be copied, this function will pad the copied
653 * data to the requested size using zero bytes.
655 #define __copy_from_user(to,from,n) \
656 __generic_copy_from_user_nocheck((to),(from),(n))
659 * copy_from_user: - Copy a block of data from user space.
660 * @to: Destination address, in kernel space.
661 * @from: Source address, in user space.
662 * @n: Number of bytes to copy.
664 * Context: User context only. This function may sleep.
666 * Copy data from user space to kernel space.
668 * Returns number of bytes that could not be copied.
669 * On success, this will be zero.
671 * If some data could not be copied, this function will pad the copied
672 * data to the requested size using zero bytes.
674 #define copy_from_user(to,from,n) \
675 ({ \
676 might_sleep(); \
677 __generic_copy_from_user((to),(from),(n)); \
680 long __must_check strncpy_from_user(char *dst, const char __user *src,
681 long count);
682 long __must_check __strncpy_from_user(char *dst,
683 const char __user *src, long count);
686 * __clear_user: - Zero a block of memory in user space, with less checking.
687 * @to: Destination address, in user space.
688 * @n: Number of bytes to zero.
690 * Zero a block of memory in user space. Caller must check
691 * the specified block with access_ok() before calling this function.
693 * Returns number of bytes that could not be cleared.
694 * On success, this will be zero.
696 unsigned long __clear_user(void __user *mem, unsigned long len);
699 * clear_user: - Zero a block of memory in user space.
700 * @to: Destination address, in user space.
701 * @n: Number of bytes to zero.
703 * Zero a block of memory in user space. Caller must check
704 * the specified block with access_ok() before calling this function.
706 * Returns number of bytes that could not be cleared.
707 * On success, this will be zero.
709 unsigned long clear_user(void __user *mem, unsigned long len);
712 * strlen_user: - Get the size of a string in user space.
713 * @str: The string to measure.
715 * Context: User context only. This function may sleep.
717 * Get the size of a NUL-terminated string in user space.
719 * Returns the size of the string INCLUDING the terminating NUL.
720 * On exception, returns 0.
722 * If there is a limit on the length of a valid string, you may wish to
723 * consider using strnlen_user() instead.
725 #define strlen_user(str) strnlen_user(str, ~0UL >> 1)
726 long strnlen_user(const char __user *str, long n);
728 #endif /* _ASM_M32R_UACCESS_H */