Skip to content

Commit b9fd172

Browse files
committed
Add FUSE3 support and TANDBERG LTO-6 HH drive
FUSE3 support (for AlmaLinux9/RHEL9 with FUSE 3.x): - Update FUSE_USE_VERSION from 26 to 30 - Fix filler() calls to use 5 arguments (FUSE3 API) - Remove deprecated fuse_operations members: fgetattr, ftruncate, flag_nullpath_ok - Update fuse_parse_cmdline() to use struct fuse_cmdline_opts (FUSE3 API) - Add fuse_lowlevel.h include in main.c - Remove deprecated FUSE2 options: hard_remove, sync_read, big_writes, use_ino TANDBERG LTO-6 HH support: - Add VENDOR_TANDBERG to vendor enum in tape_drivers.h - Add TANDBERG_VENDOR_ID definition in hp_tape.h - Add TANDBERG LTO-6 HH drive entry in hp_tape.c - Add TANDBERG vendor handling in vendor_compat.c (get_vendor_id, get_supported_devs, init_error_table, init_timeout) - Use LogPage 0x31 for TANDBERG capacity reading in sg_tape.c Tested with: TANDBERG LTO-6 HH (firmware 3319, serial HUJ430176D) AlmaLinux 9.7 (kernel 5.14.0-611.54.6.el9_7.x86_64) FUSE 3.10.2-9.el9
1 parent f3fb8cc commit b9fd172

8 files changed

Lines changed: 40 additions & 24 deletions

File tree

src/libltfs/ltfs_fuse_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@
5050
#ifndef __ltfs_fuse_version_h__
5151
#define __ltfs_fuse_version_h__
5252

53-
#define FUSE_USE_VERSION 26
53+
#define FUSE_USE_VERSION 30
5454

5555
#endif /* __ltfs_fuse_version_h__ */

src/ltfs_fuse.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,9 @@ int _ltfs_fuse_filldir(void *buf, const char *name, void *priv)
853853
return ret;
854854
}
855855

856-
ret = filler(buf, new_name, NULL, 0);
856+
ret = filler(buf, new_name, NULL, 0, 0);
857857
#else
858-
ret = filler(buf, name, NULL, 0);
858+
ret = filler(buf, name, NULL, 0, 0);
859859
#endif
860860

861861
free(new_name);
@@ -875,12 +875,12 @@ int ltfs_fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
875875

876876
ltfsmsg(LTFS_DEBUG, 14047D, _dentry_name(path, file->file_info));
877877

