regset: kill user_regset_copyout{,_zero}()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 17 Jun 2020 17:40:03 +0000 (13:40 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Jul 2020 18:31:13 +0000 (14:31 -0400)
no callers left

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
include/linux/regset.h

index 6b951a2..c3403f3 100644 (file)
@@ -238,44 +238,6 @@ struct user_regset_view {
  */
 const struct user_regset_view *task_user_regset_view(struct task_struct *tsk);
 
-
-/*
- * These are helpers for writing regset get/set functions in arch code.
- * Because @start_pos and @end_pos are always compile-time constants,
- * these are inlined into very little code though they look large.
- *
- * Use one or more calls sequentially for each chunk of regset data stored
- * contiguously in memory.  Call with constants for @start_pos and @end_pos,
- * giving the range of byte positions in the regset that data corresponds
- * to; @end_pos can be -1 if this chunk is at the end of the regset layout.
- * Each call updates the arguments to point past its chunk.
- */
-
-static inline int user_regset_copyout(unsigned int *pos, unsigned int *count,
-                                     void **kbuf,
-                                     void __user **ubuf, const void *data,
-                                     const int start_pos, const int end_pos)
-{
-       if (*count == 0)
-               return 0;
-       BUG_ON(*pos < start_pos);
-       if (end_pos < 0 || *pos < end_pos) {
-               unsigned int copy = (end_pos < 0 ? *count
-                                    : min(*count, end_pos - *pos));
-               data += *pos - start_pos;
-               if (*kbuf) {
-                       memcpy(*kbuf, data, copy);
-                       *kbuf += copy;
-               } else if (__copy_to_user(*ubuf, data, copy))
-                       return -EFAULT;
-               else
-                       *ubuf += copy;
-               *pos += copy;
-               *count -= copy;
-       }
-       return 0;
-}
-
 static inline int user_regset_copyin(unsigned int *pos, unsigned int *count,
                                     const void **kbuf,
                                     const void __user **ubuf, void *data,
@@ -301,35 +263,6 @@ static inline int user_regset_copyin(unsigned int *pos, unsigned int *count,
        return 0;
 }
 
-/*
- * These two parallel the two above, but for portions of a regset layout
- * that always read as all-zero or for which writes are ignored.
- */
-static inline int user_regset_copyout_zero(unsigned int *pos,
-                                          unsigned int *count,
-                                          void **kbuf, void __user **ubuf,
-                                          const int start_pos,
-                                          const int end_pos)
-{
-       if (*count == 0)
-               return 0;
-       BUG_ON(*pos < start_pos);
-       if (end_pos < 0 || *pos < end_pos) {
-               unsigned int copy = (end_pos < 0 ? *count
-                                    : min(*count, end_pos - *pos));
-               if (*kbuf) {
-                       memset(*kbuf, 0, copy);
-                       *kbuf += copy;
-               } else if (clear_user(*ubuf, copy))
-                       return -EFAULT;
-               else
-                       *ubuf += copy;
-               *pos += copy;
-               *count -= copy;
-       }
-       return 0;
-}
-
 static inline int user_regset_copyin_ignore(unsigned int *pos,
                                            unsigned int *count,
                                            const void **kbuf,