From patchwork Fri Jun 12 07:44:47 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: 49788 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 1FF91228DB for ; Fri, 12 Jun 2015 07:46:15 +0000 (UTC) Received: by wgme6 with SMTP id e6sf7352637wgm.3 for ; Fri, 12 Jun 2015 00:46:13 -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:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=bKPGDl7lDZlH1CCb/85MoLDT1WhdH3FWxFP7VtlCRZw=; b=XJ1LpQMNi/1oo72iLaliWtm3TFn7GjteiV8pcrmSK73wxvuArYtnNnQ66KL7ao39G2 P+1ZMex3F4vDFXPzddXGNtnw8F477/WA9wVhNg1FsWIZf4wxRcJIbDyWaiGMN/CKpW2e HYuqzucDiJ1b7YFXPQQOqrDotz2eF4s6nAPSFwzDTN9J9R82GKhAKTZGAWlE1c2CMz9M SqBZMzJ2SqBoJkR6c2ANEfcrwfSaCCVHO9ikwh93DP0OPzdGjPMbkQ2fhU01mgqMIXFD KDZ4TYRjtbEpy60XSlRu4MQorVmF3lF7ApzZ6ianDaxvY8MHooYwvehttFk3nUKqpAz2 XH3A== X-Gm-Message-State: ALoCoQlage9KZ13vfreMi6uYCur2n4y0cUaquiUW2u/OHgjSU63+9tV2F5H1iwoTVF8fFfzKLmAM X-Received: by 10.112.189.131 with SMTP id gi3mr13048218lbc.6.1434095173272; Fri, 12 Jun 2015 00:46:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.227 with SMTP id lf3ls539755lab.93.gmail; Fri, 12 Jun 2015 00:46:13 -0700 (PDT) X-Received: by 10.112.125.65 with SMTP id mo1mr175084lbb.0.1434095173077; Fri, 12 Jun 2015 00:46:13 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id c4si2746081lbd.9.2015.06.12.00.46.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 00:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagh7 with SMTP id h7so6307427lag.0 for ; Fri, 12 Jun 2015 00:46:13 -0700 (PDT) X-Received: by 10.112.182.4 with SMTP id ea4mr14070463lbc.35.1434095172885; Fri, 12 Jun 2015 00:46:12 -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 hn6csp353882lbb; Fri, 12 Jun 2015 00:46:11 -0700 (PDT) X-Received: by 10.70.132.195 with SMTP id ow3mr20834810pdb.87.1434095170234; Fri, 12 Jun 2015 00:46:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xs3si4203790pbb.215.2015.06.12.00.46.08; Fri, 12 Jun 2015 00:46:10 -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 S1753087AbbFLHqE (ORCPT + 29 others); Fri, 12 Jun 2015 03:46:04 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35558 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750893AbbFLHqB (ORCPT ); Fri, 12 Jun 2015 03:46:01 -0400 Received: by pdbnf5 with SMTP id nf5so19623343pdb.2 for ; Fri, 12 Jun 2015 00:46:00 -0700 (PDT) X-Received: by 10.70.92.193 with SMTP id co1mr20889343pdb.7.1434095160745; Fri, 12 Jun 2015 00:46:00 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id eu5sm2716130pac.37.2015.06.12.00.45.57 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 00:46:00 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, pang.xunlei@linaro.org, mingo@kernel.org, peterz@infradead.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH v5 04/24] time: Introduce do_sys_settimeofday64() Date: Fri, 12 Jun 2015 15:44:47 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: 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.45 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: , Due to the do_sys_settimeofday() with timespec type is not year 2038 safe on 32bit systems, and it should introduce the do_sys_settimeofday64() function with timespec64 type to make it is ready for 2038 issue. For removing the old do_sys_settimeofday() function with timespec type conveniently in future, it should move the do_sys_settimeofday() function to the timekeeping.h file as a 'static inline' helper that just calls do_sys_settimeofday64(). Signed-off-by: Baolin Wang --- include/linux/timekeeping.h | 11 +++++++++-- kernel/time/time.c | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index f886bdb..2dcc86b 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -11,8 +11,15 @@ 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 = 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 972e3bb..5aefe2d 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; @@ -186,7 +186,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; }