summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/block.c2
-rw-r--r--fs/devfs-core.c2
-rw-r--r--fs/fs.c14
-rw-r--r--include/driver.h8
4 files changed, 26 insertions, 0 deletions
diff --git a/common/block.c b/common/block.c
index 0edc861..e2ba9d4 100644
--- a/common/block.c
+++ b/common/block.c
@@ -374,6 +374,8 @@ int blockdevice_register(struct block_device *blk)
list_add_tail(&blk->list, &block_device_list);
+ cdev_create_default_automount(&blk->cdev);
+
return 0;
}
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 382606f..26fffbb 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -332,6 +332,8 @@ static struct cdev *__devfs_add_partition(struct cdev *cdev,
devfs_create(new);
+ cdev_create_default_automount(new);
+
return new;
}
diff --git a/fs/fs.c b/fs/fs.c
index 1901c94..9a5887f 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -328,6 +328,20 @@ int automount_add(const char *path, const char *cmd)
}
EXPORT_SYMBOL(automount_add);
+void cdev_create_default_automount(struct cdev *cdev)
+{
+ char *path, *cmd;
+
+ path = basprintf("/mnt/%s", cdev->name);
+ cmd = basprintf("mount %s", cdev->name);
+
+ make_directory(path);
+ automount_add(path, cmd);
+
+ free(cmd);
+ free(path);
+}
+
void automount_print(void)
{
struct automount *am;
diff --git a/include/driver.h b/include/driver.h
index 52e06f7..b743ed8 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -490,6 +490,14 @@ struct cdev *devfs_add_partition(const char *devname, loff_t offset,
loff_t size, unsigned int flags, const char *name);
int devfs_del_partition(const char *name);
+#ifdef CONFIG_FS_AUTOMOUNT
+void cdev_create_default_automount(struct cdev *cdev);
+#else
+static inline void cdev_create_default_automount(struct cdev *cdev)
+{
+}
+#endif
+
#define DEVFS_PARTITION_APPEND 0
/**