248
228
if (print == PRINT_FS)
256
if (S_ISREG (st.st_mode))
258
/* Regular file. Verify that we can read it properly. */
262
grub_util_info ("reading %s via OS facilities", path);
263
filebuf_via_sys = grub_util_read_image (path);
265
rel_path = grub_make_system_path_relative_to_its_root (path);
266
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
268
grub_util_info ("reading %s via GRUB facilities", grub_path);
269
file = grub_file_open (grub_path);
271
grub_util_error ("cannot open %s via GRUB facilities", grub_path);
272
filebuf_via_grub = xmalloc (file->size);
273
grub_file_read (file, filebuf_via_grub, file->size);
275
grub_util_info ("comparing");
277
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
278
grub_util_error ("files differ");
282
230
printf ("%s\n", fs->name);
285
if (print == PRINT_FS_UUID)
232
else if (print == PRINT_FS_UUID)
289
236
grub_util_error ("%s does not support UUIDs", fs->name);
291
fs->uuid (dev, &uuid);
238
if (fs->uuid (dev, &uuid) != GRUB_ERR_NONE)
239
grub_util_error ("%s", grub_errmsg);
293
241
printf ("%s\n", uuid);
299
247
grub_util_error ("%s does not support labels", fs->name);
301
fs->label (dev, &label);
249
if (fs->label (dev, &label) != GRUB_ERR_NONE)
250
grub_util_error ("%s", grub_errmsg);
303
252
printf ("%s\n", label);