* sfdisk enhancement proposal - offset/shift support
@ 2011-01-14 13:31 Przemysław 'Przemoc' Pawełczyk
2011-01-14 14:20 ` Forest Bond
0 siblings, 1 reply; 3+ messages in thread
From: Przemysław 'Przemoc' Pawełczyk @ 2011-01-14 13:31 UTC (permalink / raw)
To: util-linux
Hello,
I have following suggestion for sfdisk:
- adding offset/shift support for cumbersome raw disk images (like
fixed-size VDI), that don't start at the beginning of the file.
Required changes?
IMO straightforward way is just adding another option (below is an
example), global variable (e.g. shift) and fixing sseek() code and
R.total_size in get_geometry() to take it into account.
-t# [or --offset #] ignore the number of bytes at the beginning
FWIW such option is rather useless for working on many files at the
same time, unless offsets are really the same. In case of fixed-size
VDI, offset depends on the image size.
Alternatives?
Some time ago I wrote a simple workaround for fixed-size VDIs (doing a
bit more than is needed here, i.e. finding also an offset of the raw
disk image) using LD_PRELOAD technique. It can be found here:
https://gist.github.com/571086. Now I think that having plain offset
option in sfdisk would be still useful. I even regret that I did not
mail about it back then in 2009, because maybe it would be available
in sfdisk for a long time already...
Anyway I'd like to know your opinions before making any patches. After
all I am not sure whether such functionality is acceptable in sfdisk
according to your rules.
Regards.
P.S. Please CC me (I am not on the list).
--
Przemysław 'Przemoc' Pawełczyk
http://przemoc.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sfdisk enhancement proposal - offset/shift support
2011-01-14 13:31 sfdisk enhancement proposal - offset/shift support Przemysław 'Przemoc' Pawełczyk
@ 2011-01-14 14:20 ` Forest Bond
2011-01-14 15:45 ` Przemysław 'Przemoc' Pawełczyk
0 siblings, 1 reply; 3+ messages in thread
From: Forest Bond @ 2011-01-14 14:20 UTC (permalink / raw)
To: Przemysław 'Przemoc' Pawełczyk; +Cc: util-linux
[-- Attachment #1: Type: text/plain, Size: 762 bytes --]
Hi,
On Fri, Jan 14, 2011 at 02:31:55PM +0100, Przemysław 'Przemoc' Pawełczyk wrote:
> I have following suggestion for sfdisk:
> - adding offset/shift support for cumbersome raw disk images (like
> fixed-size VDI), that don't start at the beginning of the file.
>
> Required changes?
> IMO straightforward way is just adding another option (below is an
> example), global variable (e.g. shift) and fixing sseek() code and
> R.total_size in get_geometry() to take it into account.
>
> -t# [or --offset #] ignore the number of bytes at the beginning
Isn't this something you can just use a loopback device for?
losetup -f -o $offset $image
Thanks,
Forest
--
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: sfdisk enhancement proposal - offset/shift support
2011-01-14 14:20 ` Forest Bond
@ 2011-01-14 15:45 ` Przemysław 'Przemoc' Pawełczyk
0 siblings, 0 replies; 3+ messages in thread
From: Przemysław 'Przemoc' Pawełczyk @ 2011-01-14 15:45 UTC (permalink / raw)
To: Forest Bond; +Cc: util-linux
2011/1/14 Forest Bond <forest@alittletooquiet.net>:
> On Fri, Jan 14, 2011 at 02:31:55PM +0100, Przemysław 'Przemoc' Pawełczyk wrote:
>> I have following suggestion for sfdisk:
>> - adding offset/shift support for cumbersome raw disk images (like
>> fixed-size VDI), that don't start at the beginning of the file.
>>
>> Required changes?
>> IMO straightforward way is just adding another option (below is an
>> example), global variable (e.g. shift) and fixing sseek() code and
>> R.total_size in get_geometry() to take it into account.
>>
>> -t# [or --offset #] ignore the number of bytes at the beginning
>
> Isn't this something you can just use a loopback device for?
>
> losetup -f -o $offset $image
To some degree -- yes. It requires BLK_DEV_LOOP (Loopback device
support) built-in in the kernel or compiled as a module though. This
is IMHO unneeded kernel dependency that can be avoided.
Regards.
P.S. mount() and umount() should have their own capability, because
requiring CAP_SYS_ADMIN is pretty insane. But it's not the scope of
this ML.
--
Przemysław 'Przemoc' Pawełczyk
http://przemoc.net/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-14 15:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 13:31 sfdisk enhancement proposal - offset/shift support Przemysław 'Przemoc' Pawełczyk
2011-01-14 14:20 ` Forest Bond
2011-01-14 15:45 ` Przemysław 'Przemoc' Pawełczyk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox