From f5ee0b3e93c0fbd2db8807a9c76fc1726acc9438 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 14 Jan 2008 22:47:44 +0000 Subject: [PATCH] Made improvements around volume id --- libisoburn/trunk/test/ng_xorrisoburn.c | 46 ++++++++++++++++++++++- libisoburn/trunk/test/ng_xorrisoburn.h | 3 ++ libisoburn/trunk/test/xorriso.1 | 6 +++ libisoburn/trunk/test/xorriso.c | 5 ++- libisoburn/trunk/test/xorriso_private.h | 1 + libisoburn/trunk/test/xorriso_timestamp.h | 2 +- 6 files changed, 59 insertions(+), 4 deletions(-) diff --git a/libisoburn/trunk/test/ng_xorrisoburn.c b/libisoburn/trunk/test/ng_xorrisoburn.c index a94cfdba..21fd371c 100644 --- a/libisoburn/trunk/test/ng_xorrisoburn.c +++ b/libisoburn/trunk/test/ng_xorrisoburn.c @@ -42,7 +42,8 @@ #include "xorriso_private.h" /* The inner isofs- and burn-library interface */ -#include "xorrisoburn.h" +/* >>> NG */ +#include "ng_xorrisoburn.h" int Xorriso_pacifier_loop(struct XorrisO *xorriso, struct burn_drive *drive, @@ -164,6 +165,19 @@ int Xorriso_set_image_severities(struct XorrisO *xorriso, IsoImage *volset, } +int Xorriso_update_volid(struct XorrisO *xorriso, int flag) +{ + int gret, sret= 1; + + gret= Xorriso_get_volid(xorriso, xorriso->loaded_volid, 0); + if(gret>0 && strcmp(xorriso->volid, "ISOIMAGE")==0) + strcpy(xorriso->volid, xorriso->loaded_volid); + else + sret= Xorriso_set_volid(xorriso, xorriso->volid, 1); + return(gret>0 && sret>0); +} + + int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag) { int ret; @@ -181,6 +195,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag) if(xorriso->in_volset_handle!=NULL) { iso_image_unref((IsoImage *) xorriso->in_volset_handle); xorriso->in_volset_handle= NULL; + xorriso->loaded_volid[0]= 0; xorriso->volset_change_pending= 0; } memset(&ropts, sizeof(ropts), 0); @@ -195,6 +210,7 @@ int Xorriso_create_empty_iso(struct XorrisO *xorriso, int flag) } xorriso->in_volset_handle= (void *) volset; Xorriso_set_image_severities(xorriso, volset, 0); + Xorriso_update_volid(xorriso, 0); xorriso->volset_change_pending= 0; return(1); } @@ -330,6 +346,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) } xorriso->in_volset_handle= (void *) volset; Xorriso_set_image_severities(xorriso, volset, 0); + Xorriso_update_volid(xorriso, 0); if(xorriso->out_drive_handle != NULL && xorriso->out_drive_handle != xorriso->in_drive_handle) { @@ -342,6 +359,14 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag) } Xorriso_process_msg_queues(xorriso,0); Xorriso_toc(xorriso, 1); + if(xorriso->loaded_volid[0]!=0) { + sprintf(xorriso->result_line,"Volume id : '%s'\n",xorriso->loaded_volid); + Xorriso_result(xorriso,0); + if(strcmp(xorriso->loaded_volid, xorriso->volid)!=0) { + sprintf(xorriso->result_line, "New volume id: '%s'\n", xorriso->volid); + Xorriso_result(xorriso,0); + } + } ret= 1+not_writeable; ex: if(ret<=0) { @@ -383,6 +408,7 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag) if(xorriso->in_volset_handle!=NULL) iso_image_unref((IsoImage *) xorriso->in_volset_handle); xorriso->in_volset_handle= NULL; + xorriso->loaded_volid[0]= 0; xorriso->volset_change_pending= 0; in_is_out_too= 0; @@ -3126,6 +3152,7 @@ ex:; } +/* @param flag bit0= do not mark image as changed */ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag) { int ret; @@ -3135,8 +3162,25 @@ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag) if(ret<=0) return(ret); iso_image_set_volume_id(volume, volid); + if(!(flag&1)) + xorriso->volset_change_pending= 1; Xorriso_process_msg_queues(xorriso,0); + sprintf(xorriso->info_text,"Volume ID: '%s'",iso_image_get_volume_id(volume)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); return(1); } +int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag) +{ + int ret; + IsoImage *volume; + + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + strncpy(volid, iso_image_get_volume_id(volume), 32); + volid[32]= 0; + return(1); +} + diff --git a/libisoburn/trunk/test/ng_xorrisoburn.h b/libisoburn/trunk/test/ng_xorrisoburn.h index 18a8c3d5..39aba229 100644 --- a/libisoburn/trunk/test/ng_xorrisoburn.h +++ b/libisoburn/trunk/test/ng_xorrisoburn.h @@ -127,7 +127,10 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job, void *dir_node_generic, char *dir_path, struct stat *dir_stbuf, int depth, int flag); +/* @param flag bit0= do not mark image as changed */ int Xorriso_set_volid(struct XorrisO *xorriso, char *volid, int flag); +int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag); + #endif /* Xorrisoburn_includeD */ diff --git a/libisoburn/trunk/test/xorriso.1 b/libisoburn/trunk/test/xorriso.1 index 0d5b8487..aabdfb3b 100644 --- a/libisoburn/trunk/test/xorriso.1 +++ b/libisoburn/trunk/test/xorriso.1 @@ -824,6 +824,12 @@ If enabled by "on", generate Joliet info additional to Rock Ridge info. Specifies the volume ID. The text may be up to 32 characters long. Be aware that it might get used automatically as name of the mount point when the media is inserted into a playful computer system. +.br +If an ISO image gets loaded while the volume ID is set to default "ISOIMAGE", +then the volume ID of the loaded image will become the new -volid setting. +Consider this when setting -volid "ISOIMAGE" before executing -dev, -indev, +or -rollback. +If you insist in -volid "ISOIMAGE", set it again after those commands. .TP \fB\-uid\fR uid User id to be used for all files when the new ISO tree gets written to media. diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index bde7c6cb..e2569169 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -2856,7 +2856,8 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) m->do_follow_mount= 1; m->do_global_uid= 0; m->global_uid= 0; - m->volid[0]= 0; + strcpy(m->volid, "ISOIMAGE"); + m->loaded_volid[0]= 0; m->do_global_gid= 0; m->global_gid= 0; m->do_global_mode= 0; @@ -3948,7 +3949,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag) if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); - is_default= (xorriso->volid[0]==0); + is_default= (strcmp(xorriso->volid, "ISOIMAGE")==0); sprintf(line,"-volid %s\n",Text_shellsafe(xorriso->volid,sfe,0)); if(!(is_default && no_defaults)) Xorriso_status_result(xorriso,filter,fp,flag&2); diff --git a/libisoburn/trunk/test/xorriso_private.h b/libisoburn/trunk/test/xorriso_private.h index 409c7e89..b0b6e5b7 100644 --- a/libisoburn/trunk/test/xorriso_private.h +++ b/libisoburn/trunk/test/xorriso_private.h @@ -84,6 +84,7 @@ struct XorrisO { /* the global context of xorriso */ int do_reassure; /* 0=off, 1=on, 2=tree */ char volid[33]; + char loaded_volid[33]; /* >>> put libburn/isoburn aspects here */ diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index bd7d9a9d..3e753187 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.01.14.190220" +#define Xorriso_timestamP "2008.01.14.224645"