bug-parted
[Top][All Lists]
Advanced

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

question about exception throwing and ped_device_write.


From: Sven Luther
Subject: question about exception throwing and ped_device_write.
Date: Tue, 4 Nov 2003 11:47:32 +0100
User-agent: Mutt/1.5.4i

Hello, ...

In the process of adding amiga support to parted i came to write the
following construct :

        if (_amiga_checksum (blk) != 0) {
                switch (ped_exception_throw(PED_EXCEPTION_ERROR,
                        PED_EXCEPTION_FIX | PED_EXCEPTION_IGNORE |
                        PED_EXCEPTION_CANCEL,
                        _("%s : Bad checksum on block %d of type %s\n"),
                        __func__, block,
                        _amiga_block_id(blk->amiga_ID)))
                {
                        case PED_EXCEPTION_CANCEL :
                                return NULL;
                        case PED_EXCEPTION_FIX :
                                _amiga_calculate_checksum(AMIGA(blk));
                                ped_device_write (dev, blk, block, 1);
                        case PED_EXCEPTION_IGNORE :
                        case PED_EXCEPTION_UNHANDLED :
                        default :
                                return blk;
                }
        }

So, i check the checksum of the block, and ask if the checksum should be
fixed if it is wrong.

What am i supposed to do if the ped_device_write (dev, blk, block, 1);
fails ? In this case something is seriously wrong, and i should raise a
PED_EXCEPTION_FATAL ?

Friendly,

Sven Luther




reply via email to

[Prev in Thread] Current Thread [Next in Thread]