From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Subject: Re: [PATCH rebase] Add support for Compact OS compression for Cygwin
Date: Thu, 14 Jul 2022 12:24:25 +0200 [thread overview]
Message-ID: <Ys/u2QmY8E1s0hZd@calimero.vinschen.de> (raw)
In-Reply-To: <e281c355-1ea1-eefa-12d8-17f7538edb60@t-online.de>
On Jul 14 12:02, Christian Franke wrote:
> [Sorry if this is the wrong list]
Yes, in theorie, but no worries. However...
> This finally completes '--compact-os' support of Cygwin setup.
> https://sourceware.org/pipermail/cygwin-apps/2021-May/041225.html
>
> --
> Regards
> Christian
>
> From 807ae9fbaef18491f3aa1e94e66dd21eb6748c3e Mon Sep 17 00:00:00 2001
> From: Christian Franke <christian.franke@t-online.de>
> Date: Thu, 14 Jul 2022 11:59:50 +0200
> Subject: [PATCH] Add support for Compact OS compression for Cygwin
>
> Preserve compression of manually rebased files.
> Align compression with Cygwin DLL if database is used.
> Only check for writability if file needs rebasing to keep
> compression of unchanged files.
>
> Signed-off-by: Christian Franke <christian.franke@t-online.de>
> ---
> rebase.c | 199 +++++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 155 insertions(+), 44 deletions(-)
>
> diff --git a/rebase.c b/rebase.c
> index a403c85..06828bb 100644
> --- a/rebase.c
> +++ b/rebase.c
> @@ -39,6 +39,10 @@
> #include <errno.h>
> #include "imagehelper.h"
> #include "rebase-db.h"
> +#if defined(__CYGWIN__)
> +#include <io.h>
> +#include <versionhelpers.h>
> +#endif
>
> BOOL save_image_info ();
> BOOL load_image_info ();
> @@ -48,6 +52,10 @@ void print_image_info ();
> BOOL rebase (const char *pathname, ULONG64 *new_image_base, BOOL down_flag);
> void parse_args (int argc, char *argv[]);
> unsigned long long string_to_ulonglong (const char *string);
> +#if defined(__CYGWIN__)
> +static int compactos_get_algorithm (const char *pathname);
> +static int compactos_compress_file (const char *pathname, int algorithm);
> +#endif
> void usage ();
> void help ();
> BOOL is_rebaseable (const char *pathname);
> @@ -259,9 +267,19 @@ main (int argc, char *argv[])
> ULONG64 new_image_base = image_base;
> for (i = 0; i < img_info_size; ++i)
> {
> +#if defined(__CYGWIN__)
Given compactos stuff is a OS thingy and not actually a Cygwin feature,
why do we need an ifdef CYGWIN?
> + int compactos_algorithm
> + = compactos_get_algorithm (img_info_list[i].name);
> +#endif
> status = rebase (img_info_list[i].name, &new_image_base, down_flag);
> if (!status)
> return 2;
> +#if defined(__CYGWIN__)
> + /* Reapply previous compression. */
> + if (compactos_algorithm >= 0)
> + compactos_compress_file (img_info_list[i].name,
> + compactos_algorithm);
> +#endif
> }
> }
> else
> @@ -269,6 +287,9 @@ main (int argc, char *argv[])
> /* Rebase with database support. */
> BOOL header;
>
> +#if defined(__CYGWIN__)
> + int compactos_algorithm = compactos_get_algorithm ("/bin/cygwin1.dll");
> +#endif
> if (merge_image_info () < 0)
> return 2;
> status = TRUE;
> @@ -279,6 +300,14 @@ main (int argc, char *argv[])
> status = rebase (img_info_list[i].name, &new_image_base, FALSE);
> if (status)
> img_info_list[i].flag.needs_rebasing = 0;
> +#if defined(__CYGWIN__)
> + /* If Cygwin DLL is compressed, assume setup was used with option
> + --compact-os. Align compression with Cygwin DLL. */
> + if (compactos_algorithm >= 0
> + && compactos_compress_file (img_info_list[i].name,
> + compactos_algorithm) < 0)
> + compactos_algorithm = -1;
> +#endif
This ifdef still makes sense, of course and on first glance, the
remainder of the patch LGTM.
Thanks,
Corinna
next prev parent reply other threads:[~2022-07-14 10:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 10:02 Christian Franke
2022-07-14 10:24 ` Corinna Vinschen [this message]
2022-07-14 12:12 ` Christian Franke
2022-07-14 14:28 ` Corinna Vinschen
2022-07-14 14:41 ` Christian Franke
2022-07-14 14:54 ` Corinna Vinschen
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=Ys/u2QmY8E1s0hZd@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin-patches@cygwin.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).