From patchwork Thu Apr 30 08:13:58 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: 47766 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1BD062121F for ; Thu, 30 Apr 2015 08:14:21 +0000 (UTC) Received: by wgin8 with SMTP id n8sf12836360wgi.0 for ; Thu, 30 Apr 2015 01:14:20 -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=IXvvjpGkgG8lWrhLEo75MwfMTso7yx/9bED/87Z301yFuRmAia83wl1pcsJFlyqzCP 52cPuc4KDRj8uFxCx8EYTb5RSJ4wAuyRCXHgz0JFUhoTtLwOoYNs3pZQ9MGS9V23fUIw JimMMlTeQV/Si2JT8AARE49zw4yJxXS/nooW0IcOplrXn+vL7K4i+uhFWDXJ8AIZ2IAK FchUGXVXuRQQModK+5nVibhTJNlfE8KGQcGwxhw+AW0ix+vtQQooGkX8f565f6vWNQl3 cf7OROMZDOptXAZpYo3h9gSaVZwy4Sj5e72d26+byQ/CElb0DNrGTdW2KHl9SYRhEHKk iDBg== X-Gm-Message-State: ALoCoQk8EhXnRNE7ctV6ZaROCXv9sZoE6hd+uC+dyMxvzfQARXFnuXpJ/pnfJIQuSyiLmePHqNRf X-Received: by 10.112.189.131 with SMTP id gi3mr1871856lbc.6.1430381660295; Thu, 30 Apr 2015 01:14:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.229 with SMTP id w5ls63909lag.44.gmail; Thu, 30 Apr 2015 01:14:20 -0700 (PDT) X-Received: by 10.112.225.43 with SMTP id rh11mr2748866lbc.90.1430381660043; Thu, 30 Apr 2015 01:14:20 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com. [209.85.217.171]) by mx.google.com with ESMTPS id wr10si1217000lbb.20.2015.04.30.01.14.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 01:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by lbbzk7 with SMTP id zk7so38684794lbb.0 for ; Thu, 30 Apr 2015 01:14:20 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr2752613lbc.19.1430381659944; Thu, 30 Apr 2015 01:14:19 -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.67.65 with SMTP id l1csp2965598lbt; Thu, 30 Apr 2015 01:14:19 -0700 (PDT) X-Received: by 10.70.42.13 with SMTP id j13mr6098127pdl.64.1430381658271; Thu, 30 Apr 2015 01:14:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo3si2433388pbb.48.2015.04.30.01.14.17; Thu, 30 Apr 2015 01:14:18 -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 S1751564AbbD3ION (ORCPT + 28 others); Thu, 30 Apr 2015 04:14:13 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:35206 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbbD3IOM (ORCPT ); Thu, 30 Apr 2015 04:14:12 -0400 Received: by pdbqd1 with SMTP id qd1so53575683pdb.2 for ; Thu, 30 Apr 2015 01:14:11 -0700 (PDT) X-Received: by 10.68.210.46 with SMTP id mr14mr5908928pbc.73.1430381651581; Thu, 30 Apr 2015 01:14:11 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([114.30.40.58]) by mx.google.com with ESMTPSA id mt11sm1383352pbc.20.2015.04.30.01.14.07 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Apr 2015 01:14:10 -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 v2 07/15] time:Introduce the do_sys_settimeofday64() function with timespec64 type Date: Thu, 30 Apr 2015 16:13:58 +0800 Message-Id: <1430381638-26463-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.171 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; }