8 #include <linux/types.h>
9 #include <linux/errno.h>
10 #include <linux/string.h>
13 #include <asm/timex.h>
17 #define DBFS_D2FC_HDR_VERSION 0
19 static char local_guest[] =
" ";
20 static char all_guests[] =
"* ";
21 static char *guest_query;
57 unsigned long residual_cnt;
63 parm_list.
addr = (
unsigned long) addr ;
73 :
"=d" (residual_cnt),
"+d" (rc) :
"0" (&parm_list) :
"memory");
75 if ((rc != 0 ) && (rc != -2))
90 size = diag2fc(0, query,
NULL);
96 if (diag2fc(size, query, data + offset) == 0)
105 static void diag2fc_free(
const void *data)
110 #define ATTRIBUTE(sb, dir, name, member) \
113 rc = hypfs_create_u64(sb, dir, name, member); \
115 return PTR_ERR(rc); \
119 struct dentry *systems_dir,
123 struct dentry *guest_dir, *cpus_dir, *samples_dir, *mem_dir;
124 int dedicated_flag, capped_value;
126 capped_value = (data->
flags & 0x00000006) >> 1;
127 dedicated_flag = (data->
flags & 0x00000008) >> 3;
133 guest_dir =
hypfs_mkdir(sb, systems_dir, guest_name);
134 if (IS_ERR(guest_dir))
135 return PTR_ERR(guest_dir);
140 if (IS_ERR(cpus_dir))
141 return PTR_ERR(cpus_dir);
143 ATTRIBUTE(sb, cpus_dir,
"capped", capped_value);
144 ATTRIBUTE(sb, cpus_dir,
"dedicated", dedicated_flag);
153 return PTR_ERR(mem_dir);
160 samples_dir =
hypfs_mkdir(sb, guest_dir,
"samples");
161 if (IS_ERR(samples_dir))
162 return PTR_ERR(samples_dir);
176 unsigned int count = 0;
179 data = diag2fc_store(guest_query, &count, 0);
181 return PTR_ERR(data);
214 for (i = 0; i <
count; i++) {
215 rc = hpyfs_vm_create_guest(sb, dir, &(data[i]));
240 static int dbfs_diag2fc_create(
void **data,
void **data_free_ptr,
size_t *size)
245 d2fc = diag2fc_store(guest_query, &count,
sizeof(d2fc->
hdr));
247 return PTR_ERR(d2fc);
248 get_clock_ext(d2fc->
hdr.tod_ext);
252 memset(&d2fc->
hdr.reserved, 0,
sizeof(d2fc->
hdr.reserved));
254 *data_free_ptr = d2fc;
261 .data_create = dbfs_diag2fc_create,
262 .data_free = diag2fc_free,
269 if (diag2fc(0, all_guests,
NULL) > 0)
270 guest_query = all_guests;
271 else if (diag2fc(0, local_guest,
NULL) > 0)
272 guest_query = local_guest;