Made use of os dependend stdio size estimation
This commit is contained in:
parent
a81641aea0
commit
6a99e0d412
@ -1 +1 @@
|
|||||||
#define Cdrskin_timestamP "2007.09.09.133136"
|
#define Cdrskin_timestamP "2007.09.09.133922"
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sys/statvfs.h>
|
#include <errno.h>
|
||||||
#include "libburn.h"
|
#include "libburn.h"
|
||||||
#include "drive.h"
|
#include "drive.h"
|
||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
@ -1093,40 +1093,29 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
off_t size = ((off_t) (1024 * 1024 * 1024) * (off_t) 2048);
|
off_t size = ((off_t) (1024 * 1024 * 1024) * (off_t) 2048);
|
||||||
off_t add_size = 0;
|
|
||||||
struct burn_drive *d= NULL, *regd_d;
|
struct burn_drive *d= NULL, *regd_d;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
struct statvfs vfsbuf;
|
|
||||||
char testpath[4096];
|
|
||||||
|
|
||||||
testpath[0] = 0;
|
|
||||||
|
|
||||||
if (fname[0] != 0) {
|
if (fname[0] != 0) {
|
||||||
if (stat(fname, &stbuf) == -1) {
|
memset(&stbuf, 0, sizeof(stbuf));
|
||||||
strcpy(testpath,fname);
|
ret = stat(fname, &stbuf);
|
||||||
if(strrchr(testpath,'/') == NULL)
|
if(ret == -1 || S_ISBLK(stbuf.st_mode) ||
|
||||||
strcpy(testpath,".");
|
S_ISREG(stbuf.st_mode)) {
|
||||||
else if(strrchr(testpath,'/') == testpath)
|
ret = burn_os_stdio_capacity(fname, &size);
|
||||||
testpath[1] = 0;
|
if (ret == -1) {
|
||||||
else
|
|
||||||
*strrchr(testpath,'/') = 0;
|
|
||||||
if (stat(testpath, &stbuf) == -1) {
|
|
||||||
libdax_msgs_submit(libdax_messenger, -1,
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
0x00020009,
|
0x00020009,
|
||||||
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
"Neither stdio-path nor its directory exist",
|
"Neither stdio-path nor its directory exist",
|
||||||
0, 0);
|
0, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (ret == -2) {
|
||||||
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
|
0x00020005,
|
||||||
|
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
|
||||||
|
"Failed to open device (a pseudo-drive)",
|
||||||
|
errno, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(S_ISBLK(stbuf.st_mode)) {
|
|
||||||
|
|
||||||
/* >>> ? how to obtain the number of blocks ? */
|
|
||||||
|
|
||||||
} else if(S_ISREG(stbuf.st_mode)) {
|
|
||||||
add_size = stbuf.st_blocks * (off_t) 512;
|
|
||||||
size -= add_size;
|
|
||||||
strcpy(testpath,fname);
|
|
||||||
} else {
|
} else {
|
||||||
libdax_msgs_submit(libdax_messenger, -1,
|
libdax_msgs_submit(libdax_messenger, -1,
|
||||||
0x00020149,
|
0x00020149,
|
||||||
@ -1163,11 +1152,7 @@ int burn_drive_grab_dummy(struct burn_drive_info *drive_infos[], char *fname)
|
|||||||
d->current_is_supported_profile = 1;
|
d->current_is_supported_profile = 1;
|
||||||
d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1;
|
d->block_types[BURN_WRITE_TAO] = BURN_BLOCK_MODE1;
|
||||||
d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO;
|
d->block_types[BURN_WRITE_SAO] = BURN_BLOCK_SAO;
|
||||||
if (testpath[0])
|
d->media_capacity_remaining = size;
|
||||||
if (statvfs(testpath, &vfsbuf) != -1)
|
|
||||||
size = ((off_t) vfsbuf.f_bsize) *
|
|
||||||
(off_t) vfsbuf.f_bavail;
|
|
||||||
d->media_capacity_remaining = size + add_size;
|
|
||||||
|
|
||||||
/* >>> ? open file for a test ? */;
|
/* >>> ? open file for a test ? */;
|
||||||
|
|
||||||
@ -1972,8 +1957,6 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
|
|||||||
int status, num_formats, ret, type, i;
|
int status, num_formats, ret, type, i;
|
||||||
off_t size;
|
off_t size;
|
||||||
unsigned dummy;
|
unsigned dummy;
|
||||||
struct statvfs vfsbuf;
|
|
||||||
struct stat stbuf;
|
|
||||||
|
|
||||||
*caps = NULL;
|
*caps = NULL;
|
||||||
s = burn_disc_get_status(d);
|
s = burn_disc_get_status(d);
|
||||||
@ -2000,11 +1983,7 @@ int burn_disc_get_multi_caps(struct burn_drive *d, enum burn_write_types wt,
|
|||||||
/* stdio file dummy drive */
|
/* stdio file dummy drive */
|
||||||
o->start_adr = 1;
|
o->start_adr = 1;
|
||||||
size = d->media_capacity_remaining;
|
size = d->media_capacity_remaining;
|
||||||
if (stat(d->devname, &stbuf) != -1)
|
burn_os_stdio_capacity(d->devname, &size);
|
||||||
if(S_ISREG(stbuf.st_mode))
|
|
||||||
if (statvfs(d->devname, &vfsbuf) != -1)
|
|
||||||
size = ((off_t) vfsbuf.f_bsize) *
|
|
||||||
(off_t) vfsbuf.f_bavail;
|
|
||||||
d->media_capacity_remaining = size;
|
d->media_capacity_remaining = size;
|
||||||
o->start_range_high = size;
|
o->start_range_high = size;
|
||||||
o->start_alignment = 2048; /* imposting a drive, not a file */
|
o->start_alignment = 2048; /* imposting a drive, not a file */
|
||||||
|
Loading…
Reference in New Issue
Block a user