[PATCH 2/5] libfreebsd: Added ofw_if.h

Niteesh G. S. niteesh.gs at gmail.com
Wed Jun 10 05:41:14 UTC 2020


Hello Christian,

I fixed this.

Thanks,
Niteesh.

On Sat, Jun 6, 2020 at 5:20 PM Christian Mauderer <oss at c-mauderer.de> wrote:

> Some style comments:
>
> On 04/06/2020 19:43, G S Niteesh Babu wrote:
> > This file is the RTEMS implementation of ofw_if.h in FreeBSD. The
> > ofw_if.h in FreeBSD is an autogenerated header file that maps the
> > OF_function calls to their respective implementation. But in RTEMS
> > this file maps the OF_functions directly to their FDT implementation.
> > ---
> >  cpukit/libfreebsd/dev/ofw/ofw_if.h | 63 ++++++++++++++++++++++++++++++
> >  1 file changed, 63 insertions(+)
> >  create mode 100644 cpukit/libfreebsd/dev/ofw/ofw_if.h
> >
> > diff --git a/cpukit/libfreebsd/dev/ofw/ofw_if.h
> b/cpukit/libfreebsd/dev/ofw/ofw_if.h
> > new file mode 100644
> > index 0000000000..7b9bcaa24a
> > --- /dev/null
> > +++ b/cpukit/libfreebsd/dev/ofw/ofw_if.h
> > @@ -0,0 +1,63 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause
> > +
> > + *
> > + * @file
> > + *
> > + * @ingroup LIBFREEBSDOFW
> > + *
> > + * @brief Declaration of OFW functions.
> > + */
> > +
> > +/*
> > + * Copyright (C) <2020> Niteesh Babu <niteesh.gs at gmail.com>
> > + *
> > + * Redistribution and use in source and binary forms, with or without
> > + * modification, are permitted provided that the following conditions
> > + * are met:
> > + * 1. Redistributions of source code must retain the above copyright
> > + *    notice, this list of conditions and the following disclaimer.
> > + * 2. Redistributions in binary form must reproduce the above copyright
> > + *    notice, this list of conditions and the following disclaimer in
> the
> > + *    documentation and/or other materials provided with the
> distribution.
> > + *
> > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> "AS IS"
> > + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
> TO, THE
> > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
> PURPOSE
> > + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> CONTRIBUTORS BE
> > + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> > + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> > + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
> IN
> > + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> OTHERWISE)
> > + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
> OF THE
> > + * POSSIBILITY OF SUCH DAMAGE.
> > + */
> > +
> > +#ifndef _LIBFREEBSD_OFW_IF_H
> > +#define _LIBFREEBSD_OFW_IF_H
> > +
> > +#include <sys/types.h>
> > +#include "openfirm.h"
> > +
> > +typedef void*                ofw_t;
> > +
> > +int OFW_INIT(ofw_t ofw_obj, void *cookie);
> > +phandle_t OFW_PEER(ofw_t ofw_obj, phandle_t node);
> > +phandle_t OFW_CHILD(ofw_t ofw_obj, phandle_t node);
> > +phandle_t OFW_PARENT(ofw_t ofw_obj, phandle_t node);
> > +phandle_t OFW_INSTANCE_TO_PACKAGE(ofw_t ofw_obj, ihandle_t instance);
> > +ssize_t OFW_GETPROPLEN(ofw_t ofw_obj, phandle_t package, const char
> *propname);
> > +ssize_t OFW_GETPROP(ofw_t ofw_obj, phandle_t package, const char
> *propname,
> > +    void *buf, size_t buflen);
>
> If we use FreeBSD Kernel style (which I would suggest for code that has
> to do with FreeBSD) you should indent the second line one tab more. Means
>
> ssize_t OFW_GETPROP(ofw_t ofw_obj, ...,
>             void *buf, size_t buflen);
>
> That is:
>
> ssize_t OFW_GETPROP(ofw_t ofw_obj, ...,
> <1*tab><4*space>void *buf, size_t buflen);
>
> Take a look at some FreeBSD headers for that. For example
> rtems-libbsd/freebsd/sys/sys/rwlock.h.
>
>
> > +int OFW_NEXTPROP(ofw_t ofw_obj, phandle_t package, const char *prev,
> char *buf,
> > +    size_t size);
> > +int OFW_SETPROP(ofw_t ofw_obj, phandle_t package, const char *propname,
> > +    const void *buf, size_t len);
> > +ssize_t OFW_CANON(ofw_t ofw_obj, const char *device, char *buf, size_t
> len);
> > +phandle_t OFW_FINDDEVICE(ofw_t ofw_obj, const char *device);
> > +ssize_t OFW_INSTANCE_TO_PATH(ofw_t ofw_obj, ihandle_t instance, char
> *buf,
> > +    size_t len);
> > +ssize_t OFW_PACKAGE_TO_PATH(ofw_t ofw_obj, phandle_t package, char *buf,
> > +    size_t len);
> > +
> > +#endif /* _LIBFREEBSD_OFW_IF_H */
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200610/f6f79350/attachment.html>


More information about the devel mailing list