Re: [PATCH] loop file resizable

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

 



On Mon, Nov 24, 2008 at 11:08:02AM +0900, hooanon05@xxxxxxxxxxx wrote:
> Subject: [PATCH 1/1] grow the size of loopback device and its backend file

 It seems that the kernel part (LOOP_SET_CAPACITY) is not restricted
 and it supports resizing in both directions (increase/decrease).
 Right?

> +int grow_file(const char *file, unsigned long long new)
> +{
[...]
> +	/*
> +	 * instread of ftrundate(2),
> +	 * allocate disk blocks to support ENOSPC
> +	 * on the loopback mounted filesystem
> +	 */
> +	err = 0;
> +	while (append > 0) {
> +		if (append < sz)
> +			sz = append;
> +		ssz = write(fd, p, sz);
> +		if (ssz == -1) {
> +			if (errno == EAGAIN || errno == EINTR)
> +				continue;
> +			err = errno;
> +			break;
> +		}
> +		append -= ssz;
> +	}

 Do we really need to hardcode this functionality to losetup(8)? Maybe
 users want to use a different way how to resize the file. For example
 the latest coreutils contains a nice user-friendly "truncate" utility
 that provides all necessary functionality. 
 
 From my point of view everything what we need in losetup(8) is to
 call LOOP_SET_CAPACITY ioctl.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" 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