From patchwork Wed Jun 6 09:38:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ritesh Harjani X-Patchwork-Id: 925785 X-Patchwork-Delegate: david.oberhollenzer@sigma-star.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="s+ALza7o"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="fyMLFhjq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="glrSTAvS"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4113Y60DKjzB3h4 for ; Wed, 6 Jun 2018 19:39:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mDFEXQu7bBNgcSwd0SxRo/tzrrFV1goW5W6fFBsiGvs=; b=s+ALza7o0HfgTnyljJM06TCiXr og2teB6KrWjr1yH2GAr6ZevVNH1OTMwAdFloEjBCv+xpLdx/uF/menogNIx9Nxrve8pUYXCyQgoCn 34Sdzzus5/re0ldKTQLJO+EAVKb9nb4wUrFOMk4gdMqjbkyTom6uioTI9ItMQQ6S3vgghUmzyE+Mq 9CRhF8VEztlT1JoStj9ftKJxP8/3SQNr94YNldSOvFegKnZ5v+lTd6hjW0bLJqfYMvXGfXZ6mloE1 +kL17l0wYw2a/NSAEP0Zs7VTacOFXT58Hdto/za1ziXVY+j9k4h0ESFlwF/kwNzGkt/AexONSuAJ6 d+aZLlCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQUuf-0007m7-IT; Wed, 06 Jun 2018 09:39:29 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQUuc-0007kh-4A for linux-mtd@lists.infradead.org; Wed, 06 Jun 2018 09:39:27 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 18F8360555; Wed, 6 Jun 2018 09:39:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528277955; bh=qBwSIxatHDY23pFKHhWsAnQPeGGmStSNXHqZ5MIIF9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyMLFhjqhAufZzAeoGbeHzmQ2fDpxgEjKukOo8vSd/zylu8Kw/cK0N7lekw5IU/Ap hBnff+CwiEvqouFuTSdskj6PhjeZQHte0C6Zd3IkMObFTpQwj9LJ0Umk8BespFNAoI nOOdhpX87ZfEw+4j38v/7WE9uDToUFpOiPtk3kpY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from rharjani-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: riteshh@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 55DD960555; Wed, 6 Jun 2018 09:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528277953; bh=qBwSIxatHDY23pFKHhWsAnQPeGGmStSNXHqZ5MIIF9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glrSTAvSapouGSiGlZpvBAEducUng2qqxfokRMlN+lB949aMt6UruEWuaymG6D1wv 3cX8PYIe6PiHUZl7RhAcNlVqStU9VgAG9FAeJntMTtFvV1IAwTnfPdYkrm1UunDX+3 lhRUbN8vNrUpPbu1htEucCzpojdTQKYnykSaTSFk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 55DD960555 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=riteshh@codeaurora.org From: Ritesh Harjani To: linux-mtd@lists.infradead.org, richard@nod.at, david.oberhollenzer@sigma-star.at Subject: [RFC PATCH 1/2] mkfs.ubifs: add_xattr is not depending on host XATTR support Date: Wed, 6 Jun 2018 15:08:59 +0530 Message-Id: <1528277940-30919-2-git-send-email-riteshh@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528277940-30919-1-git-send-email-riteshh@codeaurora.org> References: <1528277940-30919-1-git-send-email-riteshh@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180606_023926_226540_8BB43749 X-CRM114-Status: GOOD ( 13.20 ) X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.145.29.96 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ritesh Harjani MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org add_xattr adds the xattr to the ubifs image and has nothing to do with host XATTR support. Now that we are adding support where selinux interfaces may use this API even when host OS(where ubi/ubifs image is being created) does not support XATTR -so remove it from WITHOUT_XATTR #ifdef. Signed-off-by: Ritesh Harjani --- ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 80 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 6323dd4..2333dde 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -1007,46 +1007,6 @@ static int add_node(union ubifs_key *key, char *name, void *node, int len) return 0; } -#ifdef WITHOUT_XATTR -static inline int create_inum_attr(ino_t inum, const char *name) -{ - (void)inum; - (void)name; - - return 0; -} - -static inline int inode_add_xattr(struct ubifs_ino_node *host_ino, - const char *path_name, struct stat *st, ino_t inum) -{ - (void)host_ino; - (void)path_name; - (void)st; - (void)inum; - - return 0; -} -#else -static int create_inum_attr(ino_t inum, const char *name) -{ - char *str; - int ret; - - if (!do_create_inum_attr) - return 0; - - ret = asprintf(&str, "%llu", (unsigned long long)inum); - if (ret < 0) - return -1; - - ret = lsetxattr(name, "user.image-inode-number", str, ret, 0); - - free(str); - - return ret; -} - - static int add_xattr(struct stat *st, ino_t inum, const void *data, unsigned int data_len, struct qstr *nm) { @@ -1117,6 +1077,46 @@ out: return ret; } +#ifdef WITHOUT_XATTR +static inline int create_inum_attr(ino_t inum, const char *name) +{ + (void)inum; + (void)name; + + return 0; +} + +static inline int inode_add_xattr(struct ubifs_ino_node *host_ino, + const char *path_name, + struct stat *st, ino_t inum) +{ + (void)host_ino; + (void)path_name; + (void)st; + (void)inum; + + return 0; +} +#else +static int create_inum_attr(ino_t inum, const char *name) +{ + char *str; + int ret; + + if (!do_create_inum_attr) + return 0; + + ret = asprintf(&str, "%llu", (unsigned long long)inum); + if (ret < 0) + return ret; + + ret = lsetxattr(name, "user.image-inode-number", str, ret, 0); + + free(str); + + return ret; +} + static int inode_add_xattr(struct ubifs_ino_node *host_ino, const char *path_name, struct stat *st, ino_t inum) {