From patchwork Tue Sep 11 06:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 146423 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3324210ljw; Tue, 11 Sep 2018 00:15:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZn2t8bihqaNc3mrYbrz5whEJ9600C+IaTnelupJLucjv+GxLTk5rIEynMtHK6JUft86xfC X-Received: by 2002:a50:81c6:: with SMTP id 64-v6mr26422476ede.93.1536650150861; Tue, 11 Sep 2018 00:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536650150; cv=none; d=google.com; s=arc-20160816; b=bEwZAqNd18kWICD6MYcbf+8oOFwF28Saj6zxo2iSKBymfL6yyXrL4ZKzOrI8OT0HYV kNAzm+m6/uY8x5Z7bt6tNCzIo1pYCQoGSUsRkdbOKjgNKvJci06MvJ31nIEs+MqrATZC C/6W4A7BSAO/9xeMb4srHgM+coRPLy7t/QKF6fx7TbrS893aj3xOX/1VSgCjN3if3YIw fMEmN2o3daWrbsdjUslpROfkQZMuOFXHu4hafffbiM/IfVjC10niCYp+l5xeklfr+jaC jR648DrSz4ageGXGQogTbnce9g1Nb4LJXEhGJmzxA1W/jXpstPRBGC11DChuHSw/9gSX 6IgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature; bh=0WGfkTsSmm8pnQHQaeUntKB7/SyeIS9S0I1TecBhVS4=; b=YXCy2IQy67uuVdLGYYjoKiuIUfTL+IwlZ69E0UEPFErp8m5Bb1nAa+pjscscQRcacG 3Svr/+flxXNAaAFXM+LSLj7hvtNUNA/jjQDsoozZ4vBcNpOBYgwGqJo72kiD6y7ajNPK mDi4Py2yr6VM5Xon3IVHX7++Zcwig+1OBG8gMomaNO6jwJAfreag4f2Y87m+9RtjcRQR 9k+VhtQ4nSp3tLRm/t78x7EINXVH/temZf+McH0M3WncNQO88cQhD/L5UpXvo4el+7Za QMjvMhj/iVoZOqGFME7q/MS8mEXMtKYRP3t1FXY/JibMWTJdwJUu9vWgY8FzO3UweLMd 1IKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VGziMP1c; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 92-v6si1191509edj.173.2018.09.11.00.15.50; Tue, 11 Sep 2018 00:15:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VGziMP1c; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 67823C21EE3; Tue, 11 Sep 2018 07:09:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0D2ACC21F07; Tue, 11 Sep 2018 07:01:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3535FC21F29; Tue, 11 Sep 2018 07:00:24 +0000 (UTC) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by lists.denx.de (Postfix) with ESMTPS id BBEA2C21F04 for ; Tue, 11 Sep 2018 07:00:19 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id i26-v6so11729451pfo.12 for ; Tue, 11 Sep 2018 00:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nkHlKBHNcO4mG7XfvMpL+bqf1m84GCvR1iwc8zgfMcs=; b=VGziMP1cnVGcOlvzgUYqVHPV0hI+Hmbc1G4VkbrxTIuCWXm7tpSt+woSVq25CxqpEG l1u9S/5pFBRvCvXywlK0VFmkQpcLMsDb6CzgVsr4uxlm8e+Jsmjgc7ebYoVDNZu5flnt h4pE/rAyJqoHKJzf6dMW0ug2Zl2MILhMHY4fM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nkHlKBHNcO4mG7XfvMpL+bqf1m84GCvR1iwc8zgfMcs=; b=Zpxn4UNzR1bwp2qgeQ+QwR1/zuA+cGkpVsGJA2sdMqlRbbRx1ltlO4P4AQlQ5+0wcz BmbII8xAEET7Q3LpGub6nEaF3nzeJUUfZgY93TXhPces0p9ivOdpOepdxJI3hZTRzLYv qaQK8acbg8QDVGZspcAfk0OyQk0EcGgiFu+bFdKS2Ciu25AKKEcoy3yToVY7hrFI3SNe XSo524XBWwtq2i3Pw2ZVwvGFU3qGDrA36hXwDf0/DP6vrE4l/H8/tcS9me4+TIdtwLtn XA2SoPz0587JydmsaV0f2btgzArVjF4OwyOWL+QEii9qx+m8DAlQpdCC+fQDCB89YQWi mqdg== X-Gm-Message-State: APzg51AQJ5XhnVdtAfveOb+VQ12RFUrEIXkUx3uefBLCUICfY3gKxUyi RirJ4YHnSj2EwWvefSn1Aq2lnw== X-Received: by 2002:a63:4425:: with SMTP id r37-v6mr26535263pga.391.1536649218429; Tue, 11 Sep 2018 00:00:18 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id m27-v6sm24363668pff.152.2018.09.11.00.00.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 00:00:17 -0700 (PDT) From: "Akashi, Takahiro" To: trini@konsulko.com Date: Tue, 11 Sep 2018 15:59:16 +0900 Message-Id: <20180911065922.19141-21-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180911065922.19141-1-takahiro.akashi@linaro.org> References: <20180911065922.19141-1-takahiro.akashi@linaro.org> Cc: u-boot@lists.denx.de, xypron.glpk@gmx.de, agraf@suse.de Subject: [U-Boot] [PATCH v3 20/26] efi_loader: implement a file delete X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: AKASHI Takahiro 'Delete' will be implemented here by calling fs_unlink() which relies on underlying file system's implementation. Signed-off-by: AKASHI Takahiro --- lib/efi_loader/efi_file.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c index 6ec98c80227e..e726bb0eb2d2 100644 --- a/lib/efi_loader/efi_file.c +++ b/lib/efi_loader/efi_file.c @@ -229,9 +229,21 @@ static efi_status_t EFIAPI efi_file_close(struct efi_file_handle *file) static efi_status_t EFIAPI efi_file_delete(struct efi_file_handle *file) { struct file_handle *fh = to_fh(file); + efi_status_t ret = EFI_SUCCESS; + EFI_ENTRY("%p", file); + + if (set_blk_dev(fh)) { + ret = EFI_DEVICE_ERROR; + goto error; + } + + if (fs_unlink(fh->path)) + ret = EFI_DEVICE_ERROR; file_close(fh); - return EFI_EXIT(EFI_WARN_DELETE_FAILURE); + +error: + return EFI_EXIT(ret); } static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size,