blob: 52de38b442e5c6888d8c88ac6049f44ca207be0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
* @file
*
* @ingroup rtems_bdpart
*
* @brief Block Device Partition Management
*/
/*
* Copyright (c) 2009, 2010
* embedded brains GmbH
* Obere Lagerstr. 30
* D-82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <rtems.h>
#include <rtems/bdpart.h>
static int rtems_bdpart_partition_compare( const void *aa, const void *bb)
{
const rtems_bdpart_partition *a = aa;
const rtems_bdpart_partition *b = bb;
if (a->begin < b->begin) {
return -1;
} else if (a->begin == b->begin) {
return 0;
} else {
return 1;
}
}
void rtems_bdpart_sort( rtems_bdpart_partition *pt, size_t count)
{
qsort( pt, count, sizeof( *pt), rtems_bdpart_partition_compare);
}
|