"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libburn/sg-freebsd-port.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

sg-freebsd-port.c  (xorriso-1.5.2):sg-freebsd-port.c  (xorriso-1.5.4)
skipping to change at line 47 skipping to change at line 47
sg_id_string() returns an id string of the SCSI transport adapter. sg_id_string() returns an id string of the SCSI transport adapter.
It may be called before initialization but then may It may be called before initialization but then may
return only a preliminary id. return only a preliminary id.
sg_initialize() performs global initialization of the SCSI transport sg_initialize() performs global initialization of the SCSI transport
adapter and eventually needed operating system adapter and eventually needed operating system
facilities. Checks for compatibility of supporting facilities. Checks for compatibility of supporting
software components. software components.
sg_shutdown() performs global finalizations and releases golbally sg_shutdown() performs global finalizations and releases globally
aquired resources. acquired resources.
sg_give_next_adr() iterates over the set of potentially useful drive sg_give_next_adr() iterates over the set of potentially useful drive
address strings. address strings.
scsi_enumerate_drives() brings all available, not-whitelist-banned, and scsi_enumerate_drives() brings all available, not-whitelist-banned, and
accessible drives into libburn's list of drives. accessible drives into libburn's list of drives.
sg_dispose_drive() finalizes adapter specifics of struct burn_drive sg_dispose_drive() finalizes adapter specifics of struct burn_drive
on destruction. Releases resources which were aquired on destruction. Releases resources which were acquired
underneath scsi_enumerate_drives(). underneath scsi_enumerate_drives().
sg_drive_is_open() tells wether libburn has the given drive in use. sg_drive_is_open() tells whether libburn has the given drive in use.
sg_grab() opens the drive for SCSI commands and ensures sg_grab() opens the drive for SCSI commands and ensures
undisturbed access. undisturbed access.
sg_release() closes a drive opened by sg_grab() sg_release() closes a drive opened by sg_grab()
sg_issue_command() sends a SCSI command to the drive, receives reply, sg_issue_command() sends a SCSI command to the drive, receives reply,
and evaluates wether the command succeeded or shall and evaluates whether the command succeeded or shall
be retried or finally failed. be retried or finally failed.
sg_obtain_scsi_adr() tries to obtain SCSI address parameters. sg_obtain_scsi_adr() tries to obtain SCSI address parameters.
burn_os_is_2k_seekrw() tells whether the given path leads to a file object burn_os_is_2k_seekrw() tells whether the given path leads to a file object
that can be used in 2 kB granularity by lseek(2), that can be used in 2 kB granularity by lseek(2),
read(2), and possibly write(2) if not read-only. read(2), and possibly write(2) if not read-only.
E.g. a USB stick or a hard disk. E.g. a USB stick or a hard disk.
burn_os_stdio_capacity() estimates the emulated media space of stdio-drives. burn_os_stdio_capacity() estimates the emulated media space of stdio-drives.
skipping to change at line 290 skipping to change at line 290
@param msg returns ids and/or error messages of eventual helpers @param msg returns ids and/or error messages of eventual helpers
@param flag unused yet, submit 0 @param flag unused yet, submit 0
@return 1 = success, <=0 = failure @return 1 = success, <=0 = failure
*/ */
int sg_initialize(char msg[1024], int flag) int sg_initialize(char msg[1024], int flag)
{ {
return sg_id_string(msg, 0); return sg_id_string(msg, 0);
} }
/** Performs global finalization of the SCSI transport adapter and eventually /** Performs global finalization of the SCSI transport adapter and eventually
needed operating system facilities. Releases globally aquired resources. needed operating system facilities. Releases globally acquired resources.
@param flag unused yet, submit 0 @param flag unused yet, submit 0
@return 1 = success, <=0 = failure @return 1 = success, <=0 = failure
*/ */
int sg_shutdown(int flag) int sg_shutdown(int flag)
{ {
return 1; return 1;
} }
/** Finalizes BURN_OS_TRANSPORT_DRIVE_ELEMENTS, the components of /** Finalizes BURN_OS_TRANSPORT_DRIVE_ELEMENTS, the components of
struct burn_drive which are defined in os-*.h. struct burn_drive which are defined in os-*.h.
skipping to change at line 422 skipping to change at line 422
if (burn_drive_is_banned(buf)) if (burn_drive_is_banned(buf))
continue; continue;
enumerate_common(buf, idx.result->path_id, idx.result->path_id, enumerate_common(buf, idx.result->path_id, idx.result->path_id,
0, idx.result->target_id, 0, idx.result->target_id,
idx.result->target_lun); idx.result->target_lun);
} }
sg_give_next_adr(&idx, buf, sizeof(buf), -1); sg_give_next_adr(&idx, buf, sizeof(buf), -1);
return 1; return 1;
} }
/** Tells wether libburn has the given drive in use or exclusively reserved. /** Tells whether libburn has the given drive in use or exclusively reserved.
If it is "open" then libburn will eventually call sg_release() on it when If it is "open" then libburn will eventually call sg_release() on it when
it is time to give up usage and reservation. it is time to give up usage and reservation.
*/ */
/** Published as burn_drive.drive_is_open() */ /** Published as burn_drive.drive_is_open() */
int sg_drive_is_open(struct burn_drive * d) int sg_drive_is_open(struct burn_drive * d)
{ {
return (d->cam != NULL); return (d->cam != NULL);
} }
/** Opens the drive for SCSI commands and - if burn activities are prone /** Opens the drive for SCSI commands and - if burn activities are prone
skipping to change at line 461 skipping to change at line 461
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
"Could not grab drive", 0/*os_errno*/, 0); "Could not grab drive", 0/*os_errno*/, 0);
return 0; return 0;
} }
d->cam = cam; d->cam = cam;
fcntl(cam->fd, F_SETOWN, getpid()); fcntl(cam->fd, F_SETOWN, getpid());
d->released = 0; d->released = 0;
return 1; return 1;
} }
/** PORTING: Is mainly about the call to sg_close_drive() and wether it /** PORTING: Is mainly about the call to sg_close_drive() and whether it
implements the demanded functionality. implements the demanded functionality.
*/ */
/** Gives up the drive for SCSI commands and releases eventual access locks. /** Gives up the drive for SCSI commands and releases eventual access locks.
(Note: this is not physical tray locking.) (Note: this is not physical tray locking.)
*/ */
int sg_release(struct burn_drive *d) int sg_release(struct burn_drive *d)
{ {
if (d->cam == NULL) if (d->cam == NULL)
return 0; return 0;
sg_close_drive(d); sg_close_drive(d);
return 0; return 0;
} }
/** Sends a SCSI command to the drive, receives reply and evaluates wether /** Sends a SCSI command to the drive, receives reply and evaluates whether
the command succeeded or shall be retried or finally failed. the command succeeded or shall be retried or finally failed.
Returned SCSI errors shall not lead to a return value indicating failure. Returned SCSI errors shall not lead to a return value indicating failure.
The callers get notified by c->error. An SCSI failure which leads not to The callers get notified by c->error. An SCSI failure which leads not to
a retry shall be notified via scsi_notify_error(). a retry shall be notified via scsi_notify_error().
The Libburn_log_sg_commandS facility might be of help when problems with The Libburn_log_sg_commandS facility might be of help when problems with
a drive have to be examined. It shall stay disabled for normal use. a drive have to be examined. It shall stay disabled for normal use.
@return: 1 success , <=0 failure @return: 1 success , <=0 failure
*/ */
int sg_issue_command(struct burn_drive *d, struct command *c) int sg_issue_command(struct burn_drive *d, struct command *c)
{ {
skipping to change at line 620 skipping to change at line 620
*channel_no = 0; *channel_no = 0;
*target_no = result->target_id *target_no = result->target_id
*lun_no = result->target_lun; *lun_no = result->target_lun;
sg_give_next_adr(&idx, buf, sizeof(buf), -1); sg_give_next_adr(&idx, buf, sizeof(buf), -1);
return 1; return 1;
} }
sg_give_next_adr(&idx, buf, sizeof(buf), -1); sg_give_next_adr(&idx, buf, sizeof(buf), -1);
return (0); return (0);
} }
/** Tells wether a text is a persistent address as listed by the enumeration /** Tells whether a text is a persistent address as listed by the enumeration
functions. functions.
*/ */
int sg_is_enumerable_adr(char* adr) int sg_is_enumerable_adr(char* adr)
{ {
burn_drive_enumerator_t idx; burn_drive_enumerator_t idx;
int initialize = 1, ret; int initialize = 1, ret;
char buf[64]; char buf[64];
while(1) { while(1) {
ret = sg_give_next_adr(&idx, buf, sizeof(buf), initialize); ret = sg_give_next_adr(&idx, buf, sizeof(buf), initialize);
 End of changes. 9 change blocks. 
10 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)