diff options
author | Dave Chapman <dave@dchapman.com> | 2006-12-13 20:26:44 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-12-13 20:26:44 +0000 |
commit | 8280c8c0945a7fe4beb484539c3365d7177ab5e2 (patch) | |
tree | 681fb6a4f47fb828121bd7eda3875c2dddf44117 | |
parent | 1936f7c460acdc4410db94a94ca82937eee2c9d6 (diff) | |
download | rockbox-8280c8c0945a7fe4beb484539c3365d7177ab5e2.tar.gz rockbox-8280c8c0945a7fe4beb484539c3365d7177ab5e2.zip |
Sector-size detection on Posix platforms - tested on Linux and Mac OS X. Based on patch #6433 by Bryan Childs.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11752 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | docs/CREDITS | 2 | ||||
-rw-r--r-- | tools/ipodpatcher/ipodio-posix.c | 22 |
2 files changed, 20 insertions, 4 deletions
diff --git a/docs/CREDITS b/docs/CREDITS index 5a30adce6a..d2f30058a4 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -254,4 +254,4 @@ Will Robertson | |||
254 | Stephane Doyon | 254 | Stephane Doyon |
255 | Robert Carboneau | 255 | Robert Carboneau |
256 | Ye Wei | 256 | Ye Wei |
257 | 257 | Bryan Childs | |
diff --git a/tools/ipodpatcher/ipodio-posix.c b/tools/ipodpatcher/ipodio-posix.c index cfded35390..4b55d62629 100644 --- a/tools/ipodpatcher/ipodio-posix.c +++ b/tools/ipodpatcher/ipodio-posix.c | |||
@@ -24,6 +24,22 @@ | |||
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <sys/ioctl.h> | ||
28 | #include <sys/mount.h> | ||
29 | #if defined(__APPLE__) && defined(__MACH__) | ||
30 | #include <sys/disk.h> | ||
31 | #endif | ||
32 | |||
33 | #if defined(linux) || defined (__linux) | ||
34 | #define IPOD_SECTORSIZE_IOCTL BLKSSZGET | ||
35 | #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \ | ||
36 | || defined(__bsdi__) || defined(__DragonFly__) | ||
37 | #define IPOD_SECTORSIZE_IOCTL DIOCGSECTORSIZE | ||
38 | #elif defined(__APPLE__) && defined(__MACH__) | ||
39 | #define IPOD_SECTORSIZE_IOCTL DKIOCGETBLOCKSIZE | ||
40 | #else | ||
41 | #error No sector-size detection implemented for this platform | ||
42 | #endif | ||
27 | 43 | ||
28 | #include "ipodio.h" | 44 | #include "ipodio.h" |
29 | 45 | ||
@@ -40,9 +56,9 @@ int ipod_open(HANDLE* dh, char* diskname, int* sector_size) | |||
40 | return -1; | 56 | return -1; |
41 | } | 57 | } |
42 | 58 | ||
43 | /* TODO: Detect sector size */ | 59 | if(ioctl(*dh,IPOD_SECTORSIZE_IOCTL,sector_size) < 0) { |
44 | *sector_size = 512; | 60 | fprintf(stderr,"[ERR] ioctl() call to get sector size failed\n"); |
45 | 61 | } | |
46 | return 0; | 62 | return 0; |
47 | } | 63 | } |
48 | 64 | ||