On 11/10/2009 01:33 PM, Peter Jones wrote: > On 11/10/2009 11:56 AM, Ales Kozumplik wrote: >> --- a/loader2/method.c >> +++ b/loader2/method.c >> @@ -644,8 +644,11 @@ int copyFileAndLoopbackMount(int fd, char * dest, >> 2 - could not mount device as ext2, vfat, or iso9660 >> 3 - file named path not there >> */ >> +#define TRYMOUNT(fs) \ >> + (doPwMount("/tmp/srcdev", "/tmp/mnt", (fs), IMOUNT_RDONLY, NULL)) >> + > > I'm not a really big fan of using a macro for this. Why not make a helper > function that iterates a list instead? That is to say something like: > > static int tryMounts(char *src, char *dest, int flags) > { > char *fstypes[] = {"vfat","ext2","iso9660", NULL}; > int i, rc; > for (i = 0, rc = 1; rc && fstypes[i] != NULL; i++) > rc = doPwMount(src, dest, fstypes[i], flags, NULL); > return rc; > } > > And then later do: > > rc = tryMounts("/tmp/srcdev", "/tmp/mnt", IMOUNT_RDONLY); > for (i = 0; rc && i < 5; i++) { > logMessage(DEBUGLVL, "sleeping to wait for USB storage devices"); > sleep(s) > s = 1 << i; > rc = tryMounts("/tmp/srcdev", "/tmp/mnt", IMOUNT_RDONLY); > } > > This way if we change our mind about which filesystems we should check > later on, which we inevitably will, it's simple to update that list. Come to think of it, why not just call doPwMount() with "auto" like we do elsewhere? -- Peter _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list