Tested on FreeBSD 5.2-CURRENT as of 2003-12-28.
Tested on FreeBSD 4.9-STABLE as of 2003-12-27.
else
AC_CHECK_PROGS(BUILD_CC, gcc cc)
fi
-AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h netinet/in.h)
+AC_CHECK_HEADERS(stdlib.h unistd.h stdarg.h errno.h malloc.h mntent.h paths.h dirent.h getopt.h setjmp.h signal.h termios.h linux/fd.h linux/major.h sys/disk.h sys/disklabel.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/sockio.h sys/socket.h sys/sysmacros.h sys/time.h sys/stat.h sys/types.h sys/wait.h sys/resource.h net/if.h netinet/in.h)
AC_FUNC_VPRINTF
dnl Check to see if dirent has member d_reclen. On cygwin those d_reclen
dnl is not decleared.
*/
#ifdef HAVE_SYS_MOUNT_H
+#include <sys/param.h>
#include <sys/mount.h>
#define MNT_FL (MS_MGC_VAL | MS_RDONLY)
#endif
#include <sys/ioctl.h>
#endif
#if HAVE_SYS_MOUNT_H
+#include <sys/param.h>
#include <sys/mount.h> /* This may define BLKFLSBUF */
#endif
#include <linux/fd.h>
#endif
#ifdef HAVE_SYS_DISKLABEL_H
+#include <sys/param.h> /* for __FreeBSD_version */
#include <sys/ioctl.h>
#include <sys/disklabel.h>
#endif /* HAVE_SYS_DISKLABEL_H */
+#ifdef HAVE_SYS_DISK_H
+#include <sys/queue.h> /* for LIST_HEAD */
+#include <sys/disk.h>
+#endif /* HAVE_SYS_DISK_H */
#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
#define BLKGETSIZE _IO(0x12,96) /* return device size */
}
#endif
#ifdef HAVE_SYS_DISKLABEL_H
+#if defined(__FreeBSD__) && __FreeBSD_version < 500040
+ /* old disklabel interface */
part = strlen(file) - 1;
if (part >= 0) {
ch = file[part];
return 0;
}
}
+#else /* __FreeBSD_version < 500040 */
+ {
+ off_t ms;
+ u_int bs;
+ if (ioctl(fd, DIOCGMEDIASIZE, &ms) >= 0) {
+ *retblocks = ms / blocksize;
+ return 0;
+ }
+ }
+#endif /* __FreeBSD_version < 500040 */
#endif /* HAVE_SYS_DISKLABEL_H */
/*
static void reuse_cache(io_channel channel, struct unix_private_data *data,
struct unix_cache *cache, unsigned long block);
+#if defined(__CYGWIN__) || defined(__FreeBSD__)
+#define NEED_BOUNCE_BUFFER
+#else
+#undef NEED_BOUNCE_BUFFER
+#endif
+
static struct struct_io_manager struct_unix_manager = {
EXT2_ET_MAGIC_IO_MANAGER,
"Unix I/O Manager",
unix_read_blk,
unix_write_blk,
unix_flush,
-#ifdef __CYGWIN__
+#ifdef NEED_BOUNCE_BUFFER
0
#else
unix_write_byte
/*
* Here are the raw I/O functions
*/
-#ifndef __CYGWIN__
+#ifndef NEED_BOUNCE_BUFFER
static errcode_t raw_read_blk(io_channel channel,
struct unix_private_data *data,
unsigned long block,
size, actual, retval);
return retval;
}
-#else /* __CYGWIN__ */
+#else /* NEED_BOUNCE_BUFFER */
/*
- * Windows block devices only allow sector alignment IO in offset and size
+ * Windows and FreeBSD block devices only allow sector alignment IO in offset and size
*/
static errcode_t raw_read_blk(io_channel channel,
struct unix_private_data *data,
* %End-Header%
*/
+#ifndef __LINUX__
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(void) {
+ fputs("This program is only supported on Linux!\n", stderr);
+ exit(EXIT_FAILURE);
+}
+#else
#define _LARGEFILE64_SOURCE
#include <stdio.h>
}
return 0;
}
-
-
-
+#endif
"did you specify it correctly?\n"), stderr);
exit(1);
}
- if (!S_ISBLK(s.st_mode)) {
+#ifdef __FreeBSD__
+ /* On FreeBSD, all disk devices are character specials */
+ if (!S_ISBLK(s.st_mode) && !S_ISCHR(s.st_mode))
+#else
+ if (!S_ISBLK(s.st_mode))
+#endif
+ {
printf(_("%s is not a block special device.\n"), device);
proceed_question();
return;