source: rtems/cpukit/libblock/src/bdpart-sort.c @ 66c0078

4.115
Last change on this file since 66c0078 was f6c7bcfe, checked in by Mathew Kallada <matkallada@…>, on 12/21/12 at 17:42:39

libblock: Doxygen Enhancement Task #1

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