All pastes #15145 Raw Edit

Miscellany

public text v1 · immutable
#15145 ·published 2005-06-20 21:19 UTC
rendered paste body
    /* check whether device has "removable" attribute with value '1' */
    removable = get_blockdev_attr( blockdevpath, "removable" );

    /* if not, fall back to bus scanning (regard USB and FireWire as removable) */
    if( !removable )
        removable = find_bus_ancestry( dev, hotplug_buses );
    sysfs_close_device( dev );

    if( !removable )
        fprintf( stderr, _("Error: device %s is not removable\n"), device );

    return removable;