]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Adjust to new standard of /run
authorNeilBrown <neilb@suse.de>
Thu, 3 May 2012 04:16:56 +0000 (14:16 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 3 May 2012 04:16:56 +0000 (14:16 +1000)
Now that /run seems to be a good standard, make that
the default for storing various run-time files, rather than
/var/run or /dev/.mdadm.

Signed-off-by: NeilBrown <neilb@suse.de>
Makefile
mapfile.c
mdadm.8.in
mdadm.conf-example
mdadm.h
mdmon.8

index b8d363f881c3a4580391a9b5a8bbf14ac0adb30d..315455ba559af8f7afd1b3d0932b6ef9f69b453a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -66,13 +66,13 @@ MAILCMD =/usr/sbin/sendmail -t
 CONFFILEFLAGS = -DCONFFILE=\"$(CONFFILE)\" -DCONFFILE2=\"$(CONFFILE2)\"
 # Both MAP_DIR and MDMON_DIR should be somewhere that persists across the
 # pivotroot from early boot to late boot.
-# /dev is an odd place to put this, but it is the only directory that
-# meets the requirements.
-MAP_DIR=/dev/.mdadm
+# /run is best, but for distros that don't support that, /dev can work.
+MAP_DIR=/run/mdadm
 MAP_FILE = map
-MDMON_DIR = /dev/.mdadm
+MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
+MDMON_DIR = $(MAP_DIR)
 # place for autoreplace cookies
-FAILED_SLOTS_DIR = /dev/.mdadm/failed-slots
+FAILED_SLOTS_DIR = /run/mdadm/failed-slots
 DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
 DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
 DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
@@ -204,7 +204,8 @@ mdassemble.klibc : $(ASSEMBLE_SRCS) $(INCL)
        $(KLIBC_GCC) $(ASSEMBLE_FLAGS) -o mdassemble $(ASSEMBLE_SRCS)
 
 mdadm.8 : mdadm.8.in
-       sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' mdadm.8.in > mdadm.8
+       sed -e 's/{DEFAULT_METADATA}/$(DEFAULT_METADATA)/g' \
+       -e 's,{MAP_PATH},$(MAP_PATH),g'  mdadm.8.in > mdadm.8
 
 mdadm.man : mdadm.8
        nroff -man mdadm.8 > mdadm.man
index 9e2c89368c9cc2a0f997cbbc35e6165fa2dafe0d..b890ed2b56a9925bf5599e3a84f210a166ad40dc 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
  *  UUID       -  uuid of the array
  *  path       -  path where device created: /dev/md/home
  *
- * The best place for the mapfile wold be /var/run/mdadm/map.  However
- * it is needed during initramfs early-boot, and /var/run doesn't exist there
- * and certainly doesn't persist through to normal boot.
- * So we store it in /dev/.mdadm/map but allow this to be changed at
- * compile time. via MAP_DIR and MAP_FILE
- *
+ * The best place for the mapfile is /run/mdadm/map.  Distros and users
+ * which have not switched to /run yet can choose a different location
+ * at compile time via MAP_DIR and MAP_FILE.
  */
 #include       "mdadm.h"
 #include       <sys/file.h>
 #include       <ctype.h>
 
-#ifndef MAP_DIR
-#define MAP_DIR "/dev/.mdadm"
-#define MAP_FILE "map"
-#endif
 
 #define MAP_READ 0
 #define MAP_NEW 1
 #define MAP_LOCK 2
 #define MAP_DIRNAME 3
-#define mapnames(dir, base) { \
 
 char *mapname[4] = {
        MAP_DIR "/" MAP_FILE,
index fa4d2f3108bf2f9670ef991b3af4443518715c2b..c447da25d1f3a5e78ff733a91689e86e20d50434 100644 (file)
@@ -1434,7 +1434,7 @@ if safe-mode handling is disabled.
 .TP
 .BR \-\-rebuild\-map ", " \-r
 Rebuild the map file
-.RB ( /var/run/mdadm/map )
+.RB ( {MAP_PATH} )
 that
 .I mdadm
 uses to help track which arrays are currently being assembled.
@@ -1641,7 +1641,7 @@ does not create any entries in
 but leaves that to
 .IR udev .
 It does record information in
-.B /var/run/mdadm/map
+.B {MAP_PATH}
 which will allow
 .I udev
 to choose the correct name.
@@ -2561,11 +2561,7 @@ current host, the device will be rejected.
 .PP
 .I mdadm
 keeps a list of arrays that it has partially assembled in
-.B /var/run/mdadm/map
-(or
-.B /var/run/mdadm.map
-if the directory doesn't exist.  Or maybe even
-.BR /dev/.mdadm.map ).
+.BR {MAP_PATH} .
 If no array exists which matches
 the metadata on the new device,
 .I mdadm
@@ -2709,12 +2705,12 @@ and assemble
 .B /dev/md0
 out of all such devices with a RAID superblock with a minor number of 0.
 
-.B "  mdadm \-\-monitor \-\-scan \-\-daemonise > /var/run/mdadm"
+.B "  mdadm \-\-monitor \-\-scan \-\-daemonise > /run/mdadm/mon.pid"
 .br
 If config file contains a mail address or alert program, run mdadm in
 the background in monitor mode monitoring all md devices.  Also write
 pid of mdadm daemon to
-.BR /var/run/mdadm .
+.BR /run/mdadm/mon.pid .
 
 .B "  mdadm \-Iq /dev/somedevice"
 .br
@@ -2792,21 +2788,10 @@ they contain MD super block, and gives identifying information
 .BR mdadm.conf (5)
 for more details.
 
-.SS /var/run/mdadm/map
+.SS {MAP_PATH}
 When
 .B \-\-incremental
 mode is used, this file gets a list of arrays currently being created.
-If
-.B /var/run/mdadm
-does not exist as a directory, then
-.B /var/run/mdadm.map
-is used instead.  If
-.B /var/run
-is not available (as may be the case during early boot),
-.B /dev/.mdadm.map
-is used on the basis that
-.B /dev
-is usually available very early in boot.
 
 .SH DEVICE NAMES
 
index 7bdff6711857b1e4d0428fa753154c6817c4865b..d9d8d3967518202f87ef4a33e24a80eb87839e2e 100644 (file)
@@ -59,7 +59,7 @@
 # When used in --follow (aka --monitor) mode, mdadm needs a
 # mail address and/or a program.  This can be given with "mailaddr"
 # and "program" lines to that monitoring can be started using
-#    mdadm --follow --scan & echo $! > /var/run/mdadm
+#    mdadm --follow --scan & echo $! > /run/mdadm/mon.pid
 # If the lines are not found, mdadm will exit quietly
 #MAILADDR root@mydomain.tld
 #PROGRAM /usr/sbin/handle-mdadm-events
diff --git a/mdadm.h b/mdadm.h
index 0c91a34b0780a0aa26dc1b6f0228106ee66b3b7c..4946d4eac3d74233bfa479b2542fee0bb56bd5aa 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -71,10 +71,10 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 
 /* MAP_DIR should be somewhere that persists across the pivotroot
  * from early boot to late boot.
- * Currently /dev seems to be the only option on most distros.
+ * /run  seems to have emerged as the best standard.
  */
 #ifndef MAP_DIR
-#define MAP_DIR "/dev/.mdadm"
+#define MAP_DIR "/run/mdadm"
 #endif /* MAP_DIR */
 /* MAP_FILE is what we name the map file we put in MAP_DIR, in case you
  * want something other than the default of "map"
@@ -83,7 +83,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
 #define MAP_FILE "map"
 #endif /* MAP_FILE */
 /* MDMON_DIR is where pid and socket files used for communicating
- * with mdmon normally live.  It *should* be /var/run, but when
+ * with mdmon normally live.  Best is /var/run/mdadm as
  * mdmon is needed at early boot then it needs to write there prior
  * to /var/run being mounted read/write, and it also then needs to
  * persist beyond when /var/run is mounter read-only.  So, to be
@@ -91,7 +91,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
  * boot process and stays up as long as possible during shutdown.
  */
 #ifndef MDMON_DIR
-#define MDMON_DIR "/dev/.mdadm/"
+#define MDMON_DIR "/run/mdadm"
 #endif /* MDMON_DIR */
 
 /* FAILED_SLOTS is where to save files storing recent removal of array
@@ -99,7 +99,7 @@ extern __off64_t lseek64 __P ((int __fd, __off64_t __offset, int __whence));
  * slot for array recovery
  */
 #ifndef FAILED_SLOTS_DIR
-#define FAILED_SLOTS_DIR "/dev/.mdadm/failed-slots"
+#define FAILED_SLOTS_DIR "/run/mdadm/failed-slots"
 #endif /* FAILED_SLOTS */
 
 #include       "md_u.h"
diff --git a/mdmon.8 b/mdmon.8
index a9178b6b1b0bca0c4eedab87a9757418c1b72881..799e3dab3833df0cfc0884d94aed00043e301f13 100644 (file)
--- a/mdmon.8
+++ b/mdmon.8
@@ -218,7 +218,7 @@ and
 .B .sock
 file.  The particular filesystem to use is given to mdmon at compile
 time and defaults to
-.BR /dev/.mdadm .
+.BR /run/mdadm .
 
 This filesystem must persist through to shutdown time.