878-
if (filler(buf, ".", NULL, 0)) {
878+
if (filler(buf, ".", NULL, 0, 0)) {
879879
/* No buffer space */
880880
ltfsmsg(LTFS_DEBUG, 14026D);
881881
return -ENOBUFS;
882882
}
883-
if (filler(buf, "..", NULL, 0)) {
883+
if (filler(buf, "..", NULL, 0, 0)) {
884884
/* No buffer space */
885885
ltfsmsg(LTFS_DEBUG, 14026D);
886886
return -ENOBUFS;
@@ -1206,7 +1206,6 @@ struct fuse_operations ltfs_ops = {
12061206
.init = ltfs_fuse_mount,
12071207
.destroy = ltfs_fuse_umount,
12081208
.getattr = ltfs_fuse_getattr,
1209-
.fgetattr = ltfs_fuse_fgetattr,
12101209
.access = ltfs_fuse_access,
12111210
.statfs = ltfs_fuse_statfs,
12121211
.open = ltfs_fuse_open,
@@ -1218,7 +1217,6 @@ struct fuse_operations ltfs_ops = {
12181217
.chown = ltfs_fuse_chown,
12191218
.create = ltfs_fuse_create,
12201219
.truncate = ltfs_fuse_truncate,
1221-
.ftruncate = ltfs_fuse_ftruncate,
12221220
.unlink = ltfs_fuse_unlink,
12231221
.rename = ltfs_fuse_rename,
12241222
.mkdir = ltfs_fuse_mkdir,
@@ -1236,6 +1234,5 @@ struct fuse_operations ltfs_ops = {
12361234
.symlink = ltfs_fuse_symlink,
12371235
.readlink = ltfs_fuse_readlink,
12381236
#if FUSE_VERSION >= 28
1239-
.flag_nullpath_ok = 1,
12401237
#endif
12411238
};

src/main.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include <grp.h>
6161

6262
#include "ltfs_fuse.h"
63+
#include <fuse3/fuse_lowlevel.h>
6364
#include "libltfs/ltfs.h"
6465
#include "ltfs_copyright.h"
6566
#include "libltfs/pathname.h"
@@ -747,18 +748,18 @@ int main(int argc, char **argv)
747748
}
748749

749750
/* Unlink objects from the file system instead of having them renamed to .fuse_hidden */
750-
ret = fuse_opt_add_arg(&args, "-ohard_remove");
751+
/* FUSE3: removed deprecated option: ret = fuse_opt_add_arg(&args, "-ohard_remove"); */
751752
if (ret < 0) {
752753
/* Could not enable FUSE option */
753-
ltfsmsg(LTFS_ERR, 14001E, "hard_remove", ret);
754+
/* FUSE3: removed deprecated option: ltfsmsg(LTFS_ERR, 14001E, "hard_remove", ret); */
754755
return 1;
755756
}
756757

757758
/* perform reads synchronously */
758-
ret = fuse_opt_add_arg(&args, "-osync_read");
759+
/* FUSE3: removed deprecated option: ret = fuse_opt_add_arg(&args, "-osync_read"); */
759760
if (ret < 0) {
760761
/* Could not enable FUSE option */
761-
ltfsmsg(LTFS_ERR, 14001E, "sync_read", ret);
762+
/* FUSE3: removed deprecated option: ltfsmsg(LTFS_ERR, 14001E, "sync_read", ret); */
762763
return 1;
763764
}
764765

@@ -788,11 +789,11 @@ int main(int argc, char **argv)
788789
#endif
789790

790791
#if FUSE_VERSION >= 28
791-
/* For FUSE 2.8 or higher, automatically enable big_writes */
792-
ret = fuse_opt_add_arg(&args, "-obig_writes");
792+
/* FUSE3: removed deprecated option: For FUSE 2.8 or higher, automatically enable big_writes */
793+
/* FUSE3: removed deprecated option: ret = fuse_opt_add_arg(&args, "-obig_writes"); */
793794
if (ret < 0) {
794795
/* Could not enable FUSE option */
795-
ltfsmsg(LTFS_ERR, 14001E, "big_writes", ret);
796+
/* FUSE3: removed deprecated option: ltfsmsg(LTFS_ERR, 14001E, "big_writes", ret); */
796797
return 1;
797798
}
798799
#endif
@@ -974,10 +975,10 @@ int single_drive_main(struct fuse_args *args, struct ltfs_fuse_data *priv)
974975
/* If the local inode space is big enough, have FUSE pass through our UIDs as inode
975976
* numbers instead of generating its own. */
976977
if (sizeof(ino_t) >= 8) {
977-
ret = fuse_opt_add_arg(args, "-ouse_ino");
978+
/* FUSE3: removed deprecated option: ret = fuse_opt_add_arg(args, "-ouse_ino"); */
978979
if (ret < 0) {
979980
/* Could not enable FUSE option */
980-
ltfsmsg(LTFS_ERR, 14001E, "use_ino", ret);
981+
/* FUSE3: removed deprecated option: ltfsmsg(LTFS_ERR, 14001E, "use_ino", ret); */
981982
return 1;
982983
}
983984
}
@@ -1223,12 +1224,16 @@ int single_drive_main(struct fuse_args *args, struct ltfs_fuse_data *priv)
12231224
for ( i=0; i<args->argc; i++) {
12241225
fuse_opt_add_arg(&tmpa, args->argv[i]);
12251226
}
1226-
ret = fuse_parse_cmdline( &tmpa, &mountpoint, NULL, NULL);
1227-
fuse_opt_free_args(&tmpa);
1228-
if (ret < 0 || mountpoint == NULL) {
1229-
ltfsmsg(LTFS_ERR, 14094E, ret);
1230-
ltfs_volume_free(&priv->data);
1231-
return 1;
1227+
{
1228+
struct fuse_cmdline_opts fuse_opts;
1229+
ret = fuse_parse_cmdline(&tmpa, &fuse_opts);
1230+
fuse_opt_free_args(&tmpa);
1231+
if (ret < 0 || fuse_opts.mountpoint == NULL) {
1232+
ltfsmsg(LTFS_ERR, 14094E, ret);
1233+
ltfs_volume_free(&priv->data);
1234+
return 1;
1235+
}
1236+
mountpoint = fuse_opts.mountpoint;
12321237
}
12331238
priv->data->mountpoint = mountpoint;
12341239
priv->data->mountpoint_len = strlen(mountpoint);

src/tape_drivers/hp_tape.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct supported_device *hp_supported_drives[] = {
6868
TAPEDRIVE( HP_VENDOR_ID, "Ultrium 7-SCSI", DRIVE_LTO7, "[Ultrium 7-SCSI]" ), /* HP Ultrium Gen 7 */
6969
TAPEDRIVE( HPE_VENDOR_ID, "Ultrium 8-SCSI", DRIVE_LTO8, "[Ultrium 8-SCSI]" ), /* HPE Ultrium Gen 8 */
7070
TAPEDRIVE( HPE_VENDOR_ID, "Ultrium 9-SCSI", DRIVE_LTO9, "[Ultrium 9-SCSI]" ), /* HPE Ultrium Gen 9 */
71+
TAPEDRIVE( TANDBERG_VENDOR_ID, "LTO-6 HH ", DRIVE_LTO6_HH, "[LTO-6 HH]" ), /* TANDBERG LTO-6 HH */
7172
/* End of supported_devices */
7273
NULL
7374
};

src/tape_drivers/hp_tape.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern "C" {
6767

6868
#define HP_VENDOR_ID "HP"
6969
#define HPE_VENDOR_ID "HPE"
70+
#define TANDBERG_VENDOR_ID "TANDBERG"
7071

7172
extern struct error_table hp_tape_errors[];
7273

src/tape_drivers/linux/sg/sg_tape.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,7 @@ int sg_remaining_capacity(void *device, struct tc_remaining_cap *cap)
30313031

30323032
memset(buffer, 0, LOGSENSEPAGE);
30333033

3034-
if (IS_LTO(priv->drive_type) && (DRIVE_GEN(priv->drive_type) == 0x05)) {
3034+
if (IS_LTO(priv->drive_type) && (DRIVE_GEN(priv->drive_type) == 0x05 || priv->vendor == VENDOR_TANDBERG)) {
30353035
/* Use LogPage 0x31 */
30363036
ret = sg_logsense(device, (uint8_t)LOG_TAPECAPACITY, (uint8_t)0, (void *)buffer, LOGSENSEPAGE);
30373037
if(ret < 0)

src/tape_drivers/tape_drivers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ enum {
179179
VENDOR_IBM,
180180
VENDOR_HP,
181181
VENDOR_QUANTUM,
182+
VENDOR_TANDBERG,
182183
};
183184

184185
enum {

src/tape_drivers/vendor_compat.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ int get_vendor_id(char* vendor)
289289
return VENDOR_HP;
290290
else if (!strncmp(vendor, HPE_VENDOR_ID, strlen(HPE_VENDOR_ID)))
291291
return VENDOR_HP;
292+
else if (!strncmp(vendor, TANDBERG_VENDOR_ID, strlen(TANDBERG_VENDOR_ID)))
293+
return VENDOR_TANDBERG;
292294
else if (!strncmp(vendor, QUANTUM_VENDOR_ID, strlen(QUANTUM_VENDOR_ID)))
293295
return VENDOR_QUANTUM;
294296
else
@@ -309,6 +311,9 @@ struct supported_device **get_supported_devs(int vendor)
309311
case VENDOR_QUANTUM:
310312
cur = quantum_supported_drives;
311313
break;
314+
case VENDOR_TANDBERG:
315+
cur = hp_supported_drives;
316+
break;
312317
}
313318

314319
return cur;
@@ -412,6 +417,9 @@ void init_error_table(int vendor,
412417
case VENDOR_QUANTUM:
413418
*vendor_table = quantum_tape_errors;
414419
break;
420+
case VENDOR_TANDBERG:
421+
*vendor_table = hp_tape_errors;
422+
break;
415423
}
416424
}
417425

@@ -429,6 +437,9 @@ int init_timeout(int vendor, struct timeout_tape **table, int type)
429437
case VENDOR_QUANTUM:
430438
ret = quantum_tape_init_timeout(table, type);
431439
break;
440+
case VENDOR_TANDBERG:
441+
ret = hp_tape_init_timeout(table, type);
442+
break;
432443
}
433444

434445
return ret;

0 commit comments

Comments
 (0)