blob: b26d1a0f74eba0c2fe510bf8656f501abaee18b7 (
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
49
50
51
52
|
/*
* Copyright (C) 2014 John Crispin <blogic@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <sys/mount.h>
#include <stdio.h>
#include <stdlib.h>
#include "libfstools.h"
#include "volume.h"
static LIST_HEAD(drivers);
void
volume_register_driver(struct driver *d)
{
struct driver *cur, *tmp;
list_for_each_entry_safe(cur, tmp, &drivers, list) {
if (d->priority <= cur->priority)
continue;
_list_add(&d->list, cur->list.prev, &cur->list);
return;
}
list_add_tail(&d->list, &drivers);
}
struct volume* volume_find(char *name)
{
struct volume *v;
struct driver *d;
list_for_each_entry(d, &drivers, list) {
if (d->find) {
v = d->find(name);
if (v)
return v;
}
}
return NULL;
}
|