[PATCH 1/5] btrfs: sysfs: Add envp argument to btrfs_kobject_uevent

From: Marcos Paulo de Souza
Date: Wed Oct 23 2019 - 22:34:45 EST


From: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>

This new argument will be used by the next patches for sending uevents
related to subvolumes being added/removed. These uevents will contain
environment data that will be sent to userspace, making it possible to
take actions once these events arrive.

Signed-off-by: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
---
fs/btrfs/sysfs.c | 7 +++++--
fs/btrfs/sysfs.h | 3 ++-
fs/btrfs/volumes.c | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index f6d3c80f2e28..93a8ed9e4fe8 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -998,11 +998,14 @@ int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
return error;
}

-void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action)
+void btrfs_kobject_uevent(struct block_device *bdev,
+ enum kobject_action action,
+ char *envp[])
{
int ret;

- ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action);
+ ret = kobject_uevent_env(&disk_to_dev(bdev->bd_disk)->kobj,
+ action, envp);
if (ret)
pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n",
action, kobject_name(&disk_to_dev(bdev->bd_disk)->kobj),
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index 610e9c36a94c..5be3953074ad 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -26,7 +26,8 @@ void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices,
const u8 *fsid);
void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
u64 bit, enum btrfs_feature_set set);
-void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action);
+void btrfs_kobject_uevent(struct block_device *bdev,
+ enum kobject_action action, char *env[]);

int __init btrfs_init_sysfs(void);
void __cold btrfs_exit_sysfs(void);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index bdfe4493e43a..7a7a9cae9b80 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -7580,7 +7580,7 @@ void btrfs_scratch_superblocks(struct block_device *bdev, const char *device_pat
}

/* Notify udev that device has changed */
- btrfs_kobject_uevent(bdev, KOBJ_CHANGE);
+ btrfs_kobject_uevent(bdev, KOBJ_CHANGE, NULL);

/* Update ctime/mtime for device path for libblkid */
update_dev_time(device_path);
--
2.23.0