From patchwork Sat May 26 13:39:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 9005 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 D664323F00 for ; Sat, 26 May 2012 13:41:25 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9FBB1A18441 for ; Sat, 26 May 2012 13:41:25 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so1080455yen.11 for ; Sat, 26 May 2012 06:41:25 -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=TXY2zXIswth0N17qYhDGz/D9/XB417lIX2KGa5rGnFQ=; b=J6W89oHyElSW6J2x1YGyrNx4bCw5s2cM5FLc8NgxkoodY22S1sHaE7JqUkUhhZehwT 0NVYJzNUJWjAHKML2Sqz74PQHGBcOLjylzOEJ6HMts2ORMb/1SVO2dKj0bdPtCyzrxps UAczLzHp39+12xsqRgoH4pdBMCPouMOlnpfds0ENOiGOCuThSgXv3/GXjhDlWkTYNeeQ oZ4DzW5yttClTQZvt96PQt1WzWqv4HHbAz56FTpMGQvj8+prPDEHLdtJPWhylXLGafQf P1RbEeN6jtlHghGvyP/SwH3R4vT5vQqPIXVCckvv+ekN/tuqzy+SXlWsEcByWBjxOkcD FNNA== Received: by 10.50.46.232 with SMTP id y8mr973219igm.57.1338039685231; Sat, 26 May 2012 06:41:25 -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 v20csp87069ibb; Sat, 26 May 2012 06:41:24 -0700 (PDT) Received: by 10.68.232.129 with SMTP id to1mr8069414pbc.27.1338039684523; Sat, 26 May 2012 06:41:24 -0700 (PDT) Received: from mail-pz0-f50.google.com (mail-pz0-f50.google.com [209.85.210.50]) by mx.google.com with ESMTPS id ru5si9951608pbc.251.2012.05.26.06.41.24 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 26 May 2012 06:41:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.210.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.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 danh15 with SMTP id h15so2736737dan.37 for ; Sat, 26 May 2012 06:41:24 -0700 (PDT) Received: by 10.68.136.101 with SMTP id pz5mr512526pbb.158.1338039684208; Sat, 26 May 2012 06:41:24 -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 kd6sm12588184pbc.24.2012.05.26.06.41.21 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 26 May 2012 06:41:23 -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 4/5] pstore/ram: Convert to write_buf callback Date: Sat, 26 May 2012 06:39:08 -0700 Message-Id: <1338039549-24498-4-git-send-email-anton.vorontsov@linaro.org> X-Mailer: git-send-email 1.7.9.2 In-Reply-To: <20120526133412.GA18001@lizard> References: <20120526133412.GA18001@lizard> X-Gm-Message-State: ALoCoQlRU96b30NjK+3U2/9VMbwBAXBFwmCsmfjAkDucrNjPMyxvVSp6lpeYgyU1+uRieju2COzD 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 c7acf94..96dbd1e 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, }, };