From patchwork Mon May 11 11:15:37 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: 48242 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 D067221550 for ; Mon, 11 May 2015 11:15:56 +0000 (UTC) Received: by wgin8 with SMTP id n8sf38552826wgi.0 for ; Mon, 11 May 2015 04:15:56 -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=Dqj7RtW3bL3F9eKmTj3ttq3EmSp4FY8ROfkKyRHln1g=; b=fkbeX8AqXKL1pgr4nuQG9WM0Q9f1iHa3tmz44VMCZuV+GxHuQd5cnQkrUm3yOURTKn O9q1EPu0YnXg/hJjeflzGg8CqWlkDe3WGSoniIiKSxrurnq24PQPZqeGzepuyDYr4Jyw C+2FPpm0C3B7VGlD9rVLrNLXKmuemXI8lKSfjzQ15oN7rDvHgMdpt93c03a2ovd5fX+R fwzqtz3nY/T/fjSxPeZSS9V+wFxureXL+NRmN3lDC63NoWKWtLZEsg7+dCWaHx/+uyDx ysL6i4BBg/YjtwD4It/UsNCyqe6H6F2Td8UyUw/8kpYZ3CCqs+UhTfje/TOJ/aCCpHmp I3Ew== X-Gm-Message-State: ALoCoQkRReNsHKZYG4AbdLQblxVheiCj7z1xxWTWxvKGyXIxGhdW9zKrshSPJ0jfBSO6re9p0QKG X-Received: by 10.180.11.101 with SMTP id p5mr7296578wib.3.1431342956171; Mon, 11 May 2015 04:15:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.38 with SMTP id jt6ls683610lab.101.gmail; Mon, 11 May 2015 04:15:56 -0700 (PDT) X-Received: by 10.152.206.103 with SMTP id ln7mr7762003lac.40.1431342955984; Mon, 11 May 2015 04:15:55 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id q16si8187315laa.25.2015.05.11.04.15.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:15:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbcga7 with SMTP id ga7so91407023lbc.1 for ; Mon, 11 May 2015 04:15:55 -0700 (PDT) X-Received: by 10.113.10.134 with SMTP id ea6mr7595013lbd.29.1431342955843; Mon, 11 May 2015 04:15:55 -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 hn6csp1442840lbb; Mon, 11 May 2015 04:15:54 -0700 (PDT) X-Received: by 10.70.62.97 with SMTP id x1mr18065035pdr.41.1431342954040; Mon, 11 May 2015 04:15:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id je6si17522757pbd.73.2015.05.11.04.15.53; Mon, 11 May 2015 04:15:54 -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 S932220AbbEKLPs (ORCPT + 28 others); Mon, 11 May 2015 07:15:48 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:36692 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753432AbbEKLPo (ORCPT ); Mon, 11 May 2015 07:15:44 -0400 Received: by pabsx10 with SMTP id sx10so107636057pab.3 for ; Mon, 11 May 2015 04:15:44 -0700 (PDT) X-Received: by 10.66.141.231 with SMTP id rr7mr18574099pab.86.1431342944142; Mon, 11 May 2015 04:15:44 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id mi1sm12722365pab.0.2015.05.11.04.15.41 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:15:43 -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 06/22] posix-timers:Split out the guts of the syscall and change the implementation for timer_settime Date: Mon, 11 May 2015 19:15:37 +0800 Message-Id: <1431342937-29607-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.172 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 | 45 +++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index f7cf00b..0ec9647 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -899,27 +899,14 @@ 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) - 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) @@ -929,14 +916,38 @@ 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; + + if (!timespec_valid(&new_spec.it_interval) || + !timespec_valid(&new_spec.it_value)) + return -EINVAL; + + 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;