/** * diag_ftp_2c4() - DIAGNOSE X'2C4' service call * @fpl: pointer to prepared LDFPL * @cmd: FTP command to be executed * * Performs a DIAGNOSE X'2C4' call with (input/output) FTP parameter list * @fpl and FTP function code @cmd. In case of an error the function does * nothing and returns an (negative) error code. * * Notes: * 1. This function only initiates a transfer, so the caller must wait * for completion (asynchronous execution). * 2. The FTP parameter list @fpl must be aligned to a double-word boundary. * 3. fpl->bufaddr must be a real address, 4k aligned
*/ staticint diag_ftp_2c4(struct diag_ftp_ldfpl *fpl, enum hmcdrv_ftp_cmdid cmd)
{ int rc;
switch (rc) { case DIAG_FTP_RET_OK: return 0; case DIAG_FTP_RET_EBUSY: return -EBUSY; case DIAG_FTP_RET_EPERM: return -EPERM; case DIAG_FTP_RET_EIO: default: return -EIO;
}
}
/** * diag_ftp_cmd() - executes a DIAG X'2C4' FTP command, targeting a HMC * @ftp: pointer to FTP command specification * @fsize: return of file size (or NULL if undesirable) * * Attention: Notice that this function is not reentrant - so the caller * must ensure locking. * * Return: number of bytes read/written or a (negative) error code
*/
ssize_t diag_ftp_cmd(conststruct hmcdrv_ftp_cmdspec *ftp, size_t *fsize)
{ struct diag_ftp_ldfpl *ldfpl;
ssize_t len; #ifdef DEBUG unsignedlong start_jiffies;
len = diag_ftp_2c4(ldfpl, ftp->id); if (len) goto out_free;
/* * There is no way to cancel the running diag X'2C4', the code * needs to wait unconditionally until the transfer is complete.
*/
wait_for_completion(&diag_ftp_rx_complete);
#ifdef DEBUG
pr_debug("completed DIAG X'2C4' after %lu ms\n",
(jiffies - start_jiffies) * 1000 / HZ);
pr_debug("status of DIAG X'2C4' is %u, with %lld/%lld bytes\n",
diag_ftp_subcode, ldfpl->transferred, ldfpl->fsize); #endif
switch (diag_ftp_subcode) { case DIAG_FTP_STAT_OK: /* success */
len = ldfpl->transferred; if (fsize)
*fsize = ldfpl->fsize; break; case DIAG_FTP_STAT_LDNPERM:
len = -EPERM; break; case DIAG_FTP_STAT_LDRUNS:
len = -EBUSY; break; case DIAG_FTP_STAT_LDFAIL:
len = -ENOENT; /* no such file or media */ break; default:
len = -EIO; break;
}
/** * diag_ftp_startup() - startup of FTP services, when running on z/VM * * Return: 0 on success, else an (negative) error code
*/ int diag_ftp_startup(void)
{ int rc;
rc = register_external_irq(EXT_IRQ_CP_SERVICE, diag_ftp_handler); if (rc) return rc;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.