From patchwork Mon May 11 11:15:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 48243 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 984A121550 for ; Mon, 11 May 2015 11:16:11 +0000 (UTC) Received: by wgin8 with SMTP id n8sf38554310wgi.0 for ; Mon, 11 May 2015 04:16:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=FRtuKZH9ugNO4508ytYfGfaU87E0hVc9hqnZ4rDvM+8=; b=XuAMRk2DLmR2vpnUKVD08fZZe3jicYjnRrE5cMh9dyPCiqQqyXJB+goHu1EZTQ3IB7 ckkaGVZirdaxwWmFrPzPtRYSRsky8bKS4h7qy+cqHFCRw4t0iVuatw5RQZuhr2t9gXt6 /Yj+z7MZjmhoTwFQ8rMEqCSmSlc/lPhdIuNIYXb4H8ryK5SFhxk+0JNh/EU4Xzen/5ks wWtYLoIQvKjAw7ytye+ccuWvgzGN0jG/BPRyt3cJGOxUS43Lt5YALtu+1kHm0vnIUB0E /8B1V09Cl5FHxKoosMXyCef9zzxRwMd3Dx8d2BLOi6yAcati8q3SfHc3hxW1bSY2CUeQ N2CA== X-Gm-Message-State: ALoCoQniWRb0rLcOfhhDaNfm1fZCaIvAX9YZ6QBPSecDvBl2zTAbuTE7QygZI+9ENPb+3awE984o X-Received: by 10.180.73.137 with SMTP id l9mr7291252wiv.5.1431342970891; Mon, 11 May 2015 04:16:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.40 with SMTP id v8ls566640laj.88.gmail; Mon, 11 May 2015 04:16:10 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr7712270lbc.86.1431342970695; Mon, 11 May 2015 04:16:10 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id ps10si8190154lbb.26.2015.05.11.04.16.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:16:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laat2 with SMTP id t2so90641597laa.1 for ; Mon, 11 May 2015 04:16:10 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr7538665lak.117.1431342970545; Mon, 11 May 2015 04:16:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1442976lbb; Mon, 11 May 2015 04:16:09 -0700 (PDT) X-Received: by 10.66.138.15 with SMTP id qm15mr18408825pab.52.1431342968788; Mon, 11 May 2015 04:16:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si17469620pby.224.2015.05.11.04.16.07; Mon, 11 May 2015 04:16:08 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753896AbbEKLQE (ORCPT + 28 others); Mon, 11 May 2015 07:16:04 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:35268 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753720AbbEKLQA (ORCPT ); Mon, 11 May 2015 07:16:00 -0400 Received: by pdbqd1 with SMTP id qd1so144005043pdb.2 for ; Mon, 11 May 2015 04:16:00 -0700 (PDT) X-Received: by 10.70.32.164 with SMTP id k4mr18579978pdi.138.1431342959992; Mon, 11 May 2015 04:15:59 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id dl2sm12802113pbc.28.2015.05.11.04.15.56 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:15:59 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v3 07/22] posix-timers:Convert to the 64bit methods for the timer_settime syscall function Date: Mon, 11 May 2015 19:15:52 +0800 Message-Id: <1431342952-29645-1-git-send-email-baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: baolin.wang@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch introduces the timer_settime64 methods with itimerspec64 type for k_clock structure. Convert to the 64bit methods with timespec64/itimerspec64 type for the timer_settime syscall function, and change the timer_settime syscall implementation according the the CONFIG_64BIT macro. Signed-off-by: Baolin Wang --- include/linux/posix-timers.h | 3 +++ kernel/time/posix-timers.c | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index e84436b..870ab93 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -109,6 +109,9 @@ struct k_clock { int (*timer_set) (struct k_itimer * timr, int flags, struct itimerspec * new_setting, struct itimerspec * old_setting); + int (*timer_set64) (struct k_itimer *timr, int flags, + struct itimerspec64 *new_setting, + struct itimerspec64 *old_setting); int (*timer_del) (struct k_itimer * timr); #define TIMER_RETRY 1 void (*timer_get) (struct k_itimer * timr, diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 0ec9647..f2fde32 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -524,6 +524,17 @@ static int default_timer_get64(struct k_itimer *timr, return 0; } +static int default_timer_set64(struct k_itimer *timr, int flags, + struct itimerspec64 *new_setting64, + struct itimerspec64 *old_setting64) +{ + struct k_clock *kc = clockid_to_kclock(timr->it_clock); + struct itimerspec new_setting, old_setting; + + kc->timer_set(timr, flags, &new_setting, &old_setting); + return 0; +} + void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock) { @@ -546,6 +557,8 @@ void posix_timers_register_clock(const clockid_t clock_id, if (new_clock->timer_get && !new_clock->timer_get64) new_clock->timer_get64 = default_timer_get64; + if (new_clock->timer_set && !new_clock->timer_set64) + new_clock->timer_set64 = default_timer_set64; posix_clocks[clock_id] = *new_clock; } @@ -899,8 +912,8 @@ common_timer_set(struct k_itimer *timr, int flags, return 0; } -static int __timer_settime(timer_t timer_id, int flags, struct itimerspec *new_spec, - struct itimerspec *old_spec) +static int __timer_settime(timer_t timer_id, int flags, struct itimerspec64 *new_spec, + struct itimerspec64 *old_spec) { struct k_itimer *timr; int error = 0; @@ -913,10 +926,10 @@ retry: return -EINVAL; kc = clockid_to_kclock(timr->it_clock); - if (WARN_ON_ONCE(!kc || !kc->timer_set)) + if (WARN_ON_ONCE(!kc || !kc->timer_set64)) error = -EINVAL; else - error = kc->timer_set(timr, flags, new_spec, old_spec); + error = kc->timer_set64(timr, flags, new_spec, old_spec); unlock_timer(timr, flag); if (error == TIMER_RETRY) { @@ -932,9 +945,16 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, const struct itimerspec __user *, new_setting, struct itimerspec __user *, old_setting) { - struct itimerspec new_spec, old_spec; int error = 0; +#ifdef CONFIG_64BIT + struct itimerspec64 new_spec, old_spec; + struct itimerspec64 *rtn = old_setting ? &old_spec : NULL; +#else + struct itimerspec new_spec, old_spec; struct itimerspec *rtn = old_setting ? &old_spec : NULL; + struct itimerspec64 new_spec64; + struct itimerspec64 *rtn64; +#endif if (!new_setting) return -EINVAL; @@ -946,7 +966,17 @@ SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, !timespec_valid(&new_spec.it_value)) return -EINVAL; +#ifdef CONFIG_64BIT error = __timer_settime(timer_id, flags, &new_spec, rtn); +#else + new_spec64 = itimerspec_to_itimerspec64(&new_spec); + if (rtn) + *rtn64 = itimerspec_to_itimerspec64(rtn); + else + rtn64 = NULL; + + error = __timer_settime(timer_id, flags, &new_spec64, rtn64); +#endif if (old_setting && !error && copy_to_user(old_setting, &old_spec, sizeof (old_spec)))