3 #include <grub/types.h>
4 #include <grub/util/deviceiter.h>
5 #include <grub/util/ofpath.h>
6 #include <grub/util/misc.h>
8 /* Since OF path names can have "," characters in them, and GRUB
9 internally uses "," to indicate partitions (unlike OF which uses
10 ":" for this purpose) we escape such commas. */
13 escape_of_path (const char *orig_path
)
15 char *new_path
, *d
, c
;
18 if (!strchr (orig_path
, ','))
19 return (char *) orig_path
;
21 new_path
= xmalloc (strlen (orig_path
) * 2);
25 while ((c
= *p
++) != '\0')
32 free ((char *) orig_path
);
38 grub_util_emit_devicemap_entry (FILE *fp
, char *name
, int is_floppy UNUSED
,
39 int *num_fd UNUSED
, int *num_hd UNUSED
)
41 const char *orig_path
= grub_util_devname_to_ofpath (name
);
42 char *ofpath
= escape_of_path (orig_path
);
44 fprintf(fp
, "(%s)\t%s\n", ofpath
, name
);