// SPDX-License-Identifier: GPL-2.0-or-later /* * An implementation of a loadable kernel mode driver providing * multiple kernel/user space bidirectional communications links. * * Author: Alan Cox <alan@lxorguk.ukuu.org.uk> * * Adapted to become the Linux 2.0 Coda pseudo device * Peter Braam <braam@maths.ox.ac.uk> * Michael Callahan <mjc@emmy.smith.edu> * * Changes for Linux 2.1 * Copyright (c) 1997 Carnegie-Mellon University
*/
/* Move the input args into userspace */
count = req->uc_inSize; if (nbytes < req->uc_inSize) {
pr_warn("%s: Venus read %ld bytes of %d in message\n",
__func__, (long)nbytes, req->uc_inSize);
count = nbytes;
}
if (copy_to_user(buf, req->uc_data, count))
retval = -EFAULT;
/* If request was not a signal, enqueue and don't free */ if (!(req->uc_flags & CODA_REQ_ASYNC)) {
req->uc_flags |= CODA_REQ_READ;
list_add_tail(&(req->uc_chain), &vcp->vc_processing); goto out;
}
if (!vcp || !vcp->vc_inuse ) {
pr_warn("%s: Not open.\n", __func__); return -1;
}
mutex_lock(&vcp->vc_mutex);
/* Wakeup clients so they can return. */
list_for_each_entry_safe(req, tmp, &vcp->vc_pending, uc_chain) {
list_del(&req->uc_chain);
/* Async requests need to be freed here */ if (req->uc_flags & CODA_REQ_ASYNC) {
kvfree(req->uc_data);
kfree(req); continue;
}
req->uc_flags |= CODA_REQ_ABORT;
wake_up(&req->uc_sleep);
}
MODULE_AUTHOR("Jan Harkes, Peter J. Braam");
MODULE_DESCRIPTION("Coda Distributed File System VFS interface");
MODULE_ALIAS_CHARDEV_MAJOR(CODA_PSDEV_MAJOR);
MODULE_LICENSE("GPL");
MODULE_VERSION("7.2");
staticint __init init_coda(void)
{ int status; int i;
status = coda_init_inodecache(); if (status) goto out2;
status = init_coda_psdev(); if ( status ) {
pr_warn("Problem (%d) in init_coda_psdev\n", status); goto out1;
}
status = register_filesystem(&coda_fs_type); if (status) {
pr_warn("failed to register filesystem!\n"); goto out;
} return 0;
out: for (i = 0; i < MAX_CODADEVS; i++)
device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i));
class_destroy(coda_psdev_class);
unregister_chrdev(CODA_PSDEV_MAJOR, "coda");
coda_sysctl_clean();
out1:
coda_destroy_inodecache();
out2: return status;
}
staticvoid __exit exit_coda(void)
{ int err, i;
err = unregister_filesystem(&coda_fs_type); if (err != 0)
pr_warn("failed to unregister filesystem\n"); for (i = 0; i < MAX_CODADEVS; i++)
device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i));
class_destroy(coda_psdev_class);
unregister_chrdev(CODA_PSDEV_MAJOR, "coda");
coda_sysctl_clean();
coda_destroy_inodecache();
}
module_init(init_coda);
module_exit(exit_coda);
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
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.