All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Seyfried <seife@suse.de>
To: linux-kernel@vger.kernel.org
Cc: erik@rigtorp.com
Subject: Re: [PATCH] make swsusp produce nicer screen output
Date: Sun, 22 Aug 2004 01:42:46 +0200	[thread overview]
Message-ID: <4127DDF6.2030500@suse.de> (raw)
In-Reply-To: <20040820152317.GA7118@linux.nu>

Hi,

Erik Rigtorp wrote:
> Hi!
> 
> I made a small patch that makes swsusp produce a bit nicer screen output,
> it's still a little rough though.

generally not a bad idea, but....

> diff -Nru linux-2.6.8.1-mm2/kernel/power/swsusp.c linux-2.6.8.1-mm2-erkki/kernel/power/swsusp.c
> --- linux-2.6.8.1-mm2/kernel/power/swsusp.c	2004-08-20 17:10:58.000000000 +0200
> +++ linux-2.6.8.1-mm2-erkki/kernel/power/swsusp.c	2004-08-20 16:13:29.000000000 +0200
> @@ -296,15 +296,16 @@
>  {
>  	int error = 0;
>  	int i;
> -
> -	printk( "Writing data to swap (%d pages): ", nr_copy_pages );
> +	int mod = nr_copy_pages / 100;
> +	
> +	printk( "Writing data to swap (%d pages):     ", nr_copy_pages );
>  	for (i = 0; i < nr_copy_pages && !error; i++) {
> -		if (!(i%100))
> -			printk( "." );
> +		if (!(i%mod))
> +			printk( "\b\b\b\b%3d%%", i / mod );

what will happen here if nr_copy_pages < 100?

>  		error = write_page((pagedir_nosave+i)->address,
>  					  &((pagedir_nosave+i)->swap_address));
>  	}
> -	printk(" %d Pages done.\n",i);
> +	printk("\b\b\b\bdone\n");
>  	return error;
>  }
>  
> @@ -1150,14 +1151,15 @@
>  	struct pbe * p;
>  	int error;
>  	int i;
> -
> +	int mod = nr_copy_pages / 100;
> +	
>  	if ((error = swsusp_pagedir_relocate()))
>  		return error;
>  
> -	printk( "Reading image data (%d pages): ", nr_copy_pages );
> +	printk( "Reading image data (%d pages):     ", nr_copy_pages );
>  	for(i = 0, p = pagedir_nosave; i < nr_copy_pages && !error; i++, p++) {
> -		if (!(i%100))
> -			printk( "." );
> +		if (!(i%mod))
> +			printk( "\b\b\b\b%3d%%", i / mod );

...and here...

>  		error = bio_read_page(swp_offset(p->swap_address),
>  				  (void *)p->address);
>  	}

  Stefan


  reply	other threads:[~2004-08-21 23:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 15:23 [PATCH] make swsusp produce nicer screen output Erik Rigtorp
2004-08-21 23:42 ` Stefan Seyfried [this message]
2004-08-23 17:42 ` Pavel Machek
2004-08-23 20:08   ` Erik Rigtorp
2004-08-24 21:49     ` Pavel Machek
2004-08-27 10:55       ` Stefan Seyfried
2004-08-28 22:58         ` Pavel Machek
2004-08-29 13:54       ` Erik Rigtorp
2004-08-29 14:59         ` Stefan Seyfried
2004-08-29 15:20         ` Pavel Machek
2004-08-29 16:36         ` Pavel Machek

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=4127DDF6.2030500@suse.de \
    --to=seife@suse.de \
    --cc=erik@rigtorp.com \
    --cc=linux-kernel@vger.kernel.org \
    /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.