Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2019 18:02:48 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345095 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <201903131802.x2DI2mPA062820@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed Mar 13 18:02:47 2019
New Revision: 345095
URL: https://svnweb.freebsd.org/changeset/base/345095

Log:
  Implement ida_free() and ida_alloc_max() in the LinuxKPI.
  
  Submitted by:		Johannes Lundberg <johalun0@gmail.com>
  MFC after:		1 week
  Sponsored by:		Limelight Networks
  Sponsored by:		Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/idr.h
  head/sys/compat/linuxkpi/common/src/linux_idr.c

Modified: head/sys/compat/linuxkpi/common/include/linux/idr.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/idr.h	Wed Mar 13 18:00:25 2019	(r345094)
+++ head/sys/compat/linuxkpi/common/include/linux/idr.h	Wed Mar 13 18:02:47 2019	(r345095)
@@ -112,6 +112,7 @@ struct ida {
 int	ida_pre_get(struct ida *ida, gfp_t gfp_mask);
 int	ida_get_new_above(struct ida *ida, int starting_id, int *p_id);
 void	ida_remove(struct ida *ida, int id);
+void	ida_free(struct ida *ida, int id);
 void	ida_destroy(struct ida *ida);
 void	ida_init(struct ida *ida);
 
@@ -124,6 +125,13 @@ ida_get_new(struct ida *ida, int *p_id)
 {
 
 	return (ida_get_new_above(ida, 0, p_id));
+}
+
+static inline int
+ida_alloc_max(struct ida *ida, unsigned int max, gfp_t gfp)
+{
+
+	return (ida_simple_get(ida, 0, max, gfp));
 }
 
 static inline bool

Modified: head/sys/compat/linuxkpi/common/src/linux_idr.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_idr.c	Wed Mar 13 18:00:25 2019	(r345094)
+++ head/sys/compat/linuxkpi/common/src/linux_idr.c	Wed Mar 13 18:02:47 2019	(r345095)
@@ -797,6 +797,13 @@ ida_remove(struct ida *ida, int id)
 }
 
 void
+ida_free(struct ida *ida, int id)
+{
+
+	ida_remove(ida, id);
+}
+
+void
 ida_init(struct ida *ida)
 {
 	idr_init(&ida->idr);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903131802.x2DI2mPA062820>