quota: send messages via netlink

Implement sending of quota messages via netlink interface.  The advantage
is that in userspace we can better decide what to do with the message - for
example display a dialogue in your X session or just write the message to
the console.  As a bonus, we can get rid of problems with console locking
deep inside filesystem code once we remove the old printing mechanism.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jan Kara 2007-10-16 23:29:31 -07:00 committed by Linus Torvalds
parent fac8b209b1
commit 8e8934695d
4 changed files with 222 additions and 30 deletions

View file

@ -128,6 +128,37 @@ struct if_dqinfo {
__u32 dqi_valid;
};
/*
* Definitions for quota netlink interface
*/
#define QUOTA_NL_NOWARN 0
#define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */
#define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */
#define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */
#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */
#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */
#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */
enum {
QUOTA_NL_C_UNSPEC,
QUOTA_NL_C_WARNING,
__QUOTA_NL_C_MAX,
};
#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
enum {
QUOTA_NL_A_UNSPEC,
QUOTA_NL_A_QTYPE,
QUOTA_NL_A_EXCESS_ID,
QUOTA_NL_A_WARNING,
QUOTA_NL_A_DEV_MAJOR,
QUOTA_NL_A_DEV_MINOR,
QUOTA_NL_A_CAUSED_ID,
__QUOTA_NL_A_MAX,
};
#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
#ifdef __KERNEL__
#include <linux/spinlock.h>
#include <linux/rwsem.h>