]> git.pld-linux.org Git - packages/util-linux.git/blob - util-linux-mount-subtree.patch
- new
[packages/util-linux.git] / util-linux-mount-subtree.patch
1 --- util-linux-2.13-pre6/mount/mount.8.subtree  2006-06-12 09:18:26.000000000 +0200
2 +++ util-linux-2.13-pre6/mount/mount.8  2006-06-12 09:19:43.000000000 +0200
3 @@ -131,6 +131,41 @@
4  .B "mount --move olddir newdir"
5  .RE
6  
7 +Since Linux 2.6.15 it is possible to mark a mount and its submounts as shared,
8 +private, slave or unbindable. A shared mount provides ability to create mirrors
9 +of that mount such that mounts and umounts within any of the mirrors propagate
10 +to the other mirror. A slave mount receives propagation from its master, but
11 +any not vice-versa.  A private mount carries no propagation abilities.  A
12 +unbindable mount is a private mount which cannot cloned through a bind
13 +operation. Detailed semantics is documented in Documentation/sharedsubtree.txt
14 +file in the kernel source tree.
15 +.RS
16 +.br
17 +.B "mount --make-shared mountpoint"
18 +.br
19 +.B "mount --make-slave mountpoint"
20 +.br
21 +.B "mount --make-private mountpoint"
22 +.br
23 +.B "mount --make-unbindable mountpoint"
24 +.br
25 +.RE
26 +
27 +The following commands allows one to recursively change the type of all the
28 +mounts under a given mountpoint.
29 +.RS
30 +.br
31 +.B "mount --make-rshared mountpoint"
32 +.br
33 +.B "mount --make-rslave mountpoint"
34 +.br
35 +.B "mount --make-rprivate mountpoint"
36 +.br
37 +.B
38 +"mount --make-runbindable mountpoint"
39 +.br
40 +.RE
41 +
42  The
43  .I proc
44  file system is not associated with a special device, and when
45 --- util-linux-2.13-pre6/mount/mount_constants.h.subtree        2002-11-01 01:24:36.000000000 +0100
46 +++ util-linux-2.13-pre6/mount/mount_constants.h        2006-06-12 09:19:43.000000000 +0200
47 @@ -57,6 +57,18 @@
48  #ifndef MS_VERBOSE
49  #define MS_VERBOSE     0x8000  /* 32768 */
50  #endif
51 +#ifndef MS_UNBINDABLE
52 +#define MS_UNBINDABLE  (1<<17) /* 131072 unbindable*/
53 +#endif
54 +#ifndef MS_PRIVATE
55 +#define MS_PRIVATE     (1<<18) /* 262144 Private*/
56 +#endif
57 +#ifndef MS_SLAVE
58 +#define MS_SLAVE       (1<<19) /* 524288 Slave*/
59 +#endif
60 +#ifndef MS_SHARED
61 +#define MS_SHARED      (1<<20) /* 1048576 Shared*/
62 +#endif
63  /*
64   * Magic mount flag number. Had to be or-ed to the flag values.
65   */
66 --- util-linux-2.13-pre6/mount/mount.c.subtree  2006-06-12 09:18:26.000000000 +0200
67 +++ util-linux-2.13-pre6/mount/mount.c  2006-06-12 09:19:43.000000000 +0200
68 @@ -74,7 +74,9 @@
69  /* Add volumelabel in a listing of mounted devices (-l). */
70  static int list_with_volumelabel = 0;
71  
72 -/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move} */
73 +/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move|
74 + *                    make-shared|make-private|make-unbindable|make-slave}
75 + */
76  static int mounttype = 0;
77  
78  /* True if ruid != euid.  */
79 @@ -103,16 +105,18 @@
80  #define MS_USER                0x20000000
81  #define MS_OWNER       0x10000000
82  #define MS_GROUP       0x08000000
83 -#define        MS_CRYPT        0x00040000
84 -#define MS_COMMENT     0x00020000
85 +#define        MS_CRYPT        0x04000000
86 +#define MS_COMMENT     0x02000000
87  #define MS_LOOP                0x00010000
88  
89  /* Options that we keep the mount system call from seeing.  */
90  #define MS_NOSYS       (MS_NOAUTO|MS_USERS|MS_USER|MS_COMMENT|MS_LOOP)
91  
92  /* Options that we keep from appearing in the options field in the mtab.  */
93  #define MS_NOMTAB      (MS_REMOUNT|MS_NOAUTO|MS_USERS|MS_USER)
94  
95 +#define MS_PROPAGATION  (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE)
96 +
97  /* Options that we make ordinary users have by default.  */
98  #define MS_SECURE      (MS_NOEXEC|MS_NOSUID|MS_NODEV)
99
100 @@ -346,6 +350,9 @@
101                 *flags |= MS_RDONLY;
102         if (readwrite)
103                 *flags &= ~MS_RDONLY;
104 +
105 +       if (mounttype & MS_PROPAGATION)
106 +               *flags &= ~MS_BIND;
107         *flags |= mounttype;
108  }
109  
110 @@ -916,13 +923,15 @@
111         opt_encryption = tmp;
112        }
113  
114 -      update_mtab_entry(loop ? loopfile : crypt ? realdev : spec,
115 +      if (!(mounttype & MS_PROPAGATION)) {
116 +             update_mtab_entry(loop ? loopfile : crypt ? realdev : spec,
117                         node,
118                         types ? types : "unknown",
119                         fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user),
120                         flags,
121                         freq,
122                         pass);
123 +      }
124  
125        block_signals (SIG_UNBLOCK);
126        res = 0;
127 @@ -1461,6 +1470,14 @@
128         { "move", 0, 0, 133 },
129         { "guess-fstype", 1, 0, 134 },
130         { "rbind", 0, 0, 135 },
131 +       { "make-shared", 0, 0, 136 },
132 +       { "make-slave", 0, 0, 137 },
133 +       { "make-private", 0, 0, 138 },
134 +       { "make-unbindable", 0, 0, 139 },
135 +       { "make-rshared", 0, 0, 140 },
136 +       { "make-rslave", 0, 0, 141 },
137 +       { "make-rprivate", 0, 0, 142 },
138 +       { "make-runbindable", 0, 0, 143 },
139         { "internal-only", 0, 0, 'i' },
140         { NULL, 0, 0, 0 }
141  };
142 @@ -1487,6 +1504,17 @@
143           "       mount --bind olddir newdir\n"
144           "or move a subtree:\n"
145           "       mount --move olddir newdir\n"
146 +         "One can change the type of mount containing the directory dir:\n"
147 +         "       mount --make-shared dir\n"
148 +         "       mount --make-slave dir\n"
149 +         "       mount --make-private dir\n"
150 +         "       mount --make-unbindable dir\n"
151 +         "One can change the type of all the mounts in a mount subtree\n"
152 +         "containing the directory dir:\n"
153 +         "       mount --make-rshared dir\n"
154 +         "       mount --make-rslave dir\n"
155 +         "       mount --make-rprivate dir\n"
156 +         "       mount --make-runbindable dir\n"
157           "A device can be given by name, say /dev/hda1 or /dev/cdrom,\n"
158           "or by label, using  -L label  or by uuid, using  -U uuid .\n"
159           "Other options: [-nfFrsvw] [-o options] [-p passwdfd].\n"
160 @@ -1638,6 +1666,39 @@
161                 case 135:
162                         mounttype = (MS_BIND | MS_REC);
163                         break;
164 +
165 +               case 136:
166 +                       mounttype = MS_SHARED;
167 +                       break;
168 +
169 +               case 137:
170 +                       mounttype = MS_SLAVE;
171 +                       break;
172 +
173 +               case 138:
174 +                       mounttype = MS_PRIVATE;
175 +                       break;
176 +
177 +               case 139:
178 +                       mounttype = MS_UNBINDABLE;
179 +                       break;
180 +
181 +               case 140:
182 +                       mounttype = (MS_SHARED | MS_REC);
183 +                       break;
184 +
185 +               case 141:
186 +                       mounttype = (MS_SLAVE | MS_REC);
187 +                       break;
188 +
189 +               case 142:
190 +                       mounttype = (MS_PRIVATE | MS_REC);
191 +                       break;
192 +
193 +               case 143:
194 +                       mounttype = (MS_UNBINDABLE | MS_REC);
195 +                       break;
196 +
197                 case '?':
198                 default:
199                         usage (stderr, EX_USAGE);
This page took 0.042718 seconds and 3 git commands to generate.