Changeset 8189ea8 in rtems-libbsd for freebsd/sys/opencrypto/cryptodev.c


Ignore:
Timestamp:
Mar 27, 2018, 12:42:31 PM (19 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
f7a09b5
Parents:
6600368
git-author:
Sebastian Huber <sebastian.huber@…> (03/27/18 12:42:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/28/18 05:59:12)
Message:

CRYPTO(4): Port to RTEMS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freebsd/sys/opencrypto/cryptodev.c

    r6600368 r8189ea8  
    296296};
    297297
     298#ifndef __rtems__
    298299static  int cryptof_ioctl(struct file *, u_long, void *,
    299300                    struct ucred *, struct thread *);
     
    318319    .fo_fill_kinfo = cryptof_fill_kinfo,
    319320};
     321#else /* __rtems__ */
     322static const rtems_filesystem_file_handlers_r cryptofops;
     323#endif /* __rtems__ */
    320324
    321325static struct csession *csefind(struct fcrypt *, u_int);
     
    685689#undef SES2
    686690}
     691#ifdef __rtems__
     692static int
     693rtems_bsd_cryptof_ioctl(rtems_libio_t *iop, ioctl_command_t request,
     694    void *buffer)
     695{
     696        struct thread *td;
     697        int error;
     698
     699        td = rtems_bsd_get_curthread_or_null();
     700        if (td != NULL) {
     701                struct file *fp;
     702
     703                fp = rtems_bsd_iop_to_fp(iop);
     704                error = cryptof_ioctl(fp, request, buffer, NULL, td);
     705        } else {
     706                error = ENOMEM;
     707        }
     708
     709        return (rtems_bsd_error_to_status_and_errno(error));
     710}
     711#endif /* __rtems__ */
    687712
    688713static int cryptodev_cb(void *);
     
    11711196/* ARGSUSED */
    11721197static int
     1198#ifndef __rtems__
    11731199cryptof_stat(
    11741200        struct file *fp,
     
    11761202        struct ucred *active_cred,
    11771203        struct thread *td)
     1204#else /* __rtems__ */
     1205rtems_bsd_cryptof_stat(const rtems_filesystem_location_info_t *loc,
     1206    struct stat *buf
     1207#endif /* __rtems__ */
     1208)
    11781209{
    11791210
     
    11961227        return 0;
    11971228}
    1198 
     1229#ifdef __rtems__
     1230static int
     1231rtems_bsd_cryptof_close(rtems_libio_t *iop)
     1232{
     1233        struct thread *td;
     1234        int error;
     1235
     1236        td = rtems_bsd_get_curthread_or_null();
     1237        if (td != NULL) {
     1238                struct file *fp;
     1239
     1240                fp = rtems_bsd_iop_to_fp(iop);
     1241                error = cryptof_close(fp, td);
     1242        } else {
     1243                error = ENOMEM;
     1244        }
     1245
     1246        return (rtems_bsd_error_to_status_and_errno(error));
     1247}
     1248#endif /* __rtems__ */
     1249
     1250#ifndef __rtems__
    11991251static int
    12001252cryptof_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
     
    12041256        return (0);
    12051257}
     1258#endif /* __rtems__ */
    12061259
    12071260static struct csession *
     
    13171370                finit(f, FREAD | FWRITE, DTYPE_CRYPTO, fcr, &cryptofops);
    13181371                *(u_int32_t *)data = fd;
     1372#ifndef __rtems__
    13191373                fdrop(f, td);
     1374#endif /* __rtems__ */
    13201375                break;
    13211376        case CRIOFINDDEV:
     
    13741429MODULE_DEPEND(cryptodev, crypto, 1, 1, 1);
    13751430MODULE_DEPEND(cryptodev, zlib, 1, 1, 1);
     1431#ifdef __rtems__
     1432static const rtems_filesystem_file_handlers_r cryptofops = {
     1433        .open_h = rtems_filesystem_default_open,
     1434        .close_h = rtems_bsd_cryptof_close,
     1435        .read_h = rtems_filesystem_default_read,
     1436        .write_h = rtems_filesystem_default_write,
     1437        .ioctl_h = rtems_bsd_cryptof_ioctl,
     1438        .lseek_h = rtems_filesystem_default_lseek,
     1439        .fstat_h = rtems_bsd_cryptof_stat,
     1440        .ftruncate_h = rtems_filesystem_default_ftruncate,
     1441        .fsync_h = rtems_filesystem_default_fsync_or_fdatasync,
     1442        .fdatasync_h = rtems_filesystem_default_fsync_or_fdatasync,
     1443        .fcntl_h = rtems_filesystem_default_fcntl,
     1444        .poll_h = rtems_filesystem_default_poll,
     1445        .kqfilter_h = rtems_filesystem_default_kqfilter,
     1446        .readv_h = rtems_filesystem_default_readv,
     1447        .writev_h = rtems_filesystem_default_writev,
     1448        .mmap_h = rtems_filesystem_default_mmap
     1449};
     1450#endif /* __rtems__ */
Note: See TracChangeset for help on using the changeset viewer.