Changeset 8189ea8 in rtems-libbsd


Ignore:
Timestamp:
Mar 27, 2018, 12:42:31 PM (14 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
b5f8d4831d66364b7391e3660560cb9bbecada2e, 31b5c87357cee83d6a3419c5d801a9bf16912714
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

Files:
2 added
3 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__ */
  • libbsd.py

    r6600368 r8189ea8  
    20472047            'sys/opencrypto/crypto.c',
    20482048            'sys/opencrypto/cryptodeflate.c',
     2049            'sys/opencrypto/cryptodev.c',
    20492050            'sys/opencrypto/cryptosoft.c',
    20502051            'sys/opencrypto/gfmult.c',
     
    44444445    mod.addTest(mm.generator['test-if-header']('debugger01', 'rtems/rtems-debugger.h',
    44454446                                               ['test_main'], runTest = False, netTest = True))
     4447    mod.addTest(mm.generator['test']('crypto01', ['test_main']))
    44464448    return mod
    44474449
  • libbsd_waf.py

    r6600368 r8189ea8  
    22372237              'freebsd/sys/opencrypto/crypto.c',
    22382238              'freebsd/sys/opencrypto/cryptodeflate.c',
     2239              'freebsd/sys/opencrypto/cryptodev.c',
    22392240              'freebsd/sys/opencrypto/cryptosoft.c',
    22402241              'freebsd/sys/opencrypto/gfmult.c',
     
    26022603                install_path = None)
    26032604
     2605    test_crypto01 = ['testsuite/crypto01/test_main.c']
     2606    bld.program(target = "crypto01.exe",
     2607                features = "cprogram",
     2608                cflags = cflags,
     2609                includes = includes,
     2610                source = test_crypto01,
     2611                use = ["bsd"],
     2612                lib = ["m", "z"],
     2613                install_path = None)
     2614
    26042615    if bld.env["HAVE_RTEMS_RTEMS_DEBUGGER_H"]:
    26052616        test_debugger01 = ['testsuite/debugger01/test_main.c']
Note: See TracChangeset for help on using the changeset viewer.