diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-01-12 16:32:04 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2005-01-12 16:32:04 +0800 |
commit | 711aef3d0d01b3b89dc21eab77969af28daa1edc (patch) | |
tree | 04805210f54fe5e82b4069278d59f274dff6b2f4 /sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c | |
parent | 4cfef9a9644ca81bb3f0b0d2aa195be3bfd25277 (diff) | |
download | marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar.gz marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar.bz2 marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar.lz marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar.xz marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.tar.zst marcuscom-ports-711aef3d0d01b3b89dc21eab77969af28daa1edc.zip |
Update to 2.9.4.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@3398 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c')
-rw-r--r-- | sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c b/sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c new file mode 100644 index 000000000..35445a042 --- /dev/null +++ b/sysutils/nautilus-cd-burner/files/patch-nautilus-burn-drive.c @@ -0,0 +1,241 @@ +--- nautilus-burn-drive.c.orig Sat Jan 8 16:59:57 2005 ++++ nautilus-burn-drive.c Wed Jan 12 03:25:59 2005 +@@ -61,6 +61,13 @@ + + #define CD_ROM_SPEED 176 + ++#if !defined(__linux) ++static int get_device_max_read_speed (char *device); ++#endif ++#if defined(__linux__) || defined(__FreeBSD__) ++static int get_device_max_write_speed (char *device); ++#endif ++ + static struct { + const char *name; + gboolean can_write_cdr; +@@ -148,7 +155,7 @@ + int *max_wr_speed, + NautilusBurnDriveType *type) + { +- char *stdout_data, *rd_speed, *wr_speed, *drive_cap; ++ char *stdout_data, *drive_cap; + + *max_rd_speed = -1; + *max_wr_speed = -1; +@@ -274,9 +281,21 @@ + { + int fd; + int mmc_profile; ++#ifdef __FreeBSD__ ++ struct cam_device *cam; ++#endif + + g_return_val_if_fail (device != NULL, NAUTILUS_BURN_MEDIA_TYPE_ERROR); + ++#ifdef __FreeBSD__ ++ cam = cam_open_device (device, O_RDWR); ++ if (cam == NULL) { ++ return NAUTILUS_BURN_MEDIA_TYPE_ERROR; ++ } ++ ++ fd = cam->fd; ++#else ++ + fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); + if (fd < 0) { + if (errno == EBUSY) { +@@ -284,6 +303,7 @@ + } + return NAUTILUS_BURN_MEDIA_TYPE_ERROR; + } ++#endif + + mmc_profile = get_mmc_profile (fd); + +@@ -311,7 +331,11 @@ + } + } + ++#ifdef __FreeBSD__ ++ cam_close_device (cam); ++#else + close (fd); ++#endif + + switch (mmc_profile) { + case -1: +@@ -481,10 +505,21 @@ + int secs; + int mmc_profile; + gint64 size; ++#ifdef __FreeBSD__ ++ struct cam_device *cam; ++#endif + + g_return_val_if_fail (device != NULL, NAUTILUS_BURN_MEDIA_SIZE_UNKNOWN); + + secs = 0; ++#ifdef __FreeBSD__ ++ cam = cam_open_device (device, O_RDWR); ++ if (cam == NULL) { ++ return NAUTILUS_BURN_MEDIA_SIZE_UNKNOWN; ++ } ++ ++ fd = cam->fd; ++#else + + fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); + if (fd < 0) { +@@ -493,6 +528,7 @@ + } + return NAUTILUS_BURN_MEDIA_SIZE_UNKNOWN; + } ++#endif + + mmc_profile = get_mmc_profile (fd); + +@@ -515,7 +551,11 @@ + size = NAUTILUS_BURN_MEDIA_SIZE_NA; + } + ++#ifdef __FreeBSD__ ++ cam_close_device (cam); ++#else + close (fd); ++#endif + + return size; + } +@@ -639,9 +679,81 @@ + #endif /* USE_HAL */ + + #if defined(__linux__) || defined(__FreeBSD__) ++static int ++get_device_max_write_speed (char *device) ++{ ++ int fd; ++ int max_speed; ++ int read_speed, write_speed; ++#ifdef __FreeBSD__ ++ struct cam_device *cam; ++#endif ++ ++ max_speed = -1; ++#ifdef __FreeBSD__ ++ cam = cam_open_device (device, O_RDWR); ++ if (cam == NULL) { ++ return -1; ++ } ++ ++ fd = cam->fd; ++#else ++ ++ fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); ++ if (fd < 0) { ++ return -1; ++ } ++#endif ++ ++ get_read_write_speed (fd, &read_speed, &write_speed); ++#ifdef __FreeBSD__ ++ cam_close_device (cam); ++#else ++ close (fd); ++#endif ++ max_speed = (int)floor (write_speed) / CD_ROM_SPEED; ++ ++ return max_speed; ++} ++ ++#if !defined(__linux) ++static int ++get_device_max_read_speed (char *device) ++{ ++ int fd; ++ int max_speed; ++ int read_speed, write_speed; ++#ifdef __FreeBSD__ ++ struct cam_device *cam; ++#endif ++ ++ max_speed = -1; ++#ifdef __FreeBSD__ ++ cam = cam_open_device (device, O_RDWR); ++ if (cam == NULL) { ++ return -1; ++ } + ++ fd = cam->fd; ++#else + ++ fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); ++ if (fd < 0) { ++ return -1; ++ } ++#endif ++ ++ get_read_write_speed (fd, &read_speed, &write_speed); ++#ifdef __FreeBSD__ ++ cam_close_device (cam); ++#else ++ close (fd); ++#endif ++ max_speed = (int)floor (read_speed) / CD_ROM_SPEED; + ++ return max_speed; ++} ++#endif + #endif /* __linux__ || __FreeBSD__ */ + + #if defined (__linux__) +@@ -853,49 +965,7 @@ + return NULL; + } + +-#if !defined(__linux) +-static int +-get_device_max_read_speed (char *device) +-{ +- int fd; +- int max_speed; +- int read_speed, write_speed; +- +- max_speed = -1; +- +- fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); +- if (fd < 0) { +- return -1; +- } +- +- get_read_write_speed (fd, &read_speed, &write_speed); +- close (fd); +- max_speed = (int)floor (read_speed) / CD_ROM_SPEED; +- +- return max_speed; +-} +-#endif +- +-static int +-get_device_max_write_speed (char *device) +-{ +- int fd; +- int max_speed; +- int read_speed, write_speed; +- +- max_speed = -1; + +- fd = open (device, O_RDWR|O_EXCL|O_NONBLOCK); +- if (fd < 0) { +- return -1; +- } +- +- get_read_write_speed (fd, &read_speed, &write_speed); +- close (fd); +- max_speed = (int)floor (write_speed) / CD_ROM_SPEED; +- +- return max_speed; +-} + + static char * + get_scsi_cd_name (int bus, |