util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Petr Uzel <petr.uzel@suse.cz>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: Re: [PATCH 2/2] losetup: new -D option to delete all used loop devices
Date: Mon, 3 Oct 2011 15:52:55 +0200	[thread overview]
Message-ID: <20111003135255.GI1982@nb.net.home> (raw)
In-Reply-To: <1317377126-13302-2-git-send-email-petr.uzel@suse.cz>

On Fri, Sep 30, 2011 at 12:05:26PM +0200, Petr Uzel wrote:
> 
> Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
> ---
>  mount/lomount.c |   45 +++++++++++++++++++++++++++++++++++++++++----
>  mount/losetup.8 |    6 ++++++
>  2 files changed, 47 insertions(+), 4 deletions(-)
> 
> diff --git a/mount/lomount.c b/mount/lomount.c
> index 441860b..ae49157 100644
> --- a/mount/lomount.c
> +++ b/mount/lomount.c
> @@ -938,6 +938,32 @@ set_loop(const char *device, const char *file, unsigned long long offset,
>  	return 0;
>  }
>  
> +static int
> +delete_all_devices (void)
> +{
> +	struct looplist ll;
> +	int fd;
> +	int ok;

 int ok = 0;   :-)

> +	if (looplist_open(&ll, LLFLG_USEDONLY) == -1) {
> +		error(_("%s: /dev directory does not exist."), progname);
> +		return 1;
> +	}
> +
> +	while((fd = looplist_next(&ll)) != -1) {
> +		close(fd);
> +		ok |= del_loop(ll.name);
> +	}

 [...]

 Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2011-10-03 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 10:05 [PATCH 1/2] losetup: print verbose messages if requested Petr Uzel
2011-09-30 10:05 ` [PATCH 2/2] losetup: new -D option to delete all used loop devices Petr Uzel
2011-10-03 13:52   ` Karel Zak [this message]
2011-10-03 13:51 ` [PATCH 1/2] losetup: print verbose messages if requested Karel Zak

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=20111003135255.GI1982@nb.net.home \
    --to=kzak@redhat.com \
    --cc=petr.uzel@suse.cz \
    --cc=util-linux@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 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).