2 * Copyright (C) 2010 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 let len = String.length dev in
23 dev.[1] = 'd' && dev.[2] = 'e' && dev.[3] = 'v' &&
25 (dev.[5] = 'h' || dev.[5] = 's' || dev.[5] = 'v') &&
27 dev.[7] >= 'a' && dev.[7] <= 'z' then (
28 let dev = Bytes.of_string dev in
35 let canonical_compare dev1 dev2 =
36 let dev1 = canonical dev1 in
37 let dev2 = canonical dev2 in
38 String.compare dev1 dev2
40 module DeviceSet = struct
44 let compare = canonical_compare
51 List.fold_left (fun set d -> add (canonical d) set) empty ds
54 of_list (Array.to_list ds)
57 "{" ^ String.concat " " (elements t) ^ "}"