Re: [hatari-devel] Using device files as drive images?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On sunnuntai 12 lokakuu 2014, Uwe Seimet wrote:
> This is what happens:
> >ls -al /dev/sdc
> 
> brwxrwxrwx 1 root disk 8, 32 Oct 12 08:40 /dev/sdc
> 
> >hatari --conout 2 --trace ide --ide-master /dev/sdc
....
> Error while parsing argument "/dev/sdc" for option "--ide-master":
>   Given file doesn't exist (or has wrong file permissions)!
....
> /dev/sdc has rwx (just rw also does not work) permissions for all, so I
> would expect it to work. On your machine this seems to be working, which
> file permissions does your device file have?

Personally I haven't tried device files for HD image files, but
the same File_Exists() function has worked for other device files
(e.g. floppy and MIDI in & out).

I don't see why that would fail in your case. [1]

Could you provide "strace -e stat64 <hatari...>" output?


	 - Eero

[1] It does just:
-------- file.c -----------
/**
 * Return TRUE if file exists, is readable or writable at least and is not
 * a directory.
 */
bool File_Exists(const char *filename)
{
        struct stat buf;
        if (stat(filename, &buf) == 0 &&
            (buf.st_mode & (S_IRUSR|S_IWUSR)) && !(buf.st_mode & S_IFDIR))
        {
                /* file points to user readable regular file */
                return true;
        }
        return false;
}
---------------------------------

And is called like this:
-------- options.c ------------
static bool Opt_StrCpy(int optid, bool checkexist, char *dst, const char 
*src, size_t dstlen, bool *option)
{
....
        if (checkexist && !File_Exists(src))
        {
                return Opt_ShowError(optid, src, "Given file doesn't exist 
(or has wrong file permissions)!");
        }
....
bool Opt_ParseParameters(int argc, const char * const argv[])
{
....
                case OPT_IDEMASTERHDIMAGE:
                        i += 1;
                        ok = Opt_StrCpy(OPT_IDEMASTERHDIMAGE, true, 
ConfigureParams.HardDisk.szIdeMasterHardDiskImage, argv[i],  
sizeof(ConfigureParams.HardDisk.szIdeMasterHardDiskImage), 
&ConfigureParams.HardDisk.bUseIdeMasterHardDiskImage);
---------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/