From patchwork Wed Jul 15 05:51:49 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: 51114 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 6A2BF22A24 for ; Wed, 15 Jul 2015 05:53:13 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf7762765lbc.0 for ; Tue, 14 Jul 2015 22:53:12 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=zcwff1O67jrp4nwBVWVirpxzwGv+SgiXpj9KEPvlK7M=; b=OUIj4Ti6lW22141Fnu4XunKOaGW3kYbaG13Es/zOC1Hy/REq8HV6PtJT/G2Vb4wnoJ Rxb2M671ICZne3Du+Mc5ADmuSaroPEQn8UnNqKBh2jy5cLvNQxmsoCBCpepK2hn9wtCY dZtN8gdx408fGneu3MAfdyUihhYn23CO2yYfOr6WGAlKXj6xbAN5rahaaGmsBCHwMSKa ctOP9zEkht+lA7vdh3Y72eFlSfuF4AHa4UeaL7vc70ga60QMnCwyPURvrzazQ+Bm8CDL SLAAU6UZS2VzUgklJWHlfrI1JSkrEcqZbMdFDpj5Wsmp5vW99aUAiycLq795l/kpKbuO da9w== X-Gm-Message-State: ALoCoQnufFTg9NUf0A7Dkpuswcn+ILqYvtQ6e5H4iCNPp4VcieJR5InGDoZ6ciMbP8WbMXK97ZyJ X-Received: by 10.112.188.233 with SMTP id gd9mr1253012lbc.12.1436939592364; Tue, 14 Jul 2015 22:53:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.39 with SMTP id j7ls149962lam.21.gmail; Tue, 14 Jul 2015 22:53:12 -0700 (PDT) X-Received: by 10.112.97.145 with SMTP id ea17mr2248246lbb.49.1436939592117; Tue, 14 Jul 2015 22:53:12 -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 pt2si3029841lbb.46.2015.07.14.22.53.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2015 22:53:11 -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 lbbpo10 with SMTP id po10so18266831lbb.3 for ; Tue, 14 Jul 2015 22:53:11 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr2382379laf.32.1436939591837; Tue, 14 Jul 2015 22:53:11 -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 hn6csp2842599lbb; Tue, 14 Jul 2015 22:53:10 -0700 (PDT) X-Received: by 10.70.129.5 with SMTP id ns5mr4676466pdb.134.1436939590013; Tue, 14 Jul 2015 22:53:10 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si5666151pbw.36.2015.07.14.22.53.09; Tue, 14 Jul 2015 22:53:09 -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 S1751952AbbGOFxG (ORCPT + 26 others); Wed, 15 Jul 2015 01:53:06 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35551 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750772AbbGOFxF (ORCPT ); Wed, 15 Jul 2015 01:53:05 -0400 Received: by pactm7 with SMTP id tm7so18109304pac.2 for ; Tue, 14 Jul 2015 22:53:05 -0700 (PDT) X-Received: by 10.68.218.234 with SMTP id pj10mr4649264pbc.138.1436939584939; Tue, 14 Jul 2015 22:53:04 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id je4sm3250346pbb.17.2015.07.14.22.53.02 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jul 2015 22:53:04 -0700 (PDT) From: Baolin Wang To: tglx@linutronix.de Cc: arnd@arndb.de, john.stultz@linaro.org, pang.xunlei@linaro.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org, y2038@lists.linaro.org Subject: [PATCH 1/6] time: Introduce struct itimerspec64 Date: Wed, 15 Jul 2015 13:51:49 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 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.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: , The struct itimerspec is not year 2038 safe on 32bit systems due to the limitation of the struct timespec members. Introduce itimerspec64 which uses struct timespec64 instead and provide conversion functions. Signed-off-by: Baolin Wang --- include/linux/time64.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/linux/time64.h b/include/linux/time64.h index 77b5df2..367d5af 100644 --- a/include/linux/time64.h +++ b/include/linux/time64.h @@ -12,11 +12,18 @@ typedef __s64 time64_t; */ #if __BITS_PER_LONG == 64 # define timespec64 timespec +#define itimerspec64 itimerspec #else struct timespec64 { time64_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; + +struct itimerspec64 { + struct timespec64 it_interval; + struct timespec64 it_value; +}; + #endif /* Parameters used to convert the timespec values: */ @@ -45,6 +52,16 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) return ts; } +static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) +{ + return *its64; +} + +static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) +{ + return *its; +} + # define timespec64_equal timespec_equal # define timespec64_compare timespec_compare # define set_normalized_timespec64 set_normalized_timespec @@ -77,6 +94,24 @@ static inline struct timespec64 timespec_to_timespec64(const struct timespec ts) return ret; } +static inline struct itimerspec itimerspec64_to_itimerspec(struct itimerspec64 *its64) +{ + struct itimerspec ret; + + ret.it_interval = timespec64_to_timespec(its64->it_interval); + ret.it_value = timespec64_to_timespec(its64->it_value); + return ret; +} + +static inline struct itimerspec64 itimerspec_to_itimerspec64(struct itimerspec *its) +{ + struct itimerspec64 ret; + + ret.it_interval = timespec_to_timespec64(its->it_interval); + ret.it_value = timespec_to_timespec64(its->it_value); + return ret; +} + static inline int timespec64_equal(const struct timespec64 *a, const struct timespec64 *b) {