Discussion:
[felix@fkurth.de: Re: [Ogle-user] libdvdread: Can't seek to block 256]
H}kan Hjort
2003-12-10 13:12:00 UTC
Permalink
Hi,

see the attached bugreport.

There is a problem with the seek call in device.c. It seems that
it's not supported to do a cast to off_t of an integer (or it's not
supported to do multiplication of two off_t) in all cases. It might
simply be a bug in GCC but it would be good if this could be resolved
somehow.

It might be worth to print the result of the multiplication to see what
that gives. If it's a compiler bug then just storing it in a local
variable might cure it.
I'll try to work on solving this, but can't reporoduce it my self so
have to rely on the reporter.

Any ideas how to rewrite this to work better?
--
Håkan Hjort
Sam Hocevar
2003-12-10 13:31:22 UTC
Permalink
Post by H}kan Hjort
There is a problem with the seek call in device.c. It seems that
it's not supported to do a cast to off_t of an integer (or it's not
supported to do multiplication of two off_t) in all cases. It might
simply be a bug in GCC but it would be good if this could be resolved
somehow.
The code relies on off_t being 64 bits (hence the -D__USE_UNIX98
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE flags). Looks like an
incompatibility between the libc and its headers.

I would very much like to know on what distribution it was compiled,
with what compiler and what libc headers. Also I'd like to know on what
distribution it was run, with what libc version. A compilation log might
be useful as well.
Post by H}kan Hjort
Any ideas how to rewrite this to work better?
If the libc headers refuse to declare off_t as being __off64_t, I
don't think anything can be done at the code level.

Regards,
--
Sam.
--
This is the libdvdcss-devel mailing-list, see http://developers.videolan.org/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <***@videolan.org>
H}kan Hjort
2003-12-10 19:53:48 UTC
Permalink
Post by Sam Hocevar
Post by H}kan Hjort
There is a problem with the seek call in device.c. It seems that
it's not supported to do a cast to off_t of an integer (or it's not
supported to do multiplication of two off_t) in all cases. It might
simply be a bug in GCC but it would be good if this could be resolved
somehow.
The code relies on off_t being 64 bits (hence the -D__USE_UNIX98
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE flags). Looks like an
incompatibility between the libc and its headers.
I would very much like to know on what distribution it was compiled,
with what compiler and what libc headers. Also I'd like to know on what
distribution it was run, with what libc version. A compilation log might
be useful as well.
Still not sure what causes this but rewriting the code as in the attached
patch seems to have cured the problems.
--
Håkan Hjort
Felix Kurth
2003-12-10 20:17:06 UTC
Permalink
Yes it works fine.
Post by H}kan Hjort
Still not sure what causes this but rewriting the code as in the attached
patch seems to have cured the problems.
--
Felix Kurth
pgp public key: http://www.fkurth.de/keys/felix.fkurth.asc
key fingerprint: D401 DCF8 2BF8 50DF 2FAD 8136 C29B 83EE C0A1 F2AD
Sam Hocevar
2003-12-11 15:30:21 UTC
Permalink
Post by H}kan Hjort
Still not sure what causes this but rewriting the code as in the attached
patch seems to have cured the problems.
Okay, applied. I also cast DVDCSS_BLOCK_SIZE to off_t, so can you
confirm the CVS tree now works?
--
Sam.
--
This is the libdvdcss-devel mailing-list, see http://developers.videolan.org/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <***@videolan.org>
Felix Kurth
2003-12-12 00:17:56 UTC
Permalink
Post by Sam Hocevar
Okay, applied. I also cast DVDCSS_BLOCK_SIZE to off_t, so can you
confirm the CVS tree now works?
No, it doesnt work.
I think the problem is a firmware bug in my drive. (Plextor PX-708A-DVD+-RW)
The solution ist :
Simply put a cd in the tray after booting the machine, waiting for spinning
up. unload it, and then insert the dvd. Now it just works.
I came on the thought by reading jörg schilling's anouncement
http://article.gmane.org/gmane.comp.audio.cd-record/2111/match=+cdrtools+-2+01a20+ready
he writes:
"Work around for a problem in the Plextor 708 firmware (at least 1.01..1.02)
that caused cdrecord to be unable to recognise that a DVD medium is present
instead of a CD medium."

So i want to call him for more info about that.
or wait for plextor for fixing the firmware.

thanks you for your help

felix

btw.,
i checked it out with tw following code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>

int main()
{
int fd;
off_t offs;
int i;
char buf[128];
fd=open("/dev/hdc",O_RDONLY);
if(fd<0)
exit(1);
i=0;
while(1==1)
{
offs=(off_t)lseek(fd,(off_t)(i),SEEK_SET);
if(offs<(off_t)0)
{
printf("died at i=%d, pos=%lld, errno=%d\n",
i,(off_t)i*1024*1024,errno);
exit(2);
}
printf("ok at i=%d,pos=%lld\n",i,(off_t)offs);
/*
if(read(fd,buf,64)!=64)
{
printf("read -b died, errno=%d\n",errno); -A
exit(3);
}
*/
i++;
}

return(0);
}

compiled it with
gcc -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -g3 -o test test.c
--
Felix Kurth
pgp public key: http://www.fkurth.de/keys/felix.fkurth.asc
key fingerprint: D401 DCF8 2BF8 50DF 2FAD 8136 C29B 83EE C0A1 F2AD
Loading...