Lines 1-12
Link Here
|
1 |
--- growisofs.c_old Mon Jan 16 06:09:41 2006 |
1 |
--- growisofs.c_old 2006-01-26 22:16:54.000000000 +0100 |
2 |
+++ growisofs.c Mon Jan 16 12:02:04 2006 |
2 |
+++ growisofs.c 2006-02-15 00:00:44.000000000 +0100 |
3 |
@@ -2194,7 +2194,9 @@ |
3 |
@@ -355,12 +355,17 @@ |
4 |
nice(-20); |
4 |
* - Treat only x73xx OPC errors as fatal; |
5 |
/* I'd rather do it right after I allocate ring buffer and fire off |
5 |
* - Fix typo in -speed scaling code; |
6 |
* threads, but I'll be running without extra privileges by then:-( */ |
6 |
* - permit tracksize to be not divisible by 32KB in DAO mode; |
7 |
+#if !defined(__FreeBSD__) || __FreeBSD__ >= 5 |
7 |
+ * 6.1.1: (by Nicolas Boichat, Bacula project) |
8 |
mlockall(MCL_CURRENT|MCL_FUTURE); |
8 |
+ * - Allow session to cross 4GB boundary regardless of medium type |
9 |
+#endif |
9 |
+ * (don't need to have a DL media) |
10 |
#endif |
10 |
+ * - Add a -F option (used instead of -M or -Z), which displays next_session |
|
|
11 |
+ * offset and capacity (free space = next_session - capacity). |
12 |
*/ |
13 |
#define PRINT_VERSION(cmd) do { \ |
14 |
char *s=strrchr((cmd),'/'); \ |
15 |
s ? s++ : (s=(cmd)); \ |
16 |
printf ("* %.*sgrowisofs by <appro@fy.chalmers.se>,"\ |
17 |
- " version 6.1,\n",(int)(s-(cmd)),(cmd)); \ |
18 |
+ " version 6.1.1,\n",(int)(s-(cmd)),(cmd)); \ |
19 |
} while (0) |
20 |
|
21 |
#define _LARGEFILE_SOURCE |
22 |
@@ -2329,6 +2334,18 @@ |
23 |
else in_device = argv[++i]; |
24 |
dev_found = 'Z'; |
25 |
} |
26 |
+ else if (argv[i][1] == 'F') |
27 |
+ { if (len > 2) in_device = argv[i]+2; |
28 |
+ else in_device = argv[++i]; |
29 |
+ dev_found = 'F'; |
30 |
+ dry_run = 1; /* NEVER write anything with -F */ |
31 |
+ } |
32 |
+ else if (!strncmp(opt,"-free-space",11)) |
33 |
+ { if (len > 11) in_device = opt+11; |
34 |
+ else in_device = argv[++i]; |
35 |
+ dev_found = 'F'; |
36 |
+ dry_run = 1; /* NEVER write anything with -F */ |
37 |
+ } |
38 |
else if (!strcmp(opt,"-poor-man")) |
39 |
{ if (poor_man<0) poor_man = 1; |
40 |
continue; |
41 |
@@ -2542,7 +2559,9 @@ |
42 |
fprintf (stderr," you most likely want to use -Z option.\n"), |
43 |
exit (FATAL_START(errno)); |
11 |
|
44 |
|
12 |
mkisofs_argv = malloc ((argc+3)*sizeof(char *)); |
45 |
- if (dev_found == 'M') |
|
|
46 |
+ if ((dev_found == 'M') || |
47 |
+ ((dev_found == 'F') && !(mmc_profile&0x10000)) && (saved_descriptors[0].type[0] || saved_descriptors[0].type[1] || saved_descriptors[0].type[2])) |
48 |
+ /* -F : The medium is not blank, there is a fs on it (the_buffer[0,1 or 2] != 0), so compute next_session. */ |
49 |
{ if (memcmp (saved_descriptors[0].type,"\1CD001",6)) |
50 |
fprintf (stderr,":-( %s doesn't look like isofs...\n", |
51 |
in_device), exit(FATAL_START(EMEDIUMTYPE)); |
52 |
@@ -2565,7 +2584,7 @@ |
53 |
exit(FATAL_START(EINVAL)); |
54 |
} |
55 |
else if (next_session > (0x200000-0x5000)) /* 4GB/2K-40MB/2K */ |
56 |
- if ((mmc_profile&0xFFFF)!=0x2B || !no_4gb_check) |
57 |
+ if (!no_4gb_check) |
58 |
fprintf (stderr,":-( next session would cross 4GB " |
59 |
"boundary, aborting...\n"), |
60 |
exit (FATAL_START(ENOSPC)); |
61 |
@@ -2608,7 +2627,7 @@ |
62 |
exit (FATAL_START(EINVAL)); |
63 |
|
64 |
if (imgfd<0) |
65 |
- { if (mkisofs_argc==1) |
66 |
+ { if ((mkisofs_argc==1) && (dev_found != 'F')) |
67 |
fprintf (stderr,"%s: no mkisofs options specified, " |
68 |
"aborting...\n",argv[0]), |
69 |
exit (FATAL_START(EINVAL)); |
70 |
@@ -2880,6 +2899,15 @@ |
71 |
} |
72 |
} |
73 |
|
74 |
+ if (dev_found == 'F') { |
75 |
+ off64_t capacity = 0; |
76 |
+ printf("next_session=%lld\n", next_session*CD_BLOCK); |
77 |
+ if (ioctl_handle!=INVALID_HANDLE) |
78 |
+ capacity = get_capacity (ioctl_handle); |
79 |
+ printf("capacity=%lld\n", capacity); |
80 |
+ exit(0); |
81 |
+ } |
82 |
+ |
83 |
if (imgfd>=0) |
84 |
{ quiet--; |
85 |
if (builtin_dd (imgfd,out_fd,next_session*CD_BLOCK) < 0) |