From patchwork Fri Jun 12 07:27:27 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: 49785 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CDB0B228DB for ; Fri, 12 Jun 2015 07:28:54 +0000 (UTC) Received: by laboh3 with SMTP id oh3sf8312765lab.0 for ; Fri, 12 Jun 2015 00:28:53 -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=M0soHSF9Ukl/UTxcq8Lr/7F89pm6ShJVb+qYT2lg3b4=; b=bUqAuiDh5YNRAs16Kr1bOU67xTOAUOAlJ6nbzz99kAE9KpImjg0Q8utnUrmeKr1J++ 3ZTd4+p9DLSMVg7iH5+j22LYFn1G2qNhdcKrPPPctGHfvkbhBV6J7C23tABKS/nBLh9i EXPHEY5gLZZw/oH6dU3Q79GydVASLzYVR4kjFjsxQGJAWn/w4vJ4wzz5INAJc0KyYLuF PzRpLqu6GbSzLIinEfTOXshcJlLcTcSNq/+YQPaRWNH4G88piWUIfh+kbgC/3WQy4xR0 iVqYpqXnL3ACj7UeKLRf+8tW0uGGpINabfXjZVa6LlNsyNa8ZnzChZeP/Z2QUysCj/Cu LLwA== X-Gm-Message-State: ALoCoQmplrIk8QeWs5tvw7Ff8XRfODWTIn9Etw1F+cnXvzApCfqKqSBncE5iKgrL22PRrxNYGEok X-Received: by 10.112.26.5 with SMTP id h5mr12974113lbg.4.1434094133759; Fri, 12 Jun 2015 00:28:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.7.67 with SMTP id da3ls598134lad.49.gmail; Fri, 12 Jun 2015 00:28:53 -0700 (PDT) X-Received: by 10.152.37.102 with SMTP id x6mr3384578laj.69.1434094133581; Fri, 12 Jun 2015 00:28:53 -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 qq9si2670736lbc.143.2015.06.12.00.28.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 00:28:53 -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 mx3so15117845lbc.1 for ; Fri, 12 Jun 2015 00:28:53 -0700 (PDT) X-Received: by 10.112.222.133 with SMTP id qm5mr13812731lbc.86.1434094133375; Fri, 12 Jun 2015 00:28:53 -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 hn6csp345464lbb; Fri, 12 Jun 2015 00:28:52 -0700 (PDT) X-Received: by 10.70.102.132 with SMTP id fo4mr21103063pdb.31.1434094131630; Fri, 12 Jun 2015 00:28:51 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gq8si4197442pbc.83.2015.06.12.00.28.50; Fri, 12 Jun 2015 00:28:51 -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 S932089AbbFLH2q (ORCPT + 29 others); Fri, 12 Jun 2015 03:28:46 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:34660 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751846AbbFLH2p (ORCPT ); Fri, 12 Jun 2015 03:28:45 -0400 Received: by payr10 with SMTP id r10so17934969pay.1 for ; Fri, 12 Jun 2015 00:28:44 -0700 (PDT) X-Received: by 10.66.255.67 with SMTP id ao3mr20927251pad.60.1434094124664; Fri, 12 Jun 2015 00:28:44 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by mx.google.com with ESMTPSA id ux6sm2670284pab.24.2015.06.12.00.28.42 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jun 2015 00:28:44 -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 v5 01/24] time: Introduce struct itimerspec64 Date: Fri, 12 Jun 2015 15:27:27 +0800 Message-Id: <373af492fd0f6dde03eb01d5b80f324f015e14bf.1434079262.git.baolin.wang@linaro.org> 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.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 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 12d4e82..132062b 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: */ @@ -44,6 +51,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 @@ -76,6 +93,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) {