From patchwork Mon Jun 1 11:54: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: 49302 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5EC97218FC for ; Mon, 1 Jun 2015 11:54:56 +0000 (UTC) Received: by lbbti3 with SMTP id ti3sf33962829lbb.1 for ; Mon, 01 Jun 2015 04:54:55 -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=KtzNiKQKCgU9jEzOFFuItmIb/gPfPrCMvGZ003YEZp8=; b=aSmUXThO9aXGo2rs5QeychWn2Bf5KGgGZ9yHMJR+qy1NEW/vlYMieihCoa+CztWFGu DTHW1dZPubeiLfwoJpPRt49+ouw5z/8o1VKgswXuoFHQdmuddTbOA2+oEFSqIpoVdXax Oje2Hgbhf/vpIeN6i9ASjAQf3N0Y+/qFT2Tb+vraPtJ9myfwD9vVEcQin0FrGcHd6b2g LOWh66kaOoVL9i0vnYv207sRZBdCv67jWvJ0yu8+Wq2/w+/9Wgi/nlSY7P5v2ywEXDFV /o3EFX5EUnng/SYyUvGKpyM1xFdvY2eehRe39tsJi+HhoY1xLiLRdKj4cG3fLI0qNmrL wRVA== X-Gm-Message-State: ALoCoQlyD1mtVTqp4o2clKoMVcGqn8TLI4Vt63DbLYIJNDcoE+0KKERSAy5l/jTVzWmJ5gnHzy8z X-Received: by 10.112.93.203 with SMTP id cw11mr20448695lbb.0.1433159694987; Mon, 01 Jun 2015 04:54:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.166 with SMTP id z6ls583648laj.64.gmail; Mon, 01 Jun 2015 04:54:54 -0700 (PDT) X-Received: by 10.152.7.239 with SMTP id m15mr19921246laa.95.1433159694807; Mon, 01 Jun 2015 04:54:54 -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 eq8si12133350lac.38.2015.06.01.04.54.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jun 2015 04:54:54 -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 mx3so82625352lbc.1 for ; Mon, 01 Jun 2015 04:54:54 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr21168309lbc.32.1433159694568; Mon, 01 Jun 2015 04:54:54 -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 hn6csp2257150lbb; Mon, 1 Jun 2015 04:54:53 -0700 (PDT) X-Received: by 10.70.44.199 with SMTP id g7mr39785775pdm.27.1433159692577; Mon, 01 Jun 2015 04:54:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn15si21234911pab.149.2015.06.01.04.54.51; Mon, 01 Jun 2015 04:54:52 -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 S1752360AbbFALyr (ORCPT + 28 others); Mon, 1 Jun 2015 07:54:47 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33858 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751322AbbFALyi (ORCPT ); Mon, 1 Jun 2015 07:54:38 -0400 Received: by payr10 with SMTP id r10so25081635pay.1 for ; Mon, 01 Jun 2015 04:54:38 -0700 (PDT) X-Received: by 10.66.191.226 with SMTP id hb2mr40162233pac.72.1433159678296; Mon, 01 Jun 2015 04:54:38 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id v9sm14292825pdr.96.2015.06.01.04.54.34 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Jun 2015 04:54:37 -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 v4 05/25] time:Introduce the do_sys_settimeofday64() function with timespec64 type Date: Mon, 1 Jun 2015 19:54:22 +0800 Message-Id: <1433159662-4742-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: , Introduce the do_sys_settimeofday64() function with timespec64 type to make it is ready for 2038 issue when setting the time of day. And move the do_sys_settimeofday() function to the timekeeping.h file, that it is convenient to delete it later. Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 12 ++++++++++-- kernel/time/time.c | 8 ++++---- 2 files changed, 14 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..33c539b 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -160,15 +160,15 @@ 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; - if (tv && !timespec_valid(tv)) + if (tv && !timespec64_valid(tv)) return -EINVAL; - error = security_settime(tv, tz); + error = security_settime64(tv, tz); if (error) return error; @@ -182,7 +182,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; }