mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Love <rml@novell.com>
To: John McCutchan <ttb@tentacle.dhs.org>
Cc: linux-kernel@vger.kernel.org
Subject: [patch] inotify: idr stuff
Date: Mon, 01 Nov 2004 15:28:48 -0500	[thread overview]
Message-ID: <1099340928.31022.46.camel@betsy.boston.ximian.com> (raw)
In-Reply-To: <1099330316.12182.2.camel@vertex>

John.

MAX_ID_MASK is already set to the maximum IDR value, so we don't need to
add IDR_MAX_ID.  I know this was my idea--I was, uh, being
metaphoric. :)

Plus, MAX_ID_MASK is computed based on IDR_BITS, so it is "always
right."

Also add an IWATCHES_HARD_LIMIT, set to MAX_ID_MASK, instead of using
MAX_ID_MASK directly.

Finally, this uncovers that idr.h is not protected against double
inclusion, so wrap it in ifndef's.

Best,

	Robert Love


idr stuff

Signed-Off-By: Robert Love <rml@novell.com>

 include/asm-i386/resource.h |    4 ++--
 include/linux/idr.h         |    5 ++++-
 include/linux/inotify.h     |    4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff -urN linux-2.6.10-rc1-inotify/include/asm-i386/resource.h linux/include/asm-i386/resource.h
--- linux-2.6.10-rc1-inotify/include/asm-i386/resource.h	2004-11-01 15:04:29.307122792 -0500
+++ linux/include/asm-i386/resource.h	2004-11-01 15:21:33.374440896 -0500
@@ -18,7 +18,7 @@
 #define RLIMIT_LOCKS	10		/* maximum file locks held */
 #define RLIMIT_SIGPENDING 11		/* max number of pending signals */
 #define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */
-#define RLIMIT_IWATCHES 13 /* maximum number of inotify watches */
+#define RLIMIT_IWATCHES 13		/* maximum number of inotify watches */
 
 #define RLIM_NLIMITS	14
 
@@ -46,7 +46,7 @@
 	{ RLIM_INFINITY, RLIM_INFINITY },		\
 	{ MAX_SIGPENDING, MAX_SIGPENDING },		\
 	{ MQ_BYTES_MAX, MQ_BYTES_MAX },			\
-	{ IWATCHES_SOFT_LIMIT, IDR_MAX_ID },		\
+	{ IWATCHES_SOFT_LIMIT, IWATCHES_HARD_LIMIT },	\
 }
 
 #endif /* __KERNEL__ */
diff -urN linux-2.6.10-rc1-inotify/include/linux/idr.h linux/include/linux/idr.h
--- linux-2.6.10-rc1-inotify/include/linux/idr.h	2004-11-01 15:04:28.453252600 -0500
+++ linux/include/linux/idr.h	2004-11-01 15:24:01.538916472 -0500
@@ -1,3 +1,5 @@
+#ifndef _LINUX_IDR_H
+#define _LINUX_IDR_H
 /*
  * include/linux/idr.h
  * 
@@ -29,7 +31,6 @@
 # error "BITS_PER_LONG is not 32 or 64"
 #endif
 
-#define IDR_MAX_ID 0x7fffffff
 #define IDR_SIZE (1 << IDR_BITS)
 #define IDR_MASK ((1 << IDR_BITS)-1)
 
@@ -77,3 +78,5 @@
 int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
 void idr_remove(struct idr *idp, int id);
 void idr_init(struct idr *idp);
+
+#endif	/* _LINUX_IDR_H */
diff -urN linux-2.6.10-rc1-inotify/include/linux/inotify.h linux/include/linux/inotify.h
--- linux-2.6.10-rc1-inotify/include/linux/inotify.h	2004-11-01 15:04:28.684217488 -0500
+++ linux/include/linux/inotify.h	2004-11-01 15:21:48.714108912 -0500
@@ -72,8 +72,10 @@
 #include <linux/dcache.h>
 #include <linux/fs.h>
 #include <linux/config.h>
+#include <linux/idr.h>
 
-#define IWATCHES_SOFT_LIMIT 16384
+#define IWATCHES_SOFT_LIMIT	16384
+#define IWATCHES_HARD_LIMIT	MAX_ID_MASK
 
 struct inotify_inode_data {
 	struct list_head watches;




  parent reply	other threads:[~2004-11-02  5:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-01 17:31 [RFC][PATCH] inotify 0.15 John McCutchan
2004-11-01 20:07 ` Robert Love
2004-11-01 20:10 ` [patch] inotify: fix dnotify compile Robert Love
2004-11-01 20:28 ` Robert Love [this message]
2004-11-03  2:52   ` [patch] inotify: idr stuff Gene Heskett
2004-11-01 20:42 ` [patch] inotify: misc. style cleanup Robert Love
2004-11-01 20:53 ` [patch] inotify: change default number of queued events Robert Love

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1099340928.31022.46.camel@betsy.boston.ximian.com \
    --to=rml@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ttb@tentacle.dhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®