From patchwork Mon Jun 1 11:56:09 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: 49306 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 43121218FC for ; Mon, 1 Jun 2015 11:56:59 +0000 (UTC) Received: by lani11 with SMTP id i11sf36294082lan.3 for ; Mon, 01 Jun 2015 04:56:58 -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=OP9HZ0jzylDtJABOgUuw9xTWICDd5BXqS+SIajhnzVY=; b=apXDKztpIKsVki35WjweB6f7/Y5HHbJJb/voCIzY0uvWtKmaFGS9AGIkepcnOykZi8 ULJKMKdV6LrS9aCm5SZLg522tjwfkzVQd5swAUd9n3QM1bO0YLeCP3yVyUG0vovSasDj SvdqMFqowu0xlxev9ToB7H0CCvKmXsqU3GStWHtEq9N6wepPj/iIsWBF30XczRgTv3ES PCwnzwdObwR+Z3xRIK+L1te5lnGt/UbA/CP8JZgAP2gw35nE/aRmfbqmQ6/fMl2k3mRn f8brf/mFW/Iv/Oh3AgIXDxi/bohmTltSHLBy+j7Ch7epmlGszLxToxjLicHlQCNTU6tB u5pQ== X-Gm-Message-State: ALoCoQl3j5V7VuIGNo4kRj8StakMbyu5lVJEsSrT6e48qhvKyeJB5oxyJjR3cmWgQOmSL+a1zW6X X-Received: by 10.194.142.205 with SMTP id ry13mr20543884wjb.2.1433159818186; Mon, 01 Jun 2015 04:56:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.229 with SMTP id w5ls591383lag.44.gmail; Mon, 01 Jun 2015 04:56:58 -0700 (PDT) X-Received: by 10.152.234.42 with SMTP id ub10mr20401010lac.60.1433159817993; Mon, 01 Jun 2015 04:56:57 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id bo7si12121500lbb.108.2015.06.01.04.56.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 04:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcmx3 with SMTP id mx3so82656974lbc.1 for ; Mon, 01 Jun 2015 04:56:57 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr21057564lab.35.1433159817894; Mon, 01 Jun 2015 04:56:57 -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 hn6csp2258335lbb; Mon, 1 Jun 2015 04:56:56 -0700 (PDT) X-Received: by 10.66.102.103 with SMTP id fn7mr40163795pab.85.1433159816140; Mon, 01 Jun 2015 04:56:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov6si20723820pbb.2.2015.06.01.04.56.53; Mon, 01 Jun 2015 04:56:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752876AbbFAL4q (ORCPT + 28 others); Mon, 1 Jun 2015 07:56:46 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34070 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752620AbbFAL4Z (ORCPT ); Mon, 1 Jun 2015 07:56:25 -0400 Received: by payr10 with SMTP id r10so25109535pay.1 for ; Mon, 01 Jun 2015 04:56:24 -0700 (PDT) X-Received: by 10.66.191.226 with SMTP id hb2mr40173343pac.72.1433159784020; Mon, 01 Jun 2015 04:56:24 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id wh6sm14010216pbc.96.2015.06.01.04.56.21 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 04:56:23 -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 v4 09/25] posix-timers:Change the implementation for timer_settime syscall Date: Mon, 1 Jun 2015 19:56:09 +0800 Message-Id: <1433159769-4890-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.217.176 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 splits out the guts of the timer_settime syscall and changes the timer_settime syscall implementation to prepare the converting to 64bit methods for the timer_settime syscall function in posix-timers.c file. Signed-off-by: Baolin Wang --- kernel/time/posix-timers.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 2adeb29..99ccb3c 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -920,27 +920,18 @@ common_timer_set(struct k_itimer *timr, int flags, return 0; } -/* Set a POSIX.1b interval timer */ -SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags, - const struct itimerspec __user *, new_setting, - struct itimerspec __user *, old_setting) +static int __timer_settime(timer_t timer_id, int flags, struct itimerspec *new_spec, + struct itimerspec *old_spec) { struct k_itimer *timr; - struct itimerspec new_spec, old_spec; int error = 0; unsigned long flag; - struct itimerspec *rtn = old_setting ? &old_spec : NULL; struct k_clock *kc; - if (!new_setting) + if (!timespec_valid(&new_spec->it_interval) || + !timespec_valid(&new_spec->it_value)) return -EINVAL; - if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) - return -EFAULT; - - if (!timespec_valid(&new_spec.it_interval) || - !timespec_valid(&new_spec.it_value)) - return -EINVAL; retry: timr = lock_timer(timer_id, &flag); if (!timr) @@ -950,14 +941,34 @@ retry: if (WARN_ON_ONCE(!kc || !kc->timer_set)) error = -EINVAL; else - error = kc->timer_set(timr, flags, &new_spec, rtn); + error = kc->timer_set(timr, flags, new_spec, old_spec); unlock_timer(timr, flag); if (error == TIMER_RETRY) { - rtn = NULL; // We already got the old time... + old_spec = NULL; // We already got the old time... goto retry; } + return error; +} + +/* Set a POSIX.1b interval timer */ +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; + struct itimerspec *rtn = old_setting ? &old_spec : NULL; + + if (!new_setting) + return -EINVAL; + + if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) + return -EFAULT; + + error = __timer_settime(timer_id, flags, &new_spec, rtn); + if (old_setting && !error && copy_to_user(old_setting, &old_spec, sizeof (old_spec))) error = -EFAULT;