From: Jan Kara <jack@suse.cz>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Module autoloading for quota
Date: Fri, 4 Jul 2003 22:40:33 +0200 [thread overview]
Message-ID: <20030704204033.GC17560@atrey.karlin.mff.cuni.cz> (raw)
Hello,
I'm sending you a patch which implements autoloading of quota modules.
The patch should apply well against all recent kernels. Please apply.
Honza
--
Jan Kara <jack@suse.cz>
SuSE CR Labs
diff -ruNX ../kerndiffexclude linux-2.5.69-um/fs/dquot.c linux-2.5.69-qmodautoload/fs/dquot.c
--- linux-2.5.69-um/fs/dquot.c Mon May 5 01:53:35 2003
+++ linux-2.5.69-qmodautoload/fs/dquot.c Fri Jul 4 21:47:56 2003
@@ -74,6 +74,7 @@
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/security.h>
+#include <linux/kmod.h>
#include <asm/uaccess.h>
@@ -96,6 +97,7 @@
static char *quotatypes[] = INITQFNAMES;
static struct quota_format_type *quota_formats; /* List of registered formats */
+static struct quota_module_name module_names[] = INIT_QUOTA_MODULE_NAMES;
int register_quota_format(struct quota_format_type *fmt)
{
@@ -123,8 +125,19 @@
spin_lock(&dq_list_lock);
for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
- if (actqf && !try_module_get(actqf->qf_owner))
- actqf = NULL;
+ if (!actqf || !try_module_get(actqf->qf_owner)) {
+ int qm;
+
+ for (qm = 0; module_names[qm].qm_fmt_id && module_names[qm].qm_fmt_id != id; qm++);
+ if (!module_names[qm].qm_fmt_id || request_module(module_names[qm].qm_mod_name)) {
+ actqf = NULL;
+ goto out;
+ }
+ for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
+ if (actqf && !try_module_get(actqf->qf_owner))
+ actqf = NULL;
+ }
+out:
spin_unlock(&dq_list_lock);
return actqf;
}
diff -ruNX ../kerndiffexclude linux-2.5.69-um/include/linux/quota.h linux-2.5.69-qmodautoload/include/linux/quota.h
--- linux-2.5.69-um/include/linux/quota.h Mon May 5 01:53:36 2003
+++ linux-2.5.69-qmodautoload/include/linux/quota.h Fri Jul 4 21:36:26 2003
@@ -306,6 +306,16 @@
void unregister_quota_format(struct quota_format_type *fmt);
void init_dquot_operations(struct dquot_operations *fsdqops);
+struct quota_module_name {
+ int qm_fmt_id;
+ char *qm_mod_name;
+};
+
+#define INIT_QUOTA_MODULE_NAMES {\
+ {QFMT_VFS_OLD, "quota_v1"},\
+ {QFMT_VFS_V0, "quota_v2"},\
+ {0, NULL}}
+
#else
# /* nodep */ include <sys/cdefs.h>
reply other threads:[~2003-07-04 20:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20030704204033.GC17560@atrey.karlin.mff.cuni.cz \
--to=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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;
as well as URLs for NNTP newsgroup(s).