RMTSTATUS(3L)

πŸ“¦
version 2022.10.16 Β· 2 versions
, in opensuse-leap 16.0

πŸ’… RMTSTATUS(3L) β€” your remote tape status bestie πŸ’…

okay so this is RMTSTATUS(3L) from SchilyΒ΄s LIBRARY FUNCTIONS, and it's literally all about rmtstatus, rmtxstatus, _mtg2rmtg, and _rmtg2mtg β€” the little crew that requests MTIOCGET on a connection to a remote tape server (-lrmt). no cap πŸŽ€


✨ NAME ✨

rmtstatus, rmtxstatus, _mtg2rmtg, _rmtg2mtg β€” request MTIOCGET on a connection to a remote tape server (-lrmt). that's the whole vibe πŸ¦‹

πŸ“¦ SYNOPSIS πŸ“¦

#include <schily/librmt.h>
#include <schily/rmtio.h>

int rmtstatus(int remfd, struct mtget *mtp);

int rmtxstatus(int remfd, struct rmtget *mtp);

void _rmtg2mtg(struct mtget *mtp, struct rmtget *rmtp);

int _mtg2rmtg(struct rmtget *rmtp, struct mtget *mtp);

πŸ’– DESCRIPTION πŸ’–

πŸŒ€ rmtstatus() and rmtxstatus() πŸŒ€

okay so these two perform a MTIOCGET request to the remote server. remfd is a file descriptor you got earlier from a call to rmtgetconn(3), struct mtget is the local magnetic tape status structure, and struct rmtget is the enhanced magnetic tape status structure from librmt.

rmtstatus(3) and rmtxstatus(3) will fail if there was no previous successful rmtopen(3) before β€” so don't skip that step, bestie 😭

rmtstatus(3) and rmtxstatus(3) take care of using RMT protocol VERSION 1 if the remote side implements support for protocol version 1. iconic ✨

πŸ’€ warning: the function rmtstatus(3) is outdated and should be avoided, because the results in struct mtget will be the least common denominator of the local and remote variants of the structure. use rmtxstatus(3) instead. periodt.

The member mt_xflags in struct rmtget contains a bitmap that indicates which members of the structure contain valid values. See mtio(4) for more information πŸ‘‘

πŸ” _rmtg2mtg() πŸ”

converts a struct rmtget into a struct mtget. simple slay πŸ’…

πŸ” _mtg2rmtg() πŸ”

converts a struct mtget into a struct rmtget and sets the member mt_xflags in struct rmtget to contain a bitmap that indicates which members of struct mtget are present in the local implementation 🫢

⭐ RETURN VALUES ⭐

πŸŽ€ rmtstatus() and rmtxstatus() πŸŽ€

return a value >= 0 if the remote ioctl(f, MTIOCGET, struct mtget *) succeeds. yup πŸ’–

πŸ’₯ ERRORS πŸ’₯

rmtstatus() and rmtxstatus() return -1 on error and set errno to the errno value retrieved from the remote server 😭

🫢 _mtg2rmtg() 🫢

returns -1 if no value from the local struct mtget could be converted to the abstract struct rmtget.

🌈 EXAMPLES 🌈

here's the example, copied exactly because code is sacred:

       int  remfd;
       char *remfn;
       char host[256];
       int  iosize = 10240;     /* socket send/receive size to set up */
       struct rmtget rmtg;

       if ((remfn = rmtfilename(filename)) != NULL) {
            rmthostname(host, sizeof (host), filename);

            if ((remfd = rmtgetconn(host, iosize, 0)) < 0)
                 comerrno(EX_BAD, "Cannot get connection to '%s'.\n",
                      /* errno not valid !! */      host);
       }

       if (rmtopen(remfd, remfn, mode) < 0)
            comerr("Cannot open '%s'.\n", remfn);

       if (rmtxstatus(remfd, &rmtg) < 0)
            comerr("Cannot retrieve magnetic tape status from '%s'.\n", remfn);

       rmtclose(remfd);

πŸ‘€ SEE ALSO πŸ‘€

πŸ› BUGS πŸ›

If local and remote errno values do not match, programs may get confused. yeah, awkward πŸ™ˆ

Mail other bugs and suggestions to schilytools@mlists.in-berlin.de or open a ticket at https://codeberg.org/schilytools/schilytools/issues.

The mailing list archive may be found at:

https://mlists.in-berlin.de/mailman/listinfo/schilytools-mlists.in-berlin.de.

πŸ‘‘ AUTHORS πŸ‘‘

librmt has been written in 1990 by Joerg Schilling. In 1995, support for RMT VERSION 1 has been added. librmt is now maintained by the schilytools project authors πŸ’œ

πŸ“ SOURCE DOWNLOAD πŸ“

The source code for librmt is included in the schilytools project and may be retrieved from the schilytools project at Codeberg at

https://codeberg.org/schilytools/schilytools.

The download directory is

https://codeberg.org/schilytools/schilytools/releases.


okay that's the whole page, bestie 🫢 Joerg Schilling Β· 2022/10/06 Β· RMTSTATUS(3L) β€” mwah πŸ’‹

πŸ“¦ where this page comes from