Skip to content

Commit 6ffafcd

Browse files
committed
Changing function name and addressing PR comments
1 parent 1b904ff commit 6ffafcd

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

src/libltfs/ltfs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,12 @@ bool caught_sigcont = false;
209209
void _ltfs_sigcont(int signal)
210210
{
211211
ltfsmsg(LTFS_INFO, 17294I, signal);
212-
caught_sigcont = true;
212+
ltfs_sigcont_set(true);
213+
}
214+
215+
void ltfs_sigcont_set(bool sig_val)
216+
{
217+
caught_sigcont = sig_val;
213218
}
214219

215220
bool ltfs_caught_sigcont(void)
@@ -2533,7 +2538,7 @@ int ltfs_write_index(char partition, char *reason, struct ltfs_volume *vol)
25332538
}
25342539

25352540
/* Get the tape position from the tape drive by using the SCSI command READPOS*/
2536-
ret = tape_update_position(vol->device, &current_position);
2541+
ret = tape_get_position_from_drive(vol->device, &current_position);
25372542
if (ret < 0) {
25382543
/* Return error since the current tape position was unable to be determined, so there could be an undetected position mismatch */
25392544
ltfsmsg(LTFS_ERR, 11081E, ret);

src/libltfs/ltfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ void ltfs_set_log_level(int log_level);
593593
void ltfs_set_syslog_level(int syslog_level);
594594
bool ltfs_is_interrupted(void);
595595
bool ltfs_caught_sigcont(void);
596+
void ltfs_sigcont_set(bool sig_val);
596597
int ltfs_set_signal_handlers(void);
597598
int ltfs_unset_signal_handlers(void);
598599
int ltfs_finish();

src/libltfs/tape.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ int tape_get_position(struct device_data *dev, struct tc_position *pos)
11051105
/**
11061106
* Get current tape position by querying the device.
11071107
*/
1108-
int tape_update_position(struct device_data *dev, struct tc_position *pos)
1108+
int tape_get_position_from_drive(struct device_data *dev, struct tc_position *pos)
11091109
{
11101110
int ret;
11111111

@@ -1246,7 +1246,7 @@ ssize_t tape_write(struct device_data *dev, const char *buf, size_t count, bool
12461246

12471247
if (ltfs_caught_sigcont()) {
12481248
ltfsmsg(LTFS_DEBUG, 16503D, "ltfs_caught_sigcont", "tape_write");
1249-
ret_for_update_position = tape_update_position(dev, &current_position);
1249+
ret_for_update_position = tape_get_position_from_drive(dev, &current_position);
12501250
if (ret_for_update_position) {
12511251
/* Return error since the current tape position was unable to be determined, so there could be an undetected position mismatch */
12521252
ltfsmsg(LTFS_ERR, 11081E, ret);
@@ -1262,6 +1262,10 @@ ssize_t tape_write(struct device_data *dev, const char *buf, size_t count, bool
12621262
}
12631263
}
12641264

1265+
// Unset flag to avoid checking it again if it is not needed
1266+
ltfs_sigcont_set(false);
1267+
1268+
12651269
ltfs_mutex_lock(&dev->append_pos_mutex);
12661270
dev->append_pos[dev->position.partition] = dev->position.block;
12671271
ltfs_mutex_unlock(&dev->append_pos_mutex);

src/libltfs/tape.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ int tape_force_read_only(struct device_data *dev);
160160

161161
int tape_rewind(struct device_data *dev);
162162
int tape_get_position(struct device_data *dev, struct tc_position *pos);
163-
int tape_update_position(struct device_data *dev, struct tc_position *pos);
163+
int tape_get_position_from_drive(struct device_data *dev, struct tc_position *pos);
164164

165165
int tape_seek(struct device_data *dev, struct tc_position *pos);
166166
int tape_seek_eod(struct device_data *dev, tape_partition_t partition);

0 commit comments

Comments
 (0)