From patchwork Mon May 11 11:19:22 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: 48253 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9A4B21550 for ; Mon, 11 May 2015 11:19:43 +0000 (UTC) Received: by lbos2 with SMTP id s2sf37739077lbo.2 for ; Mon, 11 May 2015 04:19:42 -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=gJEmPXJOsQ4FnLE6CTxiXE8kz+HgJ9R3Qw490HaBLng=; b=ePyZSz+xt8OAdzijOSrlYI6MHO3KgQ3o+qD7daW0r+FuMQiT5STtWs86H40LOEEONx VmTjvAFv910boEczEPsXjrPLWN9SPxiE3nfMzlDyTnLcbCCJmwMupmAnhvZMkT04+7Ka VvihsEJ9Yk32cwmwSYfANT+7VK5FXd4HE5wuFktRfjiItCrY/VdBKvFucdRROscRw7Bt TMsY8CQKRMQjhuazrDLrGqVV3RbOVxOHzOgu06Y93+564fWW78Dx66roK2rvhcBqfOwT Fp2D7ZJmIfLbBg9+o44ijylETJwNL/r3FXEI9oyiYzGEr2H38ClMq4V1oGMFwVriD5Sb aoNw== X-Gm-Message-State: ALoCoQmfShbMaipGso04ej43T6YaUoiyDs1qJfK8javtaYLjAQ9t3D9FBMXQ5tDn+ZXwx3VjpPw3 X-Received: by 10.180.96.6 with SMTP id do6mr7679744wib.4.1431343182861; Mon, 11 May 2015 04:19:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.131 with SMTP id s3ls570922las.65.gmail; Mon, 11 May 2015 04:19:42 -0700 (PDT) X-Received: by 10.152.87.113 with SMTP id w17mr783444laz.104.1431343182674; Mon, 11 May 2015 04:19:42 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id zk9si8190145lbb.58.2015.05.11.04.19.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:19:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by laat2 with SMTP id t2so90697159laa.1 for ; Mon, 11 May 2015 04:19:42 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr7943839lbc.32.1431343182542; Mon, 11 May 2015 04:19:42 -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 hn6csp1444578lbb; Mon, 11 May 2015 04:19:41 -0700 (PDT) X-Received: by 10.70.49.168 with SMTP id v8mr18560907pdn.24.1431343178050; Mon, 11 May 2015 04:19:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si15913101pdo.41.2015.05.11.04.19.37; Mon, 11 May 2015 04:19:38 -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 S1753980AbbEKLTd (ORCPT + 28 others); Mon, 11 May 2015 07:19:33 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:33241 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753740AbbEKLT3 (ORCPT ); Mon, 11 May 2015 07:19:29 -0400 Received: by pacwv17 with SMTP id wv17so107738302pac.0 for ; Mon, 11 May 2015 04:19:29 -0700 (PDT) X-Received: by 10.70.127.231 with SMTP id nj7mr18112827pdb.110.1431343169240; Mon, 11 May 2015 04:19:29 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id de4sm12791285pbb.95.2015.05.11.04.19.26 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 04:19:28 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, heenasirwani@gmail.com, pang.xunlei@linaro.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v3 14/22] time:Introduce the do_sys_settimeofday64() function with timespec64 type Date: Mon, 11 May 2015 19:19:22 +0800 Message-Id: <1431343162-29918-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.54 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 do_sys_settimeofday64() function with timespec64 type, that makes this function ready for 2038 issue when setting the time of day. And moves the do_sys_settimeofday() function to the timekeeping.h file. Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 12 ++++++++++-- kernel/time/time.c | 10 ++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index c6d5ae9..89beb62 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -11,8 +11,16 @@ extern int timekeeping_suspended; */ extern void do_gettimeofday(struct timeval *tv); extern int do_settimeofday64(const struct timespec64 *ts); -extern int do_sys_settimeofday(const struct timespec *tv, - const struct timezone *tz); +extern int do_sys_settimeofday64(const struct timespec64 *tv, + const struct timezone *tz); +static inline int do_sys_settimeofday(const struct timespec *tv, + const struct timezone *tz) +{ + struct timespec64 ts64; + + ts64 = timespec_to_timespec64(*tv); + return do_sys_settimeofday64(&ts64, tz); +} /* * Kernel time accessors diff --git a/kernel/time/time.c b/kernel/time/time.c index 2c85b77..f43011b 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -160,15 +160,17 @@ static inline void warp_clock(void) * various programs will get confused when the clock gets warped. */ -int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) +int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz) { static int firsttime = 1; int error = 0; + struct timespec ts; - if (tv && !timespec_valid(tv)) + if (tv && !timespec64_valid(tv)) return -EINVAL; - error = security_settime(tv, tz); + ts = timespec64_to_timespec(*tv); + error = security_settime(&ts, tz); if (error) return error; @@ -182,7 +184,7 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz) } } if (tv) - return do_settimeofday(tv); + return do_settimeofday64(tv); return 0; }