From patchwork Mon Aug 17 20:40:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 52481 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 977C52156D for ; Mon, 17 Aug 2015 20:41:28 +0000 (UTC) Received: by wicul11 with SMTP id ul11sf29293050wic.1 for ; Mon, 17 Aug 2015 13:41:27 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=UhR24AtM0MvU5/9fHE/G9XBbf8BjxADikpSDITtByF0=; b=dB40hRvysyDi7YHUDEEmt3VLMqdBPMYpKZQFriDhB/wdPfRBejFDJigRrOghY2+nfQ SYScoRsXCjeheBLBUtr7Wk8lmODMj3guW9bcLrrV1e6mQNmdo3VJyrK8knKEkFvsY9HE ceAh0derkp9kul9tfAQehgBizZOHHVYf01bzdeOagqF6wf9lzIHHK68mgODGG7yUq4Ut n6hMPSa62ctt/EMBKIZ0iSobk9KjAjSpzSN4wSNdOP6VeXTYzpsSkSnRh3c5RNzBcrRm PgjyiTxB7+3XQUztw8O/VUnBhVk+dQ/2LJXTzmmy4uNa27hfynGPJQHgxzpuSxch/0Gq O+PQ== X-Gm-Message-State: ALoCoQnDbXb14wEXqPKYIJsmGOhR43D6lBuXrKEX0Vo5XJfazrqIvtsuGh/qcowEjTrRTjrCkj0M X-Received: by 10.112.138.2 with SMTP id qm2mr794381lbb.19.1439844087813; Mon, 17 Aug 2015 13:41:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.70 with SMTP id y6ls628452lay.55.gmail; Mon, 17 Aug 2015 13:41:27 -0700 (PDT) X-Received: by 10.152.6.194 with SMTP id d2mr2576719laa.93.1439844087655; Mon, 17 Aug 2015 13:41:27 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id kn15si12374708lbb.85.2015.08.17.13.41.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 13:41:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by lagz9 with SMTP id z9so86828755lag.3 for ; Mon, 17 Aug 2015 13:41:27 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr2738835lbc.32.1439844087563; Mon, 17 Aug 2015 13:41:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.162.200 with SMTP id yc8csp85959lbb; Mon, 17 Aug 2015 13:41:26 -0700 (PDT) X-Received: by 10.70.92.47 with SMTP id cj15mr5972383pdb.37.1439844075685; Mon, 17 Aug 2015 13:41:15 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com. [209.85.220.50]) by mx.google.com with ESMTPS id j10si26325601pdp.182.2015.08.17.13.41.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Aug 2015 13:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.50 as permitted sender) client-ip=209.85.220.50; Received: by paccq16 with SMTP id cq16so72047396pac.1 for ; Mon, 17 Aug 2015 13:41:14 -0700 (PDT) X-Received: by 10.66.66.99 with SMTP id e3mr5753237pat.3.1439844074781; Mon, 17 Aug 2015 13:41:14 -0700 (PDT) Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id gu2sm85199pbc.1.2015.08.17.13.41.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Aug 2015 13:41:13 -0700 (PDT) From: John Stultz To: lkml Cc: Baolin Wang , Prarit Bhargava , Richard Cochran , Ingo Molnar , Thomas Gleixner , John Stultz Subject: [PATCH 5/9] time: Introduce struct itimerspec64 Date: Mon, 17 Aug 2015 13:40:59 -0700 Message-Id: <1439844063-7957-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439844063-7957-1-git-send-email-john.stultz@linaro.org> References: <1439844063-7957-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@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.49 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Baolin Wang 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. Cc: Prarit Bhargava Cc: Richard Cochran Cc: Ingo Molnar Cc: Thomas Gleixner Signed-off-by: Baolin Wang Signed-off-by: John Stultz --- 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) {