All of lore.kernel.org
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: sergey.senozhatsky.work@gmail.com, minchan@kernel.org,
	ngupta@vflare.org, sergey.senozhatsky@gmail.com,
	mm-commits@vger.kernel.org
Subject: + zram-cut-trailing-newline-in-algorithm-name.patch added to -mm tree
Date: Fri, 22 May 2015 12:45:12 -0700	[thread overview]
Message-ID: <555f8748.cihGyR8AMRDWiO2y%akpm@linux-foundation.org> (raw)


The patch titled
     Subject: zram: cut trailing newline in algorithm name
has been added to the -mm tree.  Its filename is
     zram-cut-trailing-newline-in-algorithm-name.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zram-cut-trailing-newline-in-algorithm-name.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zram-cut-trailing-newline-in-algorithm-name.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: zram: cut trailing newline in algorithm name

Supplied sysfs values sometimes contain new-line symbols (echo vs.  echo
-n), which we also copy as a compression algorithm name.  it works fine
when we lookup for compression algorithm, because we use sysfs_streq()
which takes care of new line symbols.  however, it doesn't look nice when
we print compression algorithm name if zcomp_create() failed:

 zram: Cannot initialise LXZ
            compressing backend

cut trailing new-line, so the error string will look like

  zram: Cannot initialise LXZ compressing backend

we also now can replace sysfs_streq() in zcomp_available_show() with
strcmp().

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/block/zram/zcomp.c    |    2 +-
 drivers/block/zram/zram_drv.c |    8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff -puN drivers/block/zram/zcomp.c~zram-cut-trailing-newline-in-algorithm-name drivers/block/zram/zcomp.c
--- a/drivers/block/zram/zcomp.c~zram-cut-trailing-newline-in-algorithm-name
+++ a/drivers/block/zram/zcomp.c
@@ -274,7 +274,7 @@ ssize_t zcomp_available_show(const char
 	int i = 0;
 
 	while (backends[i]) {
-		if (sysfs_streq(comp, backends[i]->name))
+		if (!strcmp(comp, backends[i]->name))
 			sz += scnprintf(buf + sz, PAGE_SIZE - sz - 2,
 					"[%s] ", backends[i]->name);
 		else
diff -puN drivers/block/zram/zram_drv.c~zram-cut-trailing-newline-in-algorithm-name drivers/block/zram/zram_drv.c
--- a/drivers/block/zram/zram_drv.c~zram-cut-trailing-newline-in-algorithm-name
+++ a/drivers/block/zram/zram_drv.c
@@ -363,6 +363,8 @@ static ssize_t comp_algorithm_store(stru
 		struct device_attribute *attr, const char *buf, size_t len)
 {
 	struct zram *zram = dev_to_zram(dev);
+	size_t sz;
+
 	down_write(&zram->init_lock);
 	if (init_done(zram)) {
 		up_write(&zram->init_lock);
@@ -370,6 +372,12 @@ static ssize_t comp_algorithm_store(stru
 		return -EBUSY;
 	}
 	strlcpy(zram->compressor, buf, sizeof(zram->compressor));
+
+	/* ignore trailing newline */
+	sz = strlen(zram->compressor);
+	if (sz > 0 && zram->compressor[sz - 1] == '\n')
+		zram->compressor[sz - 1] = 0x00;
+
 	up_write(&zram->init_lock);
 	return len;
 }
_

Patches currently in -mm which might be from sergey.senozhatsky.work@gmail.com are

zram-remove-obsolete-zram_debug-option.patch
zsmalloc-remove-obsolete-zsmalloc_debug.patch
zram-cut-trailing-newline-in-algorithm-name.patch
linux-next.patch


                 reply	other threads:[~2015-05-22 19:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=555f8748.cihGyR8AMRDWiO2y%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.