From patchwork Wed Mar 2 00:14:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 63362 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2110599lbc; Tue, 1 Mar 2016 16:14:53 -0800 (PST) X-Received: by 10.55.79.79 with SMTP id d76mr30225013qkb.76.1456877691184; Tue, 01 Mar 2016 16:14:51 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z20si33552160qge.41.2016.03.01.16.14.50 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 01 Mar 2016 16:14:51 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([::1]:53237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aauRG-0004Q7-KN for patch@linaro.org; Tue, 01 Mar 2016 19:14:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aauQr-0004Pb-Os for grub-devel@gnu.org; Tue, 01 Mar 2016 19:14:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aauQn-0001L3-UL for grub-devel@gnu.org; Tue, 01 Mar 2016 19:14:25 -0500 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:35362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aauQn-0001Kd-Ny for grub-devel@gnu.org; Tue, 01 Mar 2016 19:14:21 -0500 Received: by mail-wm0-x22c.google.com with SMTP id l68so61762977wml.0 for ; Tue, 01 Mar 2016 16:14:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=B5gXe21tkjGDeJTvdGAUL/r7sHkYAjlj6LWQREvNvRQ=; b=SaQUfwhF+ZJ33ZIP6QIiSVGLA5flZ1VZbicR/9e/WsGjrhRums9wl8fuKTEw9LU6m+ 4R4XsHdVdXzhfCWK8nKA0KGluVAdqY2QcQCI+fYOKxMQT0o7mLNpNOnBeQ0L6+fZfNcx tD4ORreEtINgUX66R77EBwcLyq1VZj2PE+2Y8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=B5gXe21tkjGDeJTvdGAUL/r7sHkYAjlj6LWQREvNvRQ=; b=IKieF9YOAlyflTOrph7xySOj/HNtJU7eozc13Yzw57dqsT5ESCCcpXnrKBlYkDHGgp uHum/FErTtzultfZ6kgbKhEXTOwxp43AFDZOkVTvymJVknYbQgmUkX31HvHUOWRGdUYD LtN1RXyQCPakluVk/cj4pyAkXYyb97mPzfiFTNpKogJujYWKm/eGsujJXqHmbQEsZArQ y8rsTBEMOSekAsq4EG0dUvPUjJiZlbgSb5Zdy4oZxHcIkLAxu0ArG9Zf9HMZa1YfEhQP bgBaFOADLxtaXVCC6PRLOaBow/bkYZ96PgygZxgtBX0FJbXvWL6WSA2GPADa8z7jKKvt eJWw== X-Gm-Message-State: AD7BkJJrYYVixm22td6Ry/+O2QIVKNc6OtINKNa+Mv9Ku8lp25gdvI0n5kTeXhZe+ctFG0Fd X-Received: by 10.28.6.139 with SMTP id 133mr1632835wmg.84.1456877661205; Tue, 01 Mar 2016 16:14:21 -0800 (PST) Received: from mohikan.mushroom.smurfnet.nu (cpc92308-cmbg19-2-0-cust814.5-4.cable.virginm.net. [82.24.251.47]) by smtp.gmail.com with ESMTPSA id ls5sm33035554wjb.33.2016.03.01.16.14.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 16:14:20 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Subject: [PATCH v2 2/3] efidisk: implement alignment-respecting malloc function Date: Wed, 2 Mar 2016 00:14:11 +0000 Message-Id: <1456877652-19389-3-git-send-email-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456877652-19389-1-git-send-email-leif.lindholm@linaro.org> References: <1456877652-19389-1-git-send-email-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22c X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: grub-devel-bounces+patch=linaro.org@gnu.org Implement a driver-specific malloc function that allocates a buffer with the alignment specified by grub_efi_block_io_media structure. --- grub-core/disk/efi/efidisk.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.1.4 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 3b79f7b..ac99ea7 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -457,6 +457,13 @@ get_device (struct grub_efidisk_data *devices, int num) return 0; } +static void * +aligned_malloc (struct grub_disk *disk, grub_size_t size) +{ + struct grub_efidisk_data *d = disk->data; + return grub_memalign (d->block_io->media->io_align, size); +} + static grub_err_t grub_efidisk_open (const char *name, struct grub_disk *disk) { @@ -512,6 +519,7 @@ grub_efidisk_open (const char *name, struct grub_disk *disk) (1U << disk->log_sector_size) < m->block_size; disk->log_sector_size++); disk->data = d; + disk->malloc = aligned_malloc; grub_dprintf ("efidisk", "opening %s succeeded\n", name);