source: mainline/uspace/lib/drv/generic/private/driver.h@ 3b60ea0

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 3b60ea0 was 33b8d024, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 8 years ago

Remove const qualifier from the argument of free() and realloc(),
as well as in numerous other variables that hold ownership of memory.

By convention, a pointer that holds ownership is _never_ qualified by const.
This is reflected in the standard type signature of free() and realloc().
Allowing const pointers to hold ownership may seem superficially convenient,
but is actually quite confusing to experienced C programmers.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 * Copyright (c) 2010 Lenka Trochtova
3 * Copyright (c) 2012 Jiri Svoboda
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup libdrv
31 * @{
32 */
33/** @file
34 */
35
36#ifndef DDF_PRIVATE_DRIVER_H_
37#define DDF_PRIVATE_DRIVER_H_
38
39#include <async.h>
40#include <ipc/devman.h>
41#include <ipc/dev_iface.h>
42#include "dev_iface.h"
43
44/** Device structure */
45struct ddf_dev {
46 /**
47 * Globally unique device identifier (assigned to the device by the
48 * device manager).
49 */
50 devman_handle_t handle;
51
52 /** Reference count */
53 atomic_t refcnt;
54
55 /** Session with the parent device driver */
56 async_sess_t *parent_sess;
57
58 /** Device name */
59 char *name;
60
61 /** Driver-specific data associated with this device */
62 void *driver_data;
63
64 /** Link in the list of devices handled by the driver */
65 link_t link;
66};
67
68/** Function structure */
69struct ddf_fun {
70 /** True if bound to the device manager */
71 bool bound;
72
73 /** Function indentifier (asigned by device manager) */
74 devman_handle_t handle;
75
76 /** Reference count */
77 atomic_t refcnt;
78
79 /** Device which this function belogs to */
80 struct ddf_dev *dev;
81
82 /** Function type */
83 fun_type_t ftype;
84
85 /** Function name */
86 char *name;
87
88 /** List of device ids for driver matching */
89 match_id_list_t match_ids;
90
91 /** Driver-specific data associated with this function */
92 void *driver_data;
93
94 /** Implementation of operations provided by this function */
95 const ddf_dev_ops_t *ops;
96
97 /** Connection handler or @c NULL to use the DDF default handler. */
98 async_port_handler_t conn_handler;
99
100 /** Link in the list of functions handled by the driver */
101 link_t link;
102};
103
104#endif
105
106/**
107 * @}
108 */
Note: See TracBrowser for help on using the repository browser.