From patchwork Tue Jun 26 23:23:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 9633 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 776F723F28 for ; Tue, 26 Jun 2012 23:25:45 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 30301A18885 for ; Tue, 26 Jun 2012 23:25:45 +0000 (UTC) Received: by ggnf1 with SMTP id f1so526205ggn.11 for ; Tue, 26 Jun 2012 16:25:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=v3YiK1BSdeg3wFJg6bafaGylRlftvtdePyvigJ9Lsbo=; b=C0xlMyOga+9fJVPa5Q+WWKv7dWhV5RaKSVM9I4GLRuEczWtm4HRQs33kJOOamMrVQu QvyRiqGJ1h70+dreo31RQPC20WNFek2jAHZSW6dyRL9+/lMIyOKKwWagudRrEpCcoTS5 HMxF5ZfliXEqgGsdHahbHeiwq5iU5qlZHCw4wFJmBt/YC2Q4KkXU8gQVMlTRCMOCXJIL vceIWFp27ARcLoYY7nKb03aoP1VRuRe2U1yOBrhqw6OM6lLRbweiKnKtjgM5HZiNqMyO TYiVh/HwdCfaGFq1HgePPMqvVuMpWq1xCpHkYiFqX3ro0jGqfd72cw4XUvsWgReqSakj KlSQ== Received: by 10.50.203.39 with SMTP id kn7mr12647668igc.53.1340753144512; Tue, 26 Jun 2012 16:25:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp91716ibb; Tue, 26 Jun 2012 16:25:43 -0700 (PDT) Received: by 10.68.237.106 with SMTP id vb10mr56105927pbc.148.1340753143542; Tue, 26 Jun 2012 16:25:43 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id ot3si17699513pbc.251.2012.06.26.16.25.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Jun 2012 16:25:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by mail-pb0-f50.google.com with SMTP id rr4so846640pbb.37 for ; Tue, 26 Jun 2012 16:25:43 -0700 (PDT) Received: by 10.68.228.102 with SMTP id sh6mr56891418pbc.134.1340753143321; Tue, 26 Jun 2012 16:25:43 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id qd2sm4812938pbb.29.2012.06.26.16.25.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Jun 2012 16:25:42 -0700 (PDT) From: Anton Vorontsov To: Greg Kroah-Hartman , Kees Cook , Colin Cross , Tony Luck , Steven Rostedt , Frederic Weisbecker , Ingo Molnar Cc: Arnd Bergmann , John Stultz , Shuah Khan , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 5/7] pstore/ram: Convert to write_buf callback Date: Tue, 26 Jun 2012 16:23:27 -0700 Message-Id: <1340753009-12483-5-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20120626232210.GA11549@lizard> References: <20120626232210.GA11549@lizard> X-Gm-Message-State: ALoCoQkQKzW0WrJlTBlhN5qvlnbbkzg2C9xrnLISsX/hpk9AxezgHhe5CU60ovHR3nYK63qkQjxV Don't use pstore.buf directly, instead convert the code to write_buf callback which passes a pointer to a buffer as an argument. Signed-off-by: Anton Vorontsov --- fs/pstore/ram.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 78ecefc..ee58344 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -168,11 +168,12 @@ static size_t ramoops_write_kmsg_hdr(struct persistent_ram_zone *prz) return len; } -static int ramoops_pstore_write(enum pstore_type_id type, - enum kmsg_dump_reason reason, - u64 *id, - unsigned int part, - size_t size, struct pstore_info *psi) + +static int ramoops_pstore_write_buf(enum pstore_type_id type, + enum kmsg_dump_reason reason, + u64 *id, unsigned int part, + const char *buf, size_t size, + struct pstore_info *psi) { struct ramoops_context *cxt = psi->data; struct persistent_ram_zone *prz = cxt->przs[cxt->dump_write_cnt]; @@ -181,7 +182,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, if (type == PSTORE_TYPE_CONSOLE) { if (!cxt->cprz) return -ENOMEM; - persistent_ram_write(cxt->cprz, cxt->pstore.buf, size); + persistent_ram_write(cxt->cprz, buf, size); return 0; } @@ -210,7 +211,7 @@ static int ramoops_pstore_write(enum pstore_type_id type, hlen = ramoops_write_kmsg_hdr(prz); if (size + hlen > prz->buffer_size) size = prz->buffer_size - hlen; - persistent_ram_write(prz, cxt->pstore.buf, size); + persistent_ram_write(prz, buf, size); cxt->dump_write_cnt = (cxt->dump_write_cnt + 1) % cxt->max_dump_cnt; @@ -248,7 +249,7 @@ static struct ramoops_context oops_cxt = { .name = "ramoops", .open = ramoops_pstore_open, .read = ramoops_pstore_read, - .write = ramoops_pstore_write, + .write_buf = ramoops_pstore_write_buf, .erase = ramoops_pstore_erase, }, };