[parted-devel] static "common" storage needs to go

Jim Meyering jim at meyering.net
Wed Mar 7 00:31:40 CET 2007


Note how so many of the libparted/label/*.c files have constructs
like this from aix.c:

static PedDiskType aix_disk_type = {
	next:		NULL,
	name:		"aix",
	ops:		&aix_disk_ops,
	features:	0
};

Normally you'd think such a struct can be declared "const",
but not here.  At least "next" and "features" are expected to change.
As such, this has to remain file-scoped static storage.  Not something
you want in a library, because such a library cannot be reentrant.

    $ for i in *.o; do echo $i; nm $i|grep ' d '; done
    aix.o
    0000000000000000 d aix_disk_type
    bsd.o
    0000000000000000 d bsd_disk_type
    dasd.o
    0000000000000000 d dasd_disk_type
    dos.o
    0000000000000020 d MBR_BOOT_CODE
    0000000000000000 d msdos_disk_type
    dvh.o
    0000000000000000 d dvh_disk_type
    efi_crc32.o
    fdasd.o
    gpt.o
    0000000000000000 d gpt_disk_type
    loop.o
    0000000000000000 d loop_disk_type
    mac.o
    0000000000000000 d mac_disk_type
    pc98.o
    0000000000000020 d MBR_BOOT_CODE
    0000000000000000 d pc98_disk_type
    rdb.o
    0000000000000000 d amiga_disk_type
    sun.o
    0000000000000000 d sun_disk_type
    vtoc.o
    [Exit 1]

The MBR_BOOT_CODE tables are easy to fix.
But the others will probably require something more invasive.



More information about the parted-devel mailing list