grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] io: add a GZ prefix to gzio specific defines
@ 2017-08-03 16:11 Pete Batard
  2017-08-07 14:26 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Batard @ 2017-08-03 16:11 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 16 bytes --]

Regards,

/Pete

[-- Attachment #2: 0003-io-add-a-GZ-prefix-to-gzio-specific-defines.patch --]
[-- Type: text/plain, Size: 3434 bytes --]

From 331ec3f7567f3f86e4d4d78fd173079d39d4eb8d Mon Sep 17 00:00:00 2001
From: Pete Batard <pete@akeo.ie>
Date: Thu, 3 Aug 2017 16:20:31 +0100
Subject: [PATCH 3/3] io: add a GZ prefix to gzio specific defines

* This is done to avoid a conflict with a PACKED define in the EDK2
---
 grub-core/io/gzio.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
index 0f2ea6b..150e250 100644
--- a/grub-core/io/gzio.c
+++ b/grub-core/io/gzio.c
@@ -140,24 +140,24 @@ eat_field (grub_file_t file, int len)
 #define OLD_GZIP_MAGIC	grub_le_to_cpu16 (0x9E1F)
 
 /* Compression methods (see algorithm.doc) */
-#define STORED      0
-#define COMPRESSED  1
-#define PACKED      2
-#define LZHED       3
+#define GZ_STORED      0
+#define GZ_COMPRESSED  1
+#define GZ_PACKED      2
+#define GZ_LZHED       3
 /* methods 4 to 7 reserved */
-#define DEFLATED    8
-#define MAX_METHODS 9
+#define GZ_DEFLATED    8
+#define GZ_MAX_METHODS 9
 
 /* gzip flag byte */
-#define ASCII_FLAG   0x01	/* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02	/* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04	/* bit 2 set: extra field present */
-#define ORIG_NAME    0x08	/* bit 3 set: original file name present */
-#define COMMENT      0x10	/* bit 4 set: file comment present */
-#define ENCRYPTED    0x20	/* bit 5 set: file is encrypted */
-#define RESERVED     0xC0	/* bit 6,7:   reserved */
+#define GZ_ASCII_FLAG   0x01	/* bit 0 set: file probably ascii text */
+#define GZ_CONTINUATION 0x02	/* bit 1 set: continuation of multi-part gzip file */
+#define GZ_EXTRA_FIELD  0x04	/* bit 2 set: extra field present */
+#define GZ_ORIG_NAME    0x08	/* bit 3 set: original file name present */
+#define GZ_COMMENT      0x10	/* bit 4 set: file comment present */
+#define GZ_ENCRYPTED    0x20	/* bit 5 set: file is encrypted */
+#define GZ_RESERVED     0xC0	/* bit 6,7:   reserved */
 
-#define UNSUPPORTED_FLAGS	(CONTINUATION | ENCRYPTED | RESERVED)
+#define GZ_UNSUPPORTED_FLAGS	(GZ_CONTINUATION | GZ_ENCRYPTED | GZ_RESERVED)
 
 /* inflate block codes */
 #define INFLATE_STORED	0
@@ -201,14 +201,14 @@ test_gzip_header (grub_file_t file)
    *  problem occurs from here on, then we have corrupt or otherwise
    *  bad data, and the error should be reported to the user.
    */
-  if (hdr.method != DEFLATED
-      || (hdr.flags & UNSUPPORTED_FLAGS)
-      || ((hdr.flags & EXTRA_FIELD)
+  if (hdr.method != GZ_DEFLATED
+      || (hdr.flags & GZ_UNSUPPORTED_FLAGS)
+      || ((hdr.flags & GZ_EXTRA_FIELD)
 	  && (grub_file_read (gzio->file, &extra_len, 2) != 2
 	      || eat_field (gzio->file,
 			    grub_le_to_cpu16 (extra_len))))
-      || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1))
-      || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1)))
+      || ((hdr.flags & GZ_ORIG_NAME) && eat_field (gzio->file, -1))
+      || ((hdr.flags & GZ_COMMENT) && eat_field (gzio->file, -1)))
     return 0;
 
   gzio->data_offset = grub_file_tell (gzio->file);
