Re: [PATCH 2/2] losetup: new -D option to delete all used loop devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 30, 2011 at 12:05:26PM +0200, Petr Uzel wrote:
> 
> Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
> ---
>  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@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux