Message ID | 20181018143718.26298-3-richard@nod.at |
---|---|
State | Accepted |
Delegated to: | David Oberhollenzer |
Headers | show
Return-Path: <linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org> 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=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hPp6NSG6"; 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 42bWr04N5rz9s8J for <incoming@patchwork.ozlabs.org>; Fri, 19 Oct 2018 01:38:24 +1100 (AEDT) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=5S+J04GnRy01vzVni5McU/Taa5vcfDvBJYIte72mgPw=; b=hPp6NSG6PoqJiU k70GiS6rIt9FwiW9VSVq7WlUM1DVpCQdBUAnnPm8xt3f3vEGw5Jfr8l20D3Ucnxk3lS7xV6Ue667W OaXvIB5UqWQO1AvVReHi1ZWtmVbtrDiPD2MAhITY0dizLaL3YxheEtJ/6irG5P82fOXhR/Q9rqy6L mjpTErm6aLgtpsFBaMhnIfkMXY62P7aB8SaqdfUAZa36YpGym7aGflkh2zPRmGSJrn3blaSdAmECk Prasqpx854cTyt/9xqLvowtCTCm2FC97dzLLaYMG63RTNKwtXFTxJ31wJEaqQ/sJTG2PGg8/KWdQl wRYe6j1VWnJI7KJuQvPA==; 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 1gD9RH-00045D-Sq; Thu, 18 Oct 2018 14:38:15 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gD9RC-00043E-Nb for linux-mtd@lists.infradead.org; Thu, 18 Oct 2018 14:38:12 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 16D491800005B; Thu, 18 Oct 2018 16:37:58 +0200 (CEST) From: Richard Weinberger <richard@nod.at> To: linux-mtd@lists.infradead.org Subject: [PATCH 02/42] common: Add round functions Date: Thu, 18 Oct 2018 16:36:38 +0200 Message-Id: <20181018143718.26298-3-richard@nod.at> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018143718.26298-1-richard@nod.at> References: <20181018143718.26298-1-richard@nod.at> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181018_073810_924015_EE5ADC34 X-CRM114-Status: GOOD ( 12.56 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list <linux-mtd.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-mtd/> List-Post: <mailto:linux-mtd@lists.infradead.org> List-Help: <mailto:linux-mtd-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-mtd>, <mailto:linux-mtd-request@lists.infradead.org?subject=subscribe> Cc: Richard Weinberger <richard@nod.at>, david.oberhollenzer@sigma-star.at Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" <linux-mtd-bounces@lists.infradead.org> Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org |
Series |
mtd-utils: Add fscrypt support to mkfs.ubifs
|
expand
|
diff --git a/include/common.h b/include/common.h index 2f24645fe23b..72707697b170 100644 --- a/include/common.h +++ b/include/common.h @@ -65,6 +65,16 @@ extern "C" { (_x > _y) ? _x : _y; \ }) +/* + * This looks more complex than it should be. But we need to + * get the type for the ~ right in round_down (it needs to be + * as wide as the result!), and we want to evaluate the macro + * arguments just once each. + */ +#define __round_mask(x, y) ((__typeof__(x))((y)-1)) +#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down(x, y) ((x) & ~__round_mask(x, y)) + #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif
Signed-off-by: Richard Weinberger <richard@nod.at> --- include/common.h | 10 ++++++++++ 1 file changed, 10 insertions(+)