From patchwork Sun Oct 14 16:35:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 10640739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D376E13AD for ; Sun, 14 Oct 2018 16:36:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1A9628BFD for ; Sun, 14 Oct 2018 16:36:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5B6428C24; Sun, 14 Oct 2018 16:36:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5727328BFD for ; Sun, 14 Oct 2018 16:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbeJOARj (ORCPT ); Sun, 14 Oct 2018 20:17:39 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46664 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbeJOARj (ORCPT ); Sun, 14 Oct 2018 20:17:39 -0400 Received: by mail-qt1-f196.google.com with SMTP id d8-v6so18960355qtk.13 for ; Sun, 14 Oct 2018 09:36:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=1b++mrb5UUnJ8AFkOOZuub3+aRASo0AnfdDyTM+pYSY=; b=lXfoCA+4JEG5jFESg09MEmKEJcvutOmLwEKX5dH6BWX/JbQQaUjgTNUf5/k7BXNJMd hzDqRp6uDnG3NFxQWuK2RQ22YchN6vQ0GFjJD1aPRcI9b0KIk8ghID2yHG+eniVKVXVy Z49LaezVl39BpwZz3CjQCq+aE/a3bhfholTk+ODV8t4PABbcItO+gV+n3KnXceUWf7xB X8o9JXYpQQzPvNUZojc2HUDADDcUU7qZsbGU209a7dlYuh4jz1GOcLhKjSKIX7UiCYno jIsLIC4qpMEWS1dCp/oAt/Bw130/DdkcGGs3/DCs4fPiN+cGG+S+7DPCywHhfsLMg9PC OQlA== 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:mime-version :content-disposition:content-transfer-encoding; bh=1b++mrb5UUnJ8AFkOOZuub3+aRASo0AnfdDyTM+pYSY=; b=YZXWoZj2dnkpeQLKpyTZfuqWvyW0EqDPVjYUO35TGJ5uLsYP+i4xaxFiWh6nJoZIuv 7Pe6LzJxNX8YLsJksB0NeQ6ZUAbiWKRtOdWBjcL6DbYaUNFL4pm/74XfP8TE2Q5rAj6G SCU6airOi5YMIsVvejn3BLHDIsDJzldMyHCa18c749RU46EymA5Po6FzDl4WQslkt75s 5iBTCUwKq7lbGynIjlVPOooYNBFXoFErOea07X/T1ML7SmiMMY/NlrV4VigrwpdeovlZ w5QTaBy7fdXZhr7taB3H6Zf12GXO0T3BIL0ebWje8pSispy/JTupkHceeJKOnWA2s4GY KNlw== X-Gm-Message-State: ABuFfoh3EmvS1FHBrFxCZ69towvoxgD6n+h6umTIUPysreeaWdzkrgCd tUUVUp0TKGxKyan3cb5wwVFGwiiy X-Google-Smtp-Source: ACcGV62zOdaVuqVxgSLFDKw5n9+zWuzpwSf3LQc7iSAm7Az3IkJvg8d4ZoD9L+8nc0cpuZ5rMixI9A== X-Received: by 2002:aed:3fb9:: with SMTP id s54-v6mr12887213qth.208.1539534963640; Sun, 14 Oct 2018 09:36:03 -0700 (PDT) Received: from eaf ([181.47.179.0]) by smtp.gmail.com with ESMTPSA id v7-v6sm6082171qkl.39.2018.10.14.09.36.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Oct 2018 09:36:02 -0700 (PDT) Date: Sun, 14 Oct 2018 13:35:58 -0300 From: Ernesto =?utf-8?q?A=2E_Fern=C3=A1ndez?= To: linux-fsdevel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH] hfsplus: return file attributes on statx Message-ID: <20181014163558.sxorxlzjqccq2lpw@eaf> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The immutable, append-only and no-dump attributes can only be retrieved with an ioctl; implement the ->getattr() method to return them on statx. Do not return the inode birthtime yet, because the issue of how best to handle the post-2038 timestamps is still under discussion. This patch is needed to pass xfstests generic/424. Signed-off-by: Ernesto A. Fernández Reviewed-by: Vyacheslav Dubeyko --- fs/hfsplus/dir.c | 1 + fs/hfsplus/hfsplus_fs.h | 2 ++ fs/hfsplus/inode.c | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index f37662675c3a..29a9dcfbe81f 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -565,6 +565,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, .rename = hfsplus_rename, + .getattr = hfsplus_getattr, .listxattr = hfsplus_listxattr, }; diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index dd7ad9f13e3a..b8471bf05def 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -488,6 +488,8 @@ void hfsplus_inode_write_fork(struct inode *inode, struct hfsplus_fork_raw *fork); int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); int hfsplus_cat_write_inode(struct inode *inode); +int hfsplus_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int query_flags); int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index d7ab9d8c4b67..d131c8ea7eb6 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -270,6 +270,26 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) return 0; } +int hfsplus_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int query_flags) +{ + struct inode *inode = d_inode(path->dentry); + struct hfsplus_inode_info *hip = HFSPLUS_I(inode); + + if (inode->i_flags & S_APPEND) + stat->attributes |= STATX_ATTR_APPEND; + if (inode->i_flags & S_IMMUTABLE) + stat->attributes |= STATX_ATTR_IMMUTABLE; + if (hip->userflags & HFSPLUS_FLG_NODUMP) + stat->attributes |= STATX_ATTR_NODUMP; + + stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE | + STATX_ATTR_NODUMP; + + generic_fillattr(inode, stat); + return 0; +} + int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) { @@ -329,6 +349,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, static const struct inode_operations hfsplus_file_inode_operations = { .setattr = hfsplus_setattr, + .getattr = hfsplus_getattr, .listxattr = hfsplus_listxattr, };