2002-01-04 14:08:14 +01:00
|
|
|
|
/* (C)2001,2002 by LGB (G<>bor L<>n<EFBFBD>rt), lgb@lgb.hu
|
|
|
|
|
Part of MPlayer project, this source is copyrighted according to GNU/GPL. */
|
|
|
|
|
|
2001-06-19 02:05:27 +02:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
|
|
|
|
|
#ifndef FIBMAP
|
|
|
|
|
#define FIBMAP 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
int main ( int argc , char ** argv )
|
|
|
|
|
{
|
|
|
|
|
int fd,lba=0;
|
|
|
|
|
if (argc!=2) {
|
2001-09-26 23:35:14 +02:00
|
|
|
|
fprintf(stderr,"Bad usage.\n");
|
2001-06-19 02:05:27 +02:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if ((fd = open(argv[1], O_RDONLY)) == -1) {
|
2001-09-26 23:35:14 +02:00
|
|
|
|
fprintf(stderr,"Cannot open file %s: %s\n",
|
2001-06-19 02:05:27 +02:00
|
|
|
|
argv[1] ? argv[1] : "(NULL)", strerror(errno));
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (ioctl(fd, FIBMAP, &lba) != 0) {
|
2001-09-26 23:35:14 +02:00
|
|
|
|
fprintf(stderr,"fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
|
2001-06-19 02:05:27 +02:00
|
|
|
|
close(fd);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
close(fd);
|
2002-01-04 14:08:14 +01:00
|
|
|
|
printf("%d\n",lba);
|
2001-06-19 02:05:27 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|