Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 363a504 in mainline


Ignore:
Timestamp:
2015-11-17T10:49:42Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
f97f5cc2
Parents:
f63a0073
Message:

Fix empty partition detection to work with ISO 9660.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/volsrv/empty.c

    rf63a0073 r363a504  
    4343#include "empty.h"
    4444
     45/*
     46 * The partition will be considered empty if at least a minimum number of
     47 * bytes *and* blocks (whichever is larger) at the beginning and end of
     48 * the partition is zero.
     49 */
     50enum {
     51        min_empty_bytes = 16384,
     52        /*
     53         * First block in ISO 9660 that cannot be empty is the first
     54         * volume descriptor at LBA 16
     55         */
     56        min_empty_blocks = 17
     57};
     58
    4559static bool mem_is_zero(void *buf, size_t size)
    4660{
     
    7286
    7387        /* Check first 16 kiB / 16 blocks, whichever is more */
    74         n = (16384 + block_size - 1) / block_size;
    75         if (n < 16)
    76                 n = 16;
     88        n = (min_empty_bytes + block_size - 1) / block_size;
     89        if (n < min_empty_blocks)
     90                n = min_empty_blocks;
    7791        /*
    7892         * Limit to half of the device so we do not process the same blocks
Note: See TracChangeset for help on using the changeset viewer.