* [PATCH] fs/pstore: constify pstore_zbackend structures
@ 2017-02-19 9:37 Bhumika Goyal
2017-03-03 19:41 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-02-19 9:37 UTC (permalink / raw)
To: julia.lawall, anton, ccross, keescook, tony.luck, linux-kernel
Cc: Bhumika Goyal
The references of pstore_zbackend structures are stored into the
pointer zbackend of type struct pstore_zbackend. The pointer zbackend
can be made const as it is only dereferenced. After making this change
the pstore_zbackend structures whose references are stored into the
pointer zbackend can be made const too.
File size before:
text data bss dec hex filename
4817 541 172 5530 159a fs/pstore/platform.o
File size after:
text data bss dec hex filename
4865 477 172 5514 158a fs/pstore/platform.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
fs/pstore/platform.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 729677e..92e8728 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -267,7 +267,7 @@ static void free_zlib(void)
big_oops_buf_sz = 0;
}
-static struct pstore_zbackend backend_zlib = {
+static const struct pstore_zbackend backend_zlib = {
.compress = compress_zlib,
.decompress = decompress_zlib,
.allocate = allocate_zlib,
@@ -328,7 +328,7 @@ static void free_lzo(void)
big_oops_buf_sz = 0;
}
-static struct pstore_zbackend backend_lzo = {
+static const struct pstore_zbackend backend_lzo = {
.compress = compress_lzo,
.decompress = decompress_lzo,
.allocate = allocate_lzo,
@@ -389,7 +389,7 @@ static void free_lz4(void)
big_oops_buf_sz = 0;
}
-static struct pstore_zbackend backend_lz4 = {
+static const struct pstore_zbackend backend_lz4 = {
.compress = compress_lz4,
.decompress = decompress_lz4,
.allocate = allocate_lz4,
@@ -398,7 +398,7 @@ static void free_lz4(void)
};
#endif
-static struct pstore_zbackend *zbackend =
+static const struct pstore_zbackend *zbackend =
#if defined(CONFIG_PSTORE_ZLIB_COMPRESS)
&backend_zlib;
#elif defined(CONFIG_PSTORE_LZO_COMPRESS)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs/pstore: constify pstore_zbackend structures
2017-02-19 9:37 [PATCH] fs/pstore: constify pstore_zbackend structures Bhumika Goyal
@ 2017-03-03 19:41 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2017-03-03 19:41 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: Julia Lawall, Anton Vorontsov, Colin Cross, Tony Luck, LKML
On Sun, Feb 19, 2017 at 1:37 AM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> The references of pstore_zbackend structures are stored into the
> pointer zbackend of type struct pstore_zbackend. The pointer zbackend
> can be made const as it is only dereferenced. After making this change
> the pstore_zbackend structures whose references are stored into the
> pointer zbackend can be made const too.
>
> File size before:
> text data bss dec hex filename
> 4817 541 172 5530 159a fs/pstore/platform.o
>
> File size after:
> text data bss dec hex filename
> 4865 477 172 5514 158a fs/pstore/platform.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Awesome, thanks! I've applied this to my tree; it should be visible in
-next soon.
-Kees
--
Kees Cook
Pixel Security
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-03 19:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-19 9:37 [PATCH] fs/pstore: constify pstore_zbackend structures Bhumika Goyal
2017-03-03 19:41 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).