Implemented xorriso setter level of -fs, -gid, -uid

This commit is contained in:
Thomas Schmitt 2007-10-13 15:19:10 +00:00
parent ea7a27da8b
commit fd6377e1da
3 changed files with 77 additions and 7 deletions

View File

@ -58,6 +58,8 @@ or
#include <dirent.h> #include <dirent.h>
#include <time.h> #include <time.h>
#include <utime.h> #include <utime.h>
#include <pwd.h>
#include <grp.h>
#ifdef Xorriso_with_regeX #ifdef Xorriso_with_regeX
#include <regex.h> #include <regex.h>
@ -1712,6 +1714,7 @@ struct XorrisO { /* the global context of askme */
int do_dummy; int do_dummy;
int do_close; int do_close;
int speed; /* in libburn units : 1000 bytes/second , 0 = Max, -1 = Min */ int speed; /* in libburn units : 1000 bytes/second , 0 = Max, -1 = Min */
int fs; /* fifo size in 2048 byte chunks : at most 1 GB */
/* XORRISO options */ /* XORRISO options */
int allow_graft_points; int allow_graft_points;
@ -1823,6 +1826,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->do_dummy= 0; m->do_dummy= 0;
m->do_close= 0; m->do_close= 0;
m->speed= 0; m->speed= 0;
m->fs= 4*512; /* 4 MiB */
m->allow_graft_points= 0; m->allow_graft_points= 0;
m->dialog= 0; m->dialog= 0;
m->search_mode= 0; m->search_mode= 0;
@ -2885,6 +2889,14 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->fs==4*512);
if((xorriso->fs/512)*512==xorriso->fs)
sprintf(line,"-fs %dm\n", xorriso->fs/512);
else
sprintf(line,"-fs %dk\n", xorriso->fs*2);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
/* >>> BAUSTELLE */ /* >>> BAUSTELLE */
if(xorriso->status_history_max!=Xorriso_status_history_maX || !no_defaults) { if(xorriso->status_history_max!=Xorriso_status_history_maX || !no_defaults) {
@ -3370,7 +3382,16 @@ int Xorriso_option_findx(struct XorrisO *xorriso, char *pattern, int flag)
/* Option -fs */ /* Option -fs */
int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag) int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
{ {
fprintf(stderr, ">>> LIBISOBURN: -fs %s\n", size); double num;
num= Scanf_io_size(size, 0);
if(num < 4096 || num > 1024.0 * 1024.0 * 1024.0) {
/* >>> wrong size */;
return(0);
}
xorriso->fs= num / 2048.0;
return(1); return(1);
} }
@ -3378,7 +3399,29 @@ int Xorriso_option_fs(struct XorrisO *xorriso, char *size, int flag)
/* Option -gid */ /* Option -gid */
int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag) int Xorriso_option_gid(struct XorrisO *xorriso, char *gid, int flag)
{ {
fprintf(stderr, ">>> LIBISOFS : -gid %s\n", gid); double num;
char text[80];
struct group *grp;
if(gid[0]==0 || strcmp(gid,"-")==0)
xorriso->do_global_gid= 0;
sscanf(gid, "%lf", &num);
sprintf(text,"%.f",num);
if(strcmp(text,gid)==0) {
xorriso->global_gid= num;
xorriso->do_global_gid= 1;
return(1);
}
grp= getgrnam(gid);
if(grp==NULL) {
/* >>> unknown group */;
return(0);
}
xorriso->global_gid= grp->gr_gid;
xorriso->do_global_gid= 1;
return(1); return(1);
} }
@ -4132,7 +4175,30 @@ int Xorriso_option_toc(struct XorrisO *xorriso, int flag)
/* Option -uid */ /* Option -uid */
int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag) int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag)
{ {
fprintf(stderr, ">>> LIBISOFS : -uid %s\n", uid); double num;
char text[80];
struct passwd *pwd;
if(uid[0]==0 || strcmp(uid,"-")==0)
xorriso->do_global_uid= 0;
sscanf(uid, "%lf", &num);
sprintf(text,"%.f",num);
if(strcmp(text,uid)==0) {
xorriso->global_uid= num;
xorriso->do_global_uid= 1;
return(1);
}
pwd= getpwnam(uid);
if(pwd==NULL) {
/* >>> unknown user */;
return(0);
}
xorriso->global_uid= pwd->pw_uid;
xorriso->do_global_uid= 1;
return(1); return(1);
} }

View File

@ -355,10 +355,14 @@ Settings for result writing:
-V volid Specifies the volume ID. (I assume libisofs can do that) -V volid Specifies the volume ID. (I assume libisofs can do that)
-speed number[k|m] Set the burn speed. Default is maximum speed. -speed number[k|m|c|d] Set the burn speed. Default is 0 = maximum speed.
Speed can be given in media dependent numbers or as a Speed can be given in media dependent numbers or as a
desired throughput per second in kiB (= 1024) or MiB desired throughput per second in MMC compliant kB (= 1000)
(= 1024 kiB). or MB (= 1000 kB). Media x-speed factor can be set explicity
by "c" for CD and "d" for "DVD". Example speeds:
706k = 706kB/s = 4c = 4xCD , 5540k = 5540kB/s = 4d = 4xDVD
If there is no hint about the speed unit attached, then the
media in the outdrive will decide. Default unit is CD = 176.4k.
-dummy "on"|"off" If "on" simulate burning or refuse with SORRY event if -dummy "on"|"off" If "on" simulate burning or refuse with SORRY event if
no simulation is possible. no simulation is possible.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.13.141503" #define Xorriso_timestamP "2007.10.13.152252"