[Libburn] Commenting, progress changed, enhanced status
Tiago Cogumbreiro
cogumbreiro@linus.uac.pt
Sun, 07 Dec 2003 02:31:51 -0100
--=-tvm7la4lE/cETJvyDYEu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Here's my quick changelog:
+ Commented progress
+ Changed some progress fields
+ Put the drive status into libburn.h
+ Added WRITING_LEADIN and WRITING_LEADOUT into status
I do know the copyright issues and i agree with them, this appliesall
the forthcoming patches if not stated otherwise.
Tiago Cogumbreiro
--=-tvm7la4lE/cETJvyDYEu
Content-Disposition: attachment; filename=progress_status.diff
Content-Type: text/x-patch; name=progress_status.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
? libburn/.drive.c.swp
? libburn/.libburn.h.swp
? libburn/.read.c.swp
? test/.blank.c.swp
Index: libburn/drive.c
===================================================================
RCS file: /cvs/burn/burn/libburn/drive.c,v
retrieving revision 1.230
diff -p -u -r1.230 drive.c
--- libburn/drive.c 5 Dec 2003 02:50:51 -0000 1.230
+++ libburn/drive.c 7 Dec 2003 03:24:51 -0000
@@ -145,7 +145,6 @@ void libburn_wait_all()
void libburn_erase_disc_sync(struct drive *d, int fast)
{
- int p;
libburn_message_clear_queue();
libburn_print(1, "erasing drive %s %s\n", d->idata->vendor,
@@ -157,28 +156,23 @@ void libburn_erase_disc_sync(struct driv
d->busy = LIBBURN_BUSY_ERASING;
d->erase(d, fast);
/* reset the progress */
- d->progress.session = 1;
+ d->progress.session = 0;
d->progress.sessions = 1;
- d->progress.track = 1;
+ d->progress.track = 0;
d->progress.tracks = 1;
- d->progress.index = 1;
+ d->progress.index = 0;
d->progress.indices = 1;
- d->progress.abs_sectors = 0x10000;
- d->progress.rel_sectors = 0x10000;
- d->progress.rel_sector = 0;
- d->progress.abs_sector = 0;
+ d->progress.start_sector = 0;
+ d->progress.end_sector = 0x10000;
+ d->progress.current_sector = 0;
/* read the initial 0 stage */
while(d->get_erase_progress(d) == 0)
usleep(1000);
- while((p = d->get_erase_progress(d)) > 0) {
- d->progress.abs_sector = p;
- d->progress.rel_sector = p;
+ while((d->progress.current_sector = d->get_erase_progress(d)) > 0)
usleep(1000);
- }
- d->progress.abs_sector = 0x10000;
- d->progress.rel_sector = 0x10000;
+ d->progress.current_sector = 0x10000;
d->busy = LIBBURN_BUSY_NO;
}
Index: libburn/drive.h
===================================================================
RCS file: /cvs/burn/burn/libburn/drive.h,v
retrieving revision 1.75
diff -p -u -r1.75 drive.h
--- libburn/drive.h 28 Nov 2003 05:05:22 -0000 1.75
+++ libburn/drive.h 7 Dec 2003 03:24:51 -0000
@@ -17,25 +17,6 @@ struct mempage;
#define LEAD_OUT 4
#define SYNC 5
-/** Possible busy states for a drive */
-enum libburn_drive_busy
-{
- /** The drive is not in an operation */
- LIBBURN_BUSY_NO,
- /** The library is spawning the processes to handle a pending
- operation (A read/write/etc is about to start but hasn't quite
- yet) */
- LIBBURN_BUSY_SPAWNING,
- /** The drive is reading data from a disc */
- LIBBURN_BUSY_READING,
- /** The drive is writing data to a disc */
- LIBBURN_BUSY_WRITING,
- /** The drive is erasing a disc */
- LIBBURN_BUSY_ERASING,
- /** The drive is being grabbed */
- LIBBURN_BUSY_GRABBING
-};
-
#define SESSION_LEADOUT_ENTRY(d,s) (d)->toc->session[(s)].leadout_entry
#define CURRENT_SESSION_START(d) \
Index: libburn/libburn.h
===================================================================
RCS file: /cvs/burn/burn/libburn/libburn.h,v
retrieving revision 1.154
diff -p -u -r1.154 libburn.h
--- libburn/libburn.h 4 Dec 2003 23:47:53 -0000 1.154
+++ libburn/libburn.h 7 Dec 2003 03:24:53 -0000
@@ -405,18 +405,50 @@ struct libburn_read_opts
};
-/** Operation progress report */
+/** Possible busy states for a drive */
+enum libburn_drive_busy
+{
+ /** The drive is not in an operation */
+ LIBBURN_BUSY_NO,
+ /** The library is spawning the processes to handle a pending
+ operation (A read/write/etc is about to start but hasn't quite
+ yet) */
+ LIBBURN_BUSY_SPAWNING,
+ /** The drive is reading data from a disc */
+ LIBBURN_BUSY_READING,
+ /** The drive is writing data to a disc */
+ LIBBURN_BUSY_WRITING,
+ /** The drive is writing Lead-In */
+ LIBBURN_BUSY_WRITING_LEADIN,
+ /** The drive is writing Lead-Out */
+ LIBBURN_BUSY_WRITING_LEADOUT,
+ /** The drive is erasing a disc */
+ LIBBURN_BUSY_ERASING,
+ /** The drive is being grabbed */
+ LIBBURN_BUSY_GRABBING
+};
+
+/** Operation progress report. All values are 0 based indices.
+ * */
struct libburn_progress {
+ /** The total number of sessions */
int sessions;
+ /** Current session.*/
int session;
+ /** The total number of tracks */
int tracks;
+ /** Current track. */
int track;
+ /** The total number of indices */
int indices;
+ /** Curent index. */
int index;
- int abs_sectors;
- int abs_sector;
- int rel_sectors;
- int rel_sector;
+ /** The starting logical block address */
+ int start_sector;
+ /** The finishing logical block address */
+ int end_sector;
+ /** The current sector being processed */
+ int current_sector;
};
/** Initialize the library.
Index: libburn/write.c
===================================================================
RCS file: /cvs/burn/burn/libburn/write.c,v
retrieving revision 1.25
diff -p -u -r1.25 write.c
--- libburn/write.c 4 Dec 2003 23:47:53 -0000 1.25
+++ libburn/write.c 7 Dec 2003 03:24:55 -0000
@@ -176,6 +176,7 @@ void libburn_write_leadin(struct drive *
int first)
{
int count;
+ d->busy = LIBBURN_BUSY_WRITING_LEADIN;
printf(first?" first leadin\n":" leadin\n");
@@ -190,6 +191,7 @@ void libburn_write_leadin(struct drive *
sector_toc(d, s->track[0]->mode);
count--;
}
+ d->busy = LIBBURN_BUSY_WRITING;
}
void libburn_write_leadout(struct drive *d, const struct libburn_write_opts *o,
@@ -197,6 +199,7 @@ void libburn_write_leadout(struct drive
int mode)
{
int count;
+ d->busy = LIBBURN_BUSY_WRITING_LEADOUT;
/* XXX pass the lead out mode? */
d->rlba = -150;
printf(first?" first leadout\n":" leadout\n");
@@ -208,6 +211,7 @@ void libburn_write_leadout(struct drive
sector_lout(d, control, mode);
count--;
}
+ d->busy = LIBBURN_BUSY_WRITING;
}
void libburn_write_session(struct drive *d, const struct libburn_write_opts *o,
Index: test/blank.c
===================================================================
RCS file: /cvs/burn/burn/test/blank.c,v
retrieving revision 1.14
diff -p -u -r1.14 blank.c
--- test/blank.c 5 Dec 2003 02:50:51 -0000 1.14
+++ test/blank.c 7 Dec 2003 03:24:55 -0000
@@ -38,7 +38,7 @@ static void blank_disc(struct drive *dri
libburn_erase_disc(drive, 1);
while (libburn_drive_get_progress(drive, &p)) {
- printf("%d\n", p.abs_sector);
+ printf("%d\n", p.current_sector);
usleep(1000);
}
fprintf(stderr, "Done\n");
--=-tvm7la4lE/cETJvyDYEu--