From patchwork Sun Dec 13 09:48:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deng Chao X-Patchwork-Id: 58319 Delivered-To: patch@linaro.org Received: by 10.112.73.68 with SMTP id j4csp857355lbv; Sun, 13 Dec 2015 01:49:35 -0800 (PST) X-Received: by 10.98.19.141 with SMTP id 13mr18385544pft.47.1450000175567; Sun, 13 Dec 2015 01:49:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u79si8294960pfa.82.2015.12.13.01.49.35; Sun, 13 Dec 2015 01:49:35 -0800 (PST) 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; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbbLMJtd (ORCPT + 28 others); Sun, 13 Dec 2015 04:49:33 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34519 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751523AbbLMJt2 (ORCPT ); Sun, 13 Dec 2015 04:49:28 -0500 Received: by pfbo64 with SMTP id o64so11230780pfb.1 for ; Sun, 13 Dec 2015 01:49:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=vddmUFDSixJgCxV+mmzCyC5OrVS9KTxCAykX1rEi/oQ=; b=Je8so10iHld8FfiowNQdLEMjCroVv+QRsISY1A3OrOPtkd9ivAuMG+Zo842Lo2MNAK TwjKk7mBBi5eaHe80kXYornuud8EUHeAjhmBADNBbMnYaUWsmMdhGFhLL9f/qE31w/+3 xSseL43YwlszAogEFpFNWVqrc7h7qZ34Ti6VxmfKMNcMIVnf10GNeW/0nrsARvSgH3bR spkvQXkPqqntnHAPuajSA7mZF1vQgFZHvhpxUjZ3zW8VFBoAjIX5IBOkmZMCzA0rFg0f UUma3maudymujbmWt2cO7JUGIY373imkVqqaVV4ztXztbkv+/AqfuCzCUeViJgzcLcwF mgZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vddmUFDSixJgCxV+mmzCyC5OrVS9KTxCAykX1rEi/oQ=; b=klIM95uNu14LETTTPbD1SOtt1dtBMAkf9Gv0W49hG2A6NITwwJFcB6Ex1NJO/FAxtI IXdqZlg9S6/Hti0/a/XfQCq+OL2qnSO5feicbKrpfU30+PAyKfBVP6EUP91C/tEEjwYF M8Ki9Ojm/nzV1Z22rBoMuHU7+27xOAMO1JuUExD9mWG/bo5sLVCml321TL8EhiXgh8VG z0f2VrJ+gJGhzSIii1fh3NUXQdyhMLlMKVEXunKJ+NPWR4xHcRnd+ttJqSip/CWPWmOd U6JjIYNO6Su7heuEE924ze9Pi9GAn1zW6w0h6vIlBEEinYUCtluAzYf+oGvxJkSB9jZZ aC1Q== X-Gm-Message-State: ALoCoQkT2rh0hKPbZf+4BA35kBmy+UbeD7sbmdeZ3jRzdSMw0GYc7RLGbmX6Lz1uJWvZeYn0oGl2xcD6osKe+TdHc9exJNZbLQ== X-Received: by 10.98.1.75 with SMTP id 72mr27879783pfb.14.1450000167431; Sun, 13 Dec 2015 01:49:27 -0800 (PST) Received: from localhost.localdomain ([167.160.116.42]) by smtp.gmail.com with ESMTPSA id v64sm35401435pfi.50.2015.12.13.01.49.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 Dec 2015 01:49:26 -0800 (PST) From: DengChao To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: chao.deng@linaro.org Subject: [PATCH] fs:affs:Replace time_t with time64_t Date: Sun, 13 Dec 2015 17:48:44 +0800 Message-Id: <1450000124-3885-1-git-send-email-chao.deng@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The affs code uses "time_t" and "get_seconds()". This will cause problems on 32-bit architectures in 2038 when time_t overflows. This patch replaces them with "time64_t" and "ktime_get_real_seconds()". Reviewed-by: Arnd Bergmann Signed-off-by: DengChao --- fs/affs/affs.h | 2 +- fs/affs/amigaffs.c | 13 +++++++------ fs/affs/super.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/fs/affs/affs.h b/fs/affs/affs.h index c69a87e..cc2b2ef 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h @@ -138,7 +138,7 @@ extern int affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh); extern int affs_remove_header(struct dentry *dentry); extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh); extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh); -extern void secs_to_datestamp(time_t secs, struct affs_date *ds); +extern void secs_to_datestamp(time64_t secs, struct affs_date *ds); extern umode_t prot_to_mode(u32 prot); extern void mode_to_prot(struct inode *inode); __printf(3, 4) diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index 5fa92bc..d6c7a51 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c @@ -8,6 +8,7 @@ * Please send bug reports to: hjw@zvw.de */ +#include #include "affs.h" /* @@ -366,22 +367,22 @@ affs_fix_checksum(struct super_block *sb, struct buffer_head *bh) } void -secs_to_datestamp(time_t secs, struct affs_date *ds) +secs_to_datestamp(time64_t secs, struct affs_date *ds) { u32 days; u32 minute; + s32 rem; secs -= sys_tz.tz_minuteswest * 60 + ((8 * 365 + 2) * 24 * 60 * 60); if (secs < 0) secs = 0; - days = secs / 86400; - secs -= days * 86400; - minute = secs / 60; - secs -= minute * 60; + days = div_s64_rem(secs, 86400, &rem); + minute = rem / 60; + rem -= minute * 60; ds->days = cpu_to_be32(days); ds->mins = cpu_to_be32(minute); - ds->ticks = cpu_to_be32(secs * 50); + ds->ticks = cpu_to_be32(rem * 50); } umode_t diff --git a/fs/affs/super.c b/fs/affs/super.c index 5b50c4c..8836df5 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -32,7 +32,7 @@ affs_commit_super(struct super_block *sb, int wait) struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh); lock_buffer(bh); - secs_to_datestamp(get_seconds(), &tail->disk_change); + secs_to_datestamp(ktime_get_real_seconds(), &tail->disk_change); affs_fix_checksum(sb, bh); unlock_buffer(bh);