Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17336330ybl; Thu, 2 Jan 2020 03:31:24 -0800 (PST) X-Google-Smtp-Source: APXvYqz2WNSWV+3HptKSz9fDXGWwuGLW5L6TAo8Q+6MAal04gGEaZ9vZFhtdEpGVqE0h9/BZPK+X X-Received: by 2002:a9d:6857:: with SMTP id c23mr75682370oto.351.1577964684452; Thu, 02 Jan 2020 03:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577964684; cv=none; d=google.com; s=arc-20160816; b=Gb63VQ5rcLjXwl5DIt5417y8IcRd6LbpBgxPSHFCNDB4D17uD4XOr9Srg2OyMpxS0F 05kiQMA/2SGm3W2qf/QKXJ3E8dr97c0C3NxQ5k7MOZnC0qrOa+IP9l+w0vP0a11I5CbK JC6m7gCQCCmZ8V997UjpaiS+QpxfHfNM4Z7QjnpwnhvahUM1CHf8w68ojF0CIq4WZ9wo +tFHp0Bj4kkCUdvHZv/sBBwUWDrHchx0TBeIoRH9u8EyFekSd123fA/eDZnq/01LnkLg E2WnWjxnnoB0ntXw2Owh1qOWDfcoKAxBCoqCZ0CbCP77iXP4IoQuelajG2Yw+sx+jZ+N bQfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature; bh=zsUL2C0WaaJc/RKLuim/CUrfNo1Iw2tHL4HfNNGKlGQ=; b=Ptsa+RXe2LWrerR9uVS3cd9v7jqlBtUPBfwYMYzUf4p8X+iFBI9ihaqgeXTan8Q7iA Vg8109Y1EKq9tl4PafMcVvviSKYRRGNtmFYK5FrxEJPTwppcSZIZ+zRRceW+2ybO7BaL w+JV/m6BYgPdu3boSAu+/8jiym6ilmZOQO/mRjjHdGYi3enGQNJbj5VUiCmyGHH4HytS BGhqHsWkEKudtauQbcheaNXaPUXhlftRO5GB5zgKdKZeigqClJiBCdj5AHlz6XEQzR9q bbpDmJw7e/Zx3MEalzTmtmnmfO1T5GeTGgZG0ZbDasoHaB6lHYO5ZdvfUBNUMHtuBJiP /48w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DI7nFGHO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q72si25142683oic.18.2020.01.02.03.31.12; Thu, 02 Jan 2020 03:31:24 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DI7nFGHO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728240AbgABLaE (ORCPT + 99 others); Thu, 2 Jan 2020 06:30:04 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:37954 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728135AbgABLaE (ORCPT ); Thu, 2 Jan 2020 06:30:04 -0500 Received: by mail-ot1-f68.google.com with SMTP id d7so52245302otf.5; Thu, 02 Jan 2020 03:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zsUL2C0WaaJc/RKLuim/CUrfNo1Iw2tHL4HfNNGKlGQ=; b=DI7nFGHOQf6wsy/Ujxwg6jXNd66N92P1l1ay1EWZ94nVNSjECeIyLwYQNIXYdkY89M plyTW9zXm+f2WPmwzN6KUAA12p+gE/HlMPEprAEBHpJOsGCGWq6ntnjEZnyK4C/6bfaG fl/sjOVHJ+xEp0o4CT0+Frs67gBY9HcZp26dhjexvxnnCTfGtaDkpXj4wOmSvo64Q7J6 9m053YlV9MpzdJDaC107jepOpSYCa28GcJuG+tbiMpfdC2By/a75ieQKKL9/BLTHiVn7 emjN7zuXQuOnNEgY4p5LTbIUWb1PpHjgV7DuxtOee7o9EgPWe6DSregQUHPIb+X9N5RB VC+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zsUL2C0WaaJc/RKLuim/CUrfNo1Iw2tHL4HfNNGKlGQ=; b=fIfExfR3Yyq7Iofp5VVRXBGafuJrvieoCSGHqs+Yvh29jKxuN2nLuPEZu1KnyuDrfm mQ2SyqU5QPbdxNoSJ+HCoPoL8q5v71Hhtc3s7Rek2QYb9JSMopfrnZVXp/Ar1kpsUztS OpAH+HGa/3HohLIa9kpPANIdi3DjzWAalQ2e3X8L7l4OZQ/DGkoYVwczjvLv/J0ULi4n tLY311fR30wFVpLgE2F3hep5HYwLppC2BgV3drFw3XANHlF7c1ViVQlOVVuUcGeVQE+R ZleDYYmkX4kwsMor8333uIvnINGd4Iz5LNIz0mD3ZjlySSwRpDJ/se2SFLKdEQY/wkMP 6kUg== X-Gm-Message-State: APjAAAUx/nkPJ69v6iyLssJM3wgYr2Kag/X9cAjacsv9D5sZXRCw6Vy8 5zzkDDLyvEmwXUcbSSoAsm7Nhd9NT1nWrulF9FU= X-Received: by 2002:a05:6830:1141:: with SMTP id x1mr17726618otq.120.1577964603627; Thu, 02 Jan 2020 03:30:03 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a8a:87:0:0:0:0:0 with HTTP; Thu, 2 Jan 2020 03:30:03 -0800 (PST) In-Reply-To: <20200102091902.tk374bxohvj33prz@pali> References: <20200102082036.29643-1-namjae.jeon@samsung.com> <20200102082036.29643-10-namjae.jeon@samsung.com> <20200102091902.tk374bxohvj33prz@pali> From: Namjae Jeon Date: Thu, 2 Jan 2020 20:30:03 +0900 Message-ID: Subject: Re: [PATCH v9 09/13] exfat: add misc operations To: =?UTF-8?Q?Pali_Roh=C3=A1r?= Cc: Namjae Jeon , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, gregkh@linuxfoundation.org, valdis.kletnieks@vt.edu, hch@lst.de, sj1557.seo@samsung.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2020-01-02 18:19 GMT+09:00, Pali Roh=C3=A1r : > On Thursday 02 January 2020 16:20:32 Namjae Jeon wrote: >> This adds the implementation of misc operations for exfat. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Sungjong Seo >> --- >> fs/exfat/misc.c | 253 ++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 253 insertions(+) >> create mode 100644 fs/exfat/misc.c >> >> diff --git a/fs/exfat/misc.c b/fs/exfat/misc.c >> new file mode 100644 >> index 000000000000..7f533bcb3b3f >> --- /dev/null >> +++ b/fs/exfat/misc.c > > ... > >> +/* externs sys_tz >> + * extern struct timezone sys_tz; >> + */ >> +#define UNIX_SECS_1980 315532800L >> + >> +#if BITS_PER_LONG =3D=3D 64 >> +#define UNIX_SECS_2108 4354819200L >> +#endif > > ... > >> +#define TIMEZONE_CUR_OFFSET() ((sys_tz.tz_minuteswest / (-15)) & 0x7F) >> +/* Convert linear UNIX date to a FAT time/date pair. */ >> +void exfat_time_unix2fat(struct exfat_sb_info *sbi, struct timespec64 >> *ts, >> + struct exfat_date_time *tp) >> +{ >> + time_t second =3D ts->tv_sec; >> + time_t day, month, year; >> + time_t ld; /* leap day */ > > Question for other maintainers: Has kernel code already time_t defined > as 64bit? Or it is still just 32bit and 32bit systems and some time64_t > needs to be used? I remember that there was discussion about these > problems, but do not know if it was changed/fixed or not... Just a > pointer for possible Y2038 problem. As "ts" is of type timespec64, but > "second" of type time_t. My bad, I will change it with time64_t. > >> + >> + /* Treats as local time with proper time */ >> + second -=3D sys_tz.tz_minuteswest * SECS_PER_MIN; >> + tp->timezone.valid =3D 1; >> + tp->timezone.off =3D TIMEZONE_CUR_OFFSET(); >> + >> + /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ >> + if (second < UNIX_SECS_1980) { >> + tp->second =3D 0; >> + tp->minute =3D 0; >> + tp->hour =3D 0; >> + tp->day =3D 1; >> + tp->month =3D 1; >> + tp->year =3D 0; >> + return; >> + } >> + >> + if (second >=3D UNIX_SECS_2108) { > > Hello, this code cause compile errors on 32bit systems as UNIX_SECS_2108 > macro is not defined when BITS_PER_LONG =3D=3D 32. > > Value 4354819200 really cannot fit into 32bit signed integer, so you > should use 64bit signed integer. I would suggest to define this macro > value via LL not just L suffix (and it would work on both 32 and 64bit) Okay. > > #define UNIX_SECS_2108 4354819200LL > >> + tp->second =3D 59; >> + tp->minute =3D 59; >> + tp->hour =3D 23; >> + tp->day =3D 31; >> + tp->month =3D 12; >> + tp->year =3D 127; >> + return; >> + } Okay, I will check it. Thanks for your review! > > -- > Pali Roh=C3=A1r > pali.rohar@gmail.com >