From patchwork Mon May 11 11:16:31 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: 48245 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE79D21550 for ; Mon, 11 May 2015 11:16:48 +0000 (UTC) Received: by lbos2 with SMTP id s2sf37721358lbo.2 for ; Mon, 11 May 2015 04:16:48 -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=tiUK8sjIUOcU+VT0X6kDXg/5mXJbF2SqVF8NVFiriaA=; b=RFkq8f0GvdMMlodncUq0eZLODj8TPefb0M0Z94T/FHhjNocG0tYcM1JjMzM4tbEEHf PnSf9rDeDeCCmLqodTHcgJGqv1yCaMmm1VTmRECYcfH+qGa04w5I3akzpPXZM6dIS7BP +P9qGtG0sRuHdvH6foRc7oaUSy5g134NVNrTk/DH4vTVLxGEPrtTIM8DyhKtXV+mwNdW RERCSe2kZCB9ZwLUeA+wXBqvrhzLjGQCyhb/dsosFDCEgwXd7031Kgmml4RLxp6Pb15v yoE6X0LGFNH7d0I7iNgu++euHkLn38VCIj6oXvUDt3MIAzu/hpBIaSDAVoYvZu2SfGHA qyfA== X-Gm-Message-State: ALoCoQnG2b8hohkFp+Zg9mHFeXnZM67Gg6FzsGdN0iKFCahM1qFlBxKG8xRPSfdO2jzBFzUWsWus X-Received: by 10.152.203.233 with SMTP id kt9mr7201978lac.7.1431343007946; Mon, 11 May 2015 04:16:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.98 with SMTP id ln2ls627497lac.61.gmail; Mon, 11 May 2015 04:16:47 -0700 (PDT) X-Received: by 10.112.180.201 with SMTP id dq9mr7861051lbc.78.1431343007622; Mon, 11 May 2015 04:16:47 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id p5si8163644laj.137.2015.05.11.04.16.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbuc2 with SMTP id uc2so91186163lbb.2 for ; Mon, 11 May 2015 04:16:47 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr7914893lad.56.1431343007513; Mon, 11 May 2015 04:16:47 -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 hn6csp1443248lbb; Mon, 11 May 2015 04:16:46 -0700 (PDT) X-Received: by 10.66.55.74 with SMTP id q10mr18347401pap.94.1431343005775; Mon, 11 May 2015 04:16:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si3si6486376pac.192.2015.05.11.04.16.44; Mon, 11 May 2015 04:16:45 -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 S932256AbbEKLQk (ORCPT + 28 others); Mon, 11 May 2015 07:16:40 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:33752 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932234AbbEKLQi (ORCPT ); Mon, 11 May 2015 07:16:38 -0400 Received: by pdbnk13 with SMTP id nk13so144164982pdb.0 for ; Mon, 11 May 2015 04:16:37 -0700 (PDT) X-Received: by 10.66.254.67 with SMTP id ag3mr17975297pad.45.1431342997450; Mon, 11 May 2015 04:16:37 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id i16sm12786149pbq.79.2015.05.11.04.16.35 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:16:36 -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 09/22] posix-timers:Convert to the 64bit methods for the clock_settime syscall function Date: Mon, 11 May 2015 19:16:31 +0800 Message-Id: <1431342991-29721-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.169 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 clock_set64 methods with timespec64 type for k_clock structure. Convert to the 64bit methods with timespec64 type for the clock_settime syscall function, and change the clock_settime syscall implementation according the the CONFIG_64BIT macro. Signed-off-by: Baolin Wang --- include/linux/posix-timers.h | 2 ++ kernel/time/posix-timers.c | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 870ab93..9b6469c 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -100,6 +100,8 @@ struct k_clock { int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); int (*clock_set) (const clockid_t which_clock, const struct timespec *tp); + int (*clock_set64) (const clockid_t which_clock, + const struct timespec64 *tp); int (*clock_get) (const clockid_t which_clock, struct timespec * tp); int (*clock_adj) (const clockid_t which_clock, struct timex *tx); int (*timer_create) (struct k_itimer *timer); diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index dcc35fc..0fe8a65 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -535,6 +535,16 @@ static int default_timer_set64(struct k_itimer *timr, int flags, return 0; } +static int default_clock_set64(const clockid_t which_clock, + const struct timespec64 *tp64) +{ + struct k_clock *kc = clockid_to_kclock(which_clock); + struct timespec tp; + + kc->clock_set(which_clock, &tp); + return 0; +} + void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock) { @@ -559,6 +569,8 @@ void posix_timers_register_clock(const clockid_t clock_id, new_clock->timer_get64 = default_timer_get64; if (new_clock->timer_set && !new_clock->timer_set64) new_clock->timer_set64 = default_timer_set64; + if (new_clock->clock_set && !new_clock->clock_set64) + new_clock->clock_set64 = default_clock_set64; posix_clocks[clock_id] = *new_clock; } @@ -1072,25 +1084,35 @@ void exit_itimers(struct signal_struct *sig) } } -static int __clock_settime(clockid_t which_clock, struct timespec *ts) +static int __clock_settime(clockid_t which_clock, struct timespec64 *ts) { struct k_clock *kc = clockid_to_kclock(which_clock); - if (!kc || !kc->clock_set) + if (!kc || !kc->clock_set64) return -EINVAL; - return kc->clock_set(which_clock, ts); + return kc->clock_set64(which_clock, ts); } SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, const struct timespec __user *, tp) { +#ifdef CONFIG_64BIT + struct timespec64 new_tp; +#else struct timespec new_tp; + struct timespec64 new_tp64; +#endif if (copy_from_user(&new_tp, tp, sizeof (*tp))) return -EFAULT; +#ifdef CONFIG_64BIT return __clock_settime(which_clock, &new_tp); +#else + new_tp64 = timespec_to_timespec64(new_tp); + return __clock_settime(which_clock, &new_tp64); +#endif } SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock,