1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-15 19:35:49 +00:00
mpv/fibmap_mplayer.c
arpi 2f6b07dba8 all error/warn/info messages moved to help_mp-en.h for translation
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1974 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-09-26 21:35:14 +00:00

36 lines
773 B
C

#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) {
fprintf(stderr,"Bad usage.\n");
return 1;
}
if ((fd = open(argv[1], O_RDONLY)) == -1) {
fprintf(stderr,"Cannot open file %s: %s\n",
argv[1] ? argv[1] : "(NULL)", strerror(errno));
return 1;
}
if (ioctl(fd, FIBMAP, &lba) != 0) {
fprintf(stderr,"fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
close(fd);
return 1;
}
close(fd);
fprintf(stderr,"%d\n",lba);
return 0;
}