From patchwork Wed Jul 29 11:58:15 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: 51656 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id A776B214B7 for ; Wed, 29 Jul 2015 11:59:40 +0000 (UTC) Received: by wicmm11 with SMTP id mm11sf6259875wic.3 for ; Wed, 29 Jul 2015 04:59:39 -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=kALyY687+oBe6/zKj4kRPptaoz7qyvyYL3Ls7b1bjdecmX+cs8jubiJhOy1AV0UbPX 2By9KmBFkB++ofw5JNukwMNAh8QuqWIV9KzA7yYAx/jtd1yMIk7HKDS5xjCCcNKXIyww rkk2m/wltXaxXL390/2jeycakMFZ7U9rKks5x8Mvm5MLf7W8W32UfrFjMZ1QCMT/bn45 ga1xNI56b/nAGY/EXsDtpp5uZ8CIIGUk/UX8iIuwBtzdmL0LWUm0ngZPdLYlSaXxjS5a 3y+8GzQa+YE7XAbrzGsYtC1k/t5IdxZW0SV1Fl+9RYLKsofnTlJHWu6ERsaZguYv2uCl PK0g== X-Gm-Message-State: ALoCoQmEWs6H8CFRJuQThiNqwLS7yK4sbN6r5ID2OBMER27vK0JUgU3guxW4Kuck5BdzKiNdHYmZ X-Received: by 10.152.1.105 with SMTP id 9mr15785636lal.3.1438171179888; Wed, 29 Jul 2015 04:59:39 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.185.67 with SMTP id fa3ls30852lac.76.gmail; Wed, 29 Jul 2015 04:59:39 -0700 (PDT) X-Received: by 10.152.3.70 with SMTP id a6mr38186960laa.44.1438171179450; Wed, 29 Jul 2015 04:59:39 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id lv6si14471074lac.57.2015.07.29.04.59.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 04:59:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lblf12 with SMTP id f12so5256823lbl.2 for ; Wed, 29 Jul 2015 04:59:39 -0700 (PDT) X-Received: by 10.112.133.72 with SMTP id pa8mr38120337lbb.117.1438171179359; Wed, 29 Jul 2015 04:59:39 -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.7.198 with SMTP id l6csp2709475lba; Wed, 29 Jul 2015 04:59:38 -0700 (PDT) X-Received: by 10.50.87.74 with SMTP id v10mr836978igz.37.1438171177660; Wed, 29 Jul 2015 04:59:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qh9si61219297pdb.159.2015.07.29.04.59.36; Wed, 29 Jul 2015 04:59:37 -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 S1752481AbbG2L7f (ORCPT + 27 others); Wed, 29 Jul 2015 07:59:35 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:34386 "EHLO mail-pd0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbbG2L7d (ORCPT ); Wed, 29 Jul 2015 07:59:33 -0400 Received: by pdbbh15 with SMTP id bh15so4924827pdb.1 for ; Wed, 29 Jul 2015 04:59:33 -0700 (PDT) X-Received: by 10.70.128.101 with SMTP id nn5mr93476169pdb.56.1438171173440; Wed, 29 Jul 2015 04:59:33 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id cq5sm40638130pad.11.2015.07.29.04.59.29 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Jul 2015 04:59:32 -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 v2 1/5] time: Introduce struct itimerspec64 Date: Wed, 29 Jul 2015 19:58:15 +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.170 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) {