summaryrefslogtreecommitdiffstats
path: root/mdopen.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-15 08:02:41 +0200
committerNeil Brown <neilb@suse.de>2006-05-15 08:02:41 +0200
commit5bbb48424bb461bab9b883f37ac82c8d2405f49e (patch)
tree06f37fe41edbe1dc7191eed6f68801a16dc12618 /mdopen.c
parentLimit size of bitmap to 2million chunks. (diff)
downloadmdadm-5bbb48424bb461bab9b883f37ac82c8d2405f49e.tar.xz
mdadm-5bbb48424bb461bab9b883f37ac82c8d2405f49e.zip
Allow default creation info to to be stored in mdadm.conf
Default owner, group, mode and 'auto' flag can be given in a 'CREATE' line. Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to '')
-rw-r--r--mdopen.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/mdopen.c b/mdopen.c
index 8c3eabb4..598c6a2a 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -82,7 +82,7 @@ void make_parts(char *dev, int cnt)
* If it exists and is not an md device, is not the right type (partitioned or not),
* or is currently in-use, we remove the device, but remember the owner and mode.
* If it now doesn't exist, we find a new md array and create the device.
- * Default ownership is user=0, group=0 perm=0600
+ * Default ownership/mode comes from config file.
*/
int open_mddev(char *dev, int autof)
{
@@ -93,8 +93,12 @@ int open_mddev(char *dev, int autof)
int must_remove = 0;
struct mdstat_ent *mdlist;
int num;
+ struct createinfo *ci = conf_get_create_info(NULL);
- if (autof) {
+ if (autof == 0)
+ autof = ci->autof;
+
+ if (autof && autof != -3) {
/* autof is set, so we need to check that the name is ok,
* and possibly create one if not
*/
@@ -212,6 +216,11 @@ int open_mddev(char *dev, int autof)
perror("chown");
if (chmod(dev, stb.st_mode & 07777))
perror("chmod");
+ } else {
+ if (chown(dev, ci->uid, ci->gid))
+ perror("chown");
+ if (chmod(dev, ci->mode))
+ perror("chmod");
}
stat(dev, &stb);
add_dev(dev, &stb, 0, NULL);