diff options
author | Doug Ledford <dledford@redhat.com> | 2010-04-02 10:53:47 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2010-04-13 12:55:35 -0400 |
commit | 9f55479619c156538434921cbaac0bafa8bccb86 (patch) | |
tree | 840c5cfbc5fdb92b02b3bc22ca8853a35355cffb /mapfile.c | |
parent | b8d3bda04cbb5c5ff289b16f33401f9cef0a6dff (diff) | |
download | mdadm-9f55479619c156538434921cbaac0bafa8bccb86.tar.gz mdadm-9f55479619c156538434921cbaac0bafa8bccb86.tar.xz mdadm-9f55479619c156538434921cbaac0bafa8bccb86.zip |
Fix all the confusion over directories once and for all. We now have
3 directory definitions: mdmon directory for its pid and sock files,
mdmonitor directory which is for the mdadm monitor mode pid file and
can only be passed in via command line, and the directory for the
mdadm map file. Only the mdadm map file still hunts multiple locations,
and the number of locations has been reduced to /var/run and the
compile time specified location. I could see lowering that to just
1 location, but I didn't do that with this patch.
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'mapfile.c')
-rw-r--r-- | mapfile.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -52,28 +52,26 @@ #include <ctype.h> #define mapnames(base) { base, base ".new", base ".lock"} -char *mapname[3][3] = { - mapnames(VAR_RUN "/map"), - mapnames("/var/run/mdadm.map"), - mapnames(ALT_RUN "/" ALT_MAPFILE) +char *mapname[2][3] = { + mapnames(MAP_DIR "/" MAP_FILE), + mapnames("/var/run/mdadm.map") }; -char *mapdir[3] = { VAR_RUN, NULL, ALT_RUN }; +char *mapdir[2] = { MAP_DIR, NULL }; -int mapmode[3] = { O_RDONLY, O_RDWR|O_CREAT, O_RDWR|O_CREAT | O_TRUNC }; +int mapmode[3] = { O_RDONLY, O_RDWR|O_CREAT, O_RDWR|O_CREAT|O_TRUNC }; char *mapsmode[3] = { "r", "w", "w"}; FILE *open_map(int modenum, int *choice) { int i; - for (i = 0 ; i < 3 ; i++) { + for (i = 0 ; i < 2 ; i++) { int fd; - if ((mapmode[modenum] & O_CREAT) && - mapdir[modenum]) + if ((mapmode[modenum] & O_CREAT) && mapdir[i]) /* Attempt to create directory, don't worry about * failure. */ - mkdir(mapdir[modenum], 0755); + mkdir(mapdir[i], 0755); fd = open(mapname[i][modenum], mapmode[modenum], 0600); if (fd >= 0) { *choice = i; |