![]() |
|
|||
0001 /* 0002 * include/linux/parman.h - Manager for linear priority array areas 0003 * Copyright (c) 2017 Mellanox Technologies. All rights reserved. 0004 * Copyright (c) 2017 Jiri Pirko <jiri@mellanox.com> 0005 * 0006 * Redistribution and use in source and binary forms, with or without 0007 * modification, are permitted provided that the following conditions are met: 0008 * 0009 * 1. Redistributions of source code must retain the above copyright 0010 * notice, this list of conditions and the following disclaimer. 0011 * 2. Redistributions in binary form must reproduce the above copyright 0012 * notice, this list of conditions and the following disclaimer in the 0013 * documentation and/or other materials provided with the distribution. 0014 * 3. Neither the names of the copyright holders nor the names of its 0015 * contributors may be used to endorse or promote products derived from 0016 * this software without specific prior written permission. 0017 * 0018 * Alternatively, this software may be distributed under the terms of the 0019 * GNU General Public License ("GPL") version 2 as published by the Free 0020 * Software Foundation. 0021 * 0022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0025 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0026 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0027 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0028 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0029 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0030 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0031 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0032 * POSSIBILITY OF SUCH DAMAGE. 0033 */ 0034 0035 #ifndef _PARMAN_H 0036 #define _PARMAN_H 0037 0038 #include <linux/list.h> 0039 0040 enum parman_algo_type { 0041 PARMAN_ALGO_TYPE_LSORT, 0042 }; 0043 0044 struct parman_item { 0045 struct list_head list; 0046 unsigned long index; 0047 }; 0048 0049 struct parman_prio { 0050 struct list_head list; 0051 struct list_head item_list; 0052 unsigned long priority; 0053 }; 0054 0055 struct parman_ops { 0056 unsigned long base_count; 0057 unsigned long resize_step; 0058 int (*resize)(void *priv, unsigned long new_count); 0059 void (*move)(void *priv, unsigned long from_index, 0060 unsigned long to_index, unsigned long count); 0061 enum parman_algo_type algo; 0062 }; 0063 0064 struct parman; 0065 0066 struct parman *parman_create(const struct parman_ops *ops, void *priv); 0067 void parman_destroy(struct parman *parman); 0068 void parman_prio_init(struct parman *parman, struct parman_prio *prio, 0069 unsigned long priority); 0070 void parman_prio_fini(struct parman_prio *prio); 0071 int parman_item_add(struct parman *parman, struct parman_prio *prio, 0072 struct parman_item *item); 0073 void parman_item_remove(struct parman *parman, struct parman_prio *prio, 0074 struct parman_item *item); 0075 0076 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |