]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fdisk: use context as a parameter
authorDavidlohr Bueso <dave@gnu.org>
Sun, 27 May 2012 19:44:04 +0000 (21:44 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Jun 2012 08:11:41 +0000 (10:11 +0200)
commit7737f698508a9ad3b6aa0ee7e02cbaa646e815b6
treef65d64499351fdfa0154489f6641079e20edf602
parent89fd812fcbcd8829294bb9b3cf83c723ae4c86bc
fdisk: use context as a parameter

This program heavily uses global variables, which isn't very elegant and can
lead to nasty bugs. Modify functions that use fdisk's context current features
(descriptor and path), to receive the context as a parameter instead of
globally. This includes DOS, SUN, SGI and BSD label code. Another benefit that
comes with this is that as the API grows all the information regarding fdisk
will be accessible from this structure so we can reduce even more global
variables and simply code.

This patch passed:
 - building
 - regression tests
 - local dos/sun/bsd partition changes

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
fdisk/fdisk.c
fdisk/fdisk.h
fdisk/fdiskbsdlabel.c
fdisk/fdiskbsdlabel.h
fdisk/fdiskdoslabel.c
fdisk/fdiskdoslabel.h
fdisk/fdisksgilabel.c
fdisk/fdisksgilabel.h
fdisk/fdisksunlabel.c
fdisk/fdisksunlabel.h