@@ -1183,7 +1183,7 @@ test_zlib_header (grub_gzio_t gzio)
   flg = get_byte (gzio);
 
   /* Check that compression method is DEFLATE.  */
-  if ((cmf & 0xf) != DEFLATED)
+  if ((cmf & 0xf) != GZ_DEFLATED)
     {
       /* TRANSLATORS: It's about given file having some strange format, not
 	 complete lack of gzip support.  */
-- 
2.9.3.windows.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/3] io: add a GZ prefix to gzio specific defines
  2017-08-03 16:11 [PATCH 3/3] io: add a GZ prefix to gzio specific defines Pete Batard
@ 2017-08-07 14:26 ` Vladimir 'phcoder' Serbinenko
  2017-08-07 16:22   ` [PATCHv2 3/3] io: add a GRUB_GZ " Pete Batard
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2017-08-07 14:26 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

If you're already changing it could you used GRUB_GZ_ rather than GZ_
prefix?

Le Thu, Aug 3, 2017 à 6:13 PM, Pete Batard <pete@akeo.ie> a écrit :

> Regards,
>
> /Pete
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 736 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 3/3] io: add a GRUB_GZ prefix to gzio specific defines
  2017-08-07 14:26 ` Vladimir 'phcoder' Serbinenko
@ 2017-08-07 16:22   ` Pete Batard
  2017-08-07 17:30     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 4+ messages in thread
From: Pete Batard @ 2017-08-07 16:22 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 98 bytes --]

As requested, this new proposal uses GRUB_GZ_ instead of GZ_ as the new 
prefix.

Regards,

/Pete

[-- Attachment #2: 0003-io-add-a-GRUB_GZ-prefix-to-gzio-specific-defines.patch --]
[-- Type: text/plain, Size: 3554 bytes --]

From de3f6990c7705dd66b608684066b35ce3f0628e4 Mon Sep 17 00:00:00 2001
From: Pete Batard <pete@akeo.ie>
Date: Mon, 7 Aug 2017 16:23:12 +0100
Subject: [PATCH 3/3] io: add a GRUB_GZ prefix to gzio specific defines

* This is done to avoid a conflict with a PACKED define in the EDK2
---
 grub-core/io/gzio.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/grub-core/io/gzio.c b/grub-core/io/gzio.c
index 0f2ea6b..a8e3303 100644
--- a/grub-core/io/gzio.c
+++ b/grub-core/io/gzio.c
@@ -140,24 +140,24 @@ eat_field (grub_file_t file, int len)
 #define OLD_GZIP_MAGIC	grub_le_to_cpu16 (0x9E1F)
 
 /* Compression methods (see algorithm.doc) */
-#define STORED      0
-#define COMPRESSED  1
-#define PACKED      2
-#define LZHED       3
+#define GRUB_GZ_STORED      0
+#define GRUB_GZ_COMPRESSED  1
+#define GRUB_GZ_PACKED      2
+#define GRUB_GZ_LZHED       3
 /* methods 4 to 7 reserved */
-#define DEFLATED    8
-#define MAX_METHODS 9
+#define GRUB_GZ_DEFLATED    8
+#define GRUB_GZ_MAX_METHODS 9
 
 /* gzip flag byte */
-#define ASCII_FLAG   0x01	/* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02	/* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04	/* bit 2 set: extra field present */
-#define ORIG_NAME    0x08	/* bit 3 set: original file name present */
-#define COMMENT      0x10	/* bit 4 set: file comment present */
-#define ENCRYPTED    0x20	/* bit 5 set: file is encrypted */
-#define RESERVED     0xC0	/* bit 6,7:   reserved */
+#define GRUB_GZ_ASCII_FLAG   0x01	/* bit 0 set: file probably ascii text */
+#define GRUB_GZ_CONTINUATION 0x02	/* bit 1 set: continuation of multi-part gzip file */
+#define GRUB_GZ_EXTRA_FIELD  0x04	/* bit 2 set: extra field present */
+#define GRUB_GZ_ORIG_NAME    0x08	/* bit 3 set: original file name present */
+#define GRUB_GZ_COMMENT      0x10	/* bit 4 set: file comment present */
+#define GRUB_GZ_ENCRYPTED    0x20	/* bit 5 set: file is encrypted */
+#define GRUB_GZ_RESERVED     0xC0	/* bit 6,7:   reserved */
 
-#define UNSUPPORTED_FLAGS	(CONTINUATION | ENCRYPTED | RESERVED)
+#define GRUB_GZ_UNSUPPORTED_FLAGS	(GRUB_GZ_CONTINUATION | GRUB_GZ_ENCRYPTED | GRUB_GZ_RESERVED)
 
 /* inflate block codes */
 #define INFLATE_STORED	0
@@ -201,14 +201,14 @@ test_gzip_header (grub_file_t file)
    *  problem occurs from here on, then we have corrupt or otherwise
    *  bad data, and the error should be reported to the user.
    */
-  if (hdr.method != DEFLATED
-      || (hdr.flags & UNSUPPORTED_FLAGS)
-      || ((hdr.flags & EXTRA_FIELD)
+  if (hdr.method != GRUB_GZ_DEFLATED
+      || (hdr.flags & GRUB_GZ_UNSUPPORTED_FLAGS)
+      || ((hdr.flags & GRUB_GZ_EXTRA_FIELD)
 	  && (grub_file_read (gzio->file, &extra_len, 2) != 2
 	      || eat_field (gzio->file,
 			    grub_le_to_cpu16 (extra_len))))
-      || ((hdr.flags & ORIG_NAME) && eat_field (gzio->file, -1))
-      || ((hdr.flags & COMMENT) && eat_field (gzio->file, -1)))
+      || ((hdr.flags & GRUB_GZ_ORIG_NAME) && eat_field (gzio->file, -1))
+      || ((hdr.flags & GRUB_GZ_COMMENT) && eat_field (gzio->file, -1)))
     return 0;
 
   gzio->data_offset = grub_file_tell (gzio->file);
@@ -1183,7 +1183,7 @@ test_zlib_header (grub_gzio_t gzio)
   flg = get_byte (gzio);
 
   /* Check that compression method is DEFLATE.  */
-  if ((cmf & 0xf) != DEFLATED)
+  if ((cmf & 0xf) != GRUB_GZ_DEFLATED)
     {
       /* TRANSLATORS: It's about given file having some strange format, not
 	 complete lack of gzip support.  */
-- 
2.9.3.windows.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHv2 3/3] io: add a GRUB_GZ prefix to gzio specific defines
  2017-08-07 16:22   ` [PATCHv2 3/3] io: add a GRUB_GZ " Pete Batard
@ 2017-08-07 17:30     ` Vladimir 'phcoder' Serbinenko
  0 siblings, 0 replies; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2017-08-07 17:30 UTC (permalink / raw)
  To: The development of GNU GRUB

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

Committed

Le Mon, Aug 7, 2017 à 6:23 PM, Pete Batard <pete@akeo.ie> a écrit :

> As requested, this new proposal uses GRUB_GZ_ instead of GZ_ as the new
> prefix.
>
> Regards,
>
> /Pete
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #2: Type: text/html, Size: 760 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07 17:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-03 16:11 [PATCH 3/3] io: add a GZ prefix to gzio specific defines Pete Batard
2017-08-07 14:26 ` Vladimir 'phcoder' Serbinenko
2017-08-07 16:22   ` [PATCHv2 3/3] io: add a GRUB_GZ " Pete Batard
2017-08-07 17:30     ` Vladimir 'phcoder' Serbinenko

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).