Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17237721ybl; Thu, 2 Jan 2020 01:20:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzi1pOmgdTBwgM3ZnWL6xNdzvHvyofj7CKA7x8BrcJ33NPv2PaSny1/MVpgfIGPfIih2HYn X-Received: by 2002:a05:6830:1047:: with SMTP id b7mr94135294otp.77.1577956818166; Thu, 02 Jan 2020 01:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577956818; cv=none; d=google.com; s=arc-20160816; b=aL3/tFYT8QElLDa/zKMcKJ/Jw2i7RFIOsFCKXd5pR49JYjzmfBoQeX1SBRK4GVVbcl v1NpswxtDjuetVVzVhyqrIJeVyAnb8Mx3ZeiopOXYo++CTVSiu17UU64ymYUO2ys/2rH IieXDnQ0N1nLm0w2QlCqQEfBXAQ1+er0grm7J+/78hej7E1Oz+8APC7Xi+bh5IK4W/N3 nPKeJiT0uCsfygHftd4+r6f4Eq0qOSnDLnCytKXp8KUrxJ61fJ+wmeq4QqkochfG/azo ZyUA8DfK5+K40le0PWKV5FLvmHrCcx56SZqPYYGzlWCEALU65i3nyJc1uyib3dsBAoRT PWww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dWNZKKTfhWgqpNzUjWdosrjzGH7DY1lOFlWq07DjZ+4=; b=b+iVzmbYiK7mtLQWt/CMpQngVJy04C9KdCHEWlx95l6xnwQ+38l9D/CMXwI9xAuqba zQ0OCE8heH57C+0LBdrqe6JQhDMOYgxJHc4oXda6iFmk5rqfE5OwCuN3zgC0LvgywGPL Q/uue/wOGvHzbn9nbfOfcdOLbk+gzS5RQOrD2surwruAg6deWciluYeX/QnGhWa/dAPu ZcvLjKZhQRc3M1beTw5ykDCpR7fFZX4F0WUTpxYa/1P3im6OovsurgEC8jycFmSvzNe6 Bn0M1AJ/8UFWpXSCrEB3DmuRNWuj8lKQq70/islz6YMl/e+7N3+baTXRmOAO3iqeCQ35 8qzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ky5Nx8hF; 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 f190si26184847oig.229.2020.01.02.01.20.06; Thu, 02 Jan 2020 01:20:18 -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=ky5Nx8hF; 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 S1727935AbgABJTG (ORCPT + 99 others); Thu, 2 Jan 2020 04:19:06 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38318 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727897AbgABJTG (ORCPT ); Thu, 2 Jan 2020 04:19:06 -0500 Received: by mail-wm1-f67.google.com with SMTP id u2so5049603wmc.3; Thu, 02 Jan 2020 01:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dWNZKKTfhWgqpNzUjWdosrjzGH7DY1lOFlWq07DjZ+4=; b=ky5Nx8hFeyeWA3d+L8RGv0QV+ipVrbqtp1d4rRFv1v6obMoP1UqvWU5QWSqtEFxPCB /Y7b/bCs+th98Qb7IvNajCMoaCAT/T73lUts/cmlGzZh3fq5X9yw7EGc7ipxkP/Wdk/A mvxDDYJkRJdVXFDlVTBHD4VXVDfcdy1KRHvTUazW8+R1EjdTniu3iV9tpgwGiTUwo9zk fq4lXOWKzdDJBTqyVbgaYOXQM++0Kj0fegHtndSn3RTiPrZxBj6XLcO4o2S45UWMChLI MAFun2ahgD3MlBALqi4bmtg6YeOsLgCfhYv7OlcSuhdYl89WqMS8xEPbX9xUNiOULkev 3I2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=dWNZKKTfhWgqpNzUjWdosrjzGH7DY1lOFlWq07DjZ+4=; b=TYEZoVGlc9/el2JcqFg6AqlBUQCa/t8k4aa1U0dtsu0BN040hjapbx6LvLQuLkFy2G kn7gLuhea/OgoUdfajK8Qktd25rCOfhYD8dHw/ARcA1iAFNW5fuwbIAZutZEJmnN4qUj C/RmEyUyuaGzYmc0NIC6dpD75KXrB2nHhXEBvfLit5uj8Pq/onGICp/FBDwzuaf88EVj whmtZ2q1OJ91BgD4Hw2HM92ofH+cfpeZVhNYXy13XronCfwUQTock5M8cv3yD0OGksVD d1p6XVZkMUj8RZPLFol01CuHjGYLvhQJ6InDVhWzcZMMQRpX/h154kkozq/BWPWDvFLf V1DQ== X-Gm-Message-State: APjAAAUY60w6YGEbi/UjKV8Eb4vJpyU+LcA6hnIlx1Epdmg30GeYy/xh HbKaFJdlNoWsaWX/ABS6v9M= X-Received: by 2002:a1c:c919:: with SMTP id f25mr13301843wmb.49.1577956744098; Thu, 02 Jan 2020 01:19:04 -0800 (PST) Received: from pali ([2a02:2b88:2:1::5cc6:2f]) by smtp.gmail.com with ESMTPSA id x18sm55457022wrr.75.2020.01.02.01.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2020 01:19:03 -0800 (PST) Date: Thu, 2 Jan 2020 10:19:02 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Namjae Jeon Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, gregkh@linuxfoundation.org, valdis.kletnieks@vt.edu, hch@lst.de, sj1557.seo@samsung.com, linkinjeon@gmail.com Subject: Re: [PATCH v9 09/13] exfat: add misc operations Message-ID: <20200102091902.tk374bxohvj33prz@pali> References: <20200102082036.29643-1-namjae.jeon@samsung.com> <20200102082036.29643-10-namjae.jeon@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200102082036.29643-10-namjae.jeon@samsung.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 == 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 = 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. > + > + /* Treats as local time with proper time */ > + second -= sys_tz.tz_minuteswest * SECS_PER_MIN; > + tp->timezone.valid = 1; > + tp->timezone.off = TIMEZONE_CUR_OFFSET(); > + > + /* Jan 1 GMT 00:00:00 1980. But what about another time zone? */ > + if (second < UNIX_SECS_1980) { > + tp->second = 0; > + tp->minute = 0; > + tp->hour = 0; > + tp->day = 1; > + tp->month = 1; > + tp->year = 0; > + return; > + } > + > + if (second >= UNIX_SECS_2108) { Hello, this code cause compile errors on 32bit systems as UNIX_SECS_2108 macro is not defined when BITS_PER_LONG == 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) #define UNIX_SECS_2108 4354819200LL > + tp->second = 59; > + tp->minute = 59; > + tp->hour = 23; > + tp->day = 31; > + tp->month = 12; > + tp->year = 127; > + return; > + } -- Pali Rohár pali.rohar@gmail.com