2 * Copyright (C) 2009-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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (* Please read generator/README first. *)
24 type cols = (string * field) list
26 (* Because we generate extra parsing code for LVM command line tools,
27 * we have to pull out the LVM columns separately here.
37 "pv_attr", FString (* XXX *);
38 "pv_pe_count", FInt64;
39 "pv_pe_alloc_count", FInt64;
42 "pv_mda_count", FInt64;
43 "pv_mda_free", FBytes;
45 "pv_mda_size", FBytes;
52 "vg_attr", FString (* XXX *);
56 "vg_extent_size", FBytes;
57 "vg_extent_count", FInt64;
58 "vg_free_count", FInt64;
66 "vg_mda_count", FInt64;
67 "vg_mda_free", FBytes;
69 "vg_mda_size", FBytes;
75 "lv_attr", FString (* XXX *);
78 "lv_kernel_major", FInt64;
79 "lv_kernel_minor", FInt64;
83 "snap_percent", FOptPercent;
84 "copy_percent", FOptPercent;
87 "mirror_log", FString;
91 (* Names and fields in all structures (in RStruct and RStructList)
95 (* The old RIntBool return type, only ever used for aug_defnode. Do
96 * not use this struct in any new code.
99 "i", FInt32; (* for historical compatibility *)
100 "b", FInt32; (* for historical compatibility *)
103 (* LVM PVs, VGs, LVs. *)
104 "lvm_pv", lvm_pv_cols;
105 "lvm_vg", lvm_vg_cols;
106 "lvm_lv", lvm_lv_cols;
108 (* Column names and types from stat structures.
109 * NB. Can't use things like 'st_atime' because glibc header files
110 * define some of these as macros. Ugh.
141 (* Column names in dirent structure. *)
144 (* 'b' 'c' 'd' 'f' (FIFO) 'l' 'r' (regular file) 's' 'u' '?' *)
149 (* Version numbers. *)
157 (* Extended attribute. *)
163 (* Inotify events. *)
167 "in_cookie", FUInt32;
171 (* Partition table entry. *)
174 "part_start", FBytes;
178 ] (* end of structs *)
180 (* Ugh, Java has to be different ..
181 * These names are also used by the Haskell bindings.
184 "int_bool", "IntBool";
189 "statvfs", "StatVFS";
191 "version", "Version";
193 "inotify_event", "INotifyEvent";
194 "partition", "Partition";
197 let java_name_of_struct typ =
198 try List.assoc typ java_structs
201 "java_name_of_struct: no java_structs entry corresponding to %s" typ
203 let cols_of_struct typ =
204 try List.assoc typ structs
206 failwithf "cols_of_struct: unknown struct %s" typ