summaryrefslogtreecommitdiff
path: root/libbcache/notify.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-03-19 15:56:34 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-03-19 17:31:47 -0800
commit5ec39af8eaba49aee7bafa44c661da39e2f40dc3 (patch)
tree1fb1a981602cbf22c7d2b2dba1168c715d7cecb5 /libbcache/notify.c
parentbb1941de5378a7b8122d3575dcbc7d0aeb6326f0 (diff)
Rename from bcache-tools to bcachefs-tools
Diffstat (limited to 'libbcache/notify.c')
-rw-r--r--libbcache/notify.c105
1 files changed, 0 insertions, 105 deletions
diff --git a/libbcache/notify.c b/libbcache/notify.c
deleted file mode 100644
index b06a8749..00000000
--- a/libbcache/notify.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Code for sending uevent notifications to user-space.
- *
- * Copyright 2015 Datera, Inc.
- */
-
-#include "bcache.h"
-#include "notify.h"
-
-#include <linux/kobject.h>
-
-#define notify_var(c, format, ...) \
-({ \
- int ret; \
- lockdep_assert_held(&(c)->uevent_lock); \
- ret = add_uevent_var(&(c)->uevent_env, format, ##__VA_ARGS__); \
- WARN_ON_ONCE(ret); \
-})
-
-static void notify_get(struct bch_fs *c)
-{
- struct kobj_uevent_env *env = &c->uevent_env;
-
- mutex_lock(&c->uevent_lock);
- env->envp_idx = 0;
- env->buflen = 0;
-
- notify_var(c, "SET_UUID=%pU", c->sb.user_uuid.b);
-}
-
-static void notify_get_cache(struct bch_dev *ca)
-{
- struct bch_fs *c = ca->fs;
-
- notify_get(c);
- notify_var(c, "UUID=%pU", ca->uuid.b);
- notify_var(c, "BLOCKDEV=%s", ca->name);
-}
-
-static void notify_put(struct bch_fs *c)
-{
- struct kobj_uevent_env *env = &c->uevent_env;
-
- env->envp[env->envp_idx] = NULL;
- kobject_uevent_env(&c->kobj, KOBJ_CHANGE, env->envp);
- mutex_unlock(&c->uevent_lock);
-}
-
-void bch_notify_fs_read_write(struct bch_fs *c)
-{
- notify_get(c);
- notify_var(c, "STATE=active");
- notify_put(c);
-}
-
-void bch_notify_fs_read_only(struct bch_fs *c)
-{
- notify_get(c);
- notify_var(c, "STATE=readonly");
- notify_put(c);
-}
-
-void bch_notify_fs_stopped(struct bch_fs *c)
-{
- notify_get(c);
- notify_var(c, "STATE=stopped");
- notify_put(c);
-}
-
-void bch_notify_dev_read_write(struct bch_dev *ca)
-{
- struct bch_fs *c = ca->fs;
-
- notify_get_cache(ca);
- notify_var(c, "STATE=active");
- notify_put(c);
-}
-
-void bch_notify_dev_read_only(struct bch_dev *ca)
-{
- struct bch_fs *c = ca->fs;
-
- notify_get_cache(ca);
- notify_var(c, "STATE=readonly");
- notify_put(c);
-}
-
-void bch_notify_dev_added(struct bch_dev *ca)
-{
- struct bch_fs *c = ca->fs;
-
- notify_get_cache(ca);
- notify_var(c, "STATE=removing");
- notify_put(c);
-}
-
-void bch_notify_dev_error(struct bch_dev *ca, bool fatal)
-{
- struct bch_fs *c = ca->fs;
-
- notify_get_cache(ca);
- notify_var(c, "STATE=error");
- notify_var(c, "FATAL=%d", fatal);
- notify_put(c);
-}