diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:20:04 +0200 |
commit | 1b8dfe266937a37a4c642f96ceb2347bf4c00a17 (patch) | |
tree | 0c6aab146bb3c82efd9c7846a9a4e70dcb0ec84f /meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch | |
download | meta-openembedded-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch')
-rw-r--r-- | meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch new file mode 100644 index 0000000000..b0440f4a51 --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs-5.0.7/autofs-5.0.7-add-symlink-pseudo-option.patch | |||
@@ -0,0 +1,217 @@ | |||
1 | autofs-5.0.7 - add symlink pseudo option | ||
2 | |||
3 | From: Ian Kent <raven@themaw.net> | ||
4 | |||
5 | Add a "symlink" pseudo option to tell the bind mount module to symlink | ||
6 | instead of bind when mounting mounts other than direct mounts and | ||
7 | non-root indirect mount offset mounts (aka. non-root multi-mount | ||
8 | entries). | ||
9 | --- | ||
10 | CHANGELOG | 1 + | ||
11 | include/automount.h | 3 +++ | ||
12 | lib/master_parse.y | 8 +++++++- | ||
13 | lib/master_tok.l | 1 + | ||
14 | man/auto.master.5.in | 8 ++++++++ | ||
15 | modules/mount_autofs.c | 5 +++++ | ||
16 | modules/mount_bind.c | 36 +++++++++++++++++++++++++++++++++++- | ||
17 | 7 files changed, 60 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/CHANGELOG b/CHANGELOG | ||
20 | index c189483..247d334 100644 | ||
21 | --- a/CHANGELOG | ||
22 | +++ b/CHANGELOG | ||
23 | @@ -32,6 +32,7 @@ | ||
24 | - fix wildcard multi map regression. | ||
25 | - fix file descriptor leak when reloading the daemon. | ||
26 | - depricate nosymlink pseudo option. | ||
27 | +- add symlink pseudo option. | ||
28 | |||
29 | 25/07/2012 autofs-5.0.7 | ||
30 | ======================= | ||
31 | diff --git a/include/automount.h b/include/automount.h | ||
32 | index 37541f5..e72fa0d 100644 | ||
33 | --- a/include/automount.h | ||
34 | +++ b/include/automount.h | ||
35 | @@ -455,6 +455,9 @@ struct kernel_mod_version { | ||
36 | /* Don't use bind mounts even when system supports them */ | ||
37 | #define MOUNT_FLAG_NOBIND 0x0020 | ||
38 | |||
39 | +/* Use symlinks instead of bind mounting local mounts */ | ||
40 | +#define MOUNT_FLAG_SYMLINK 0x0040 | ||
41 | + | ||
42 | struct autofs_point { | ||
43 | pthread_t thid; | ||
44 | char *path; /* Mount point name */ | ||
45 | diff --git a/lib/master_parse.y b/lib/master_parse.y | ||
46 | index f925b5a..11caf5b 100644 | ||
47 | --- a/lib/master_parse.y | ||
48 | +++ b/lib/master_parse.y | ||
49 | @@ -57,6 +57,7 @@ static char *type; | ||
50 | static char *format; | ||
51 | static long timeout; | ||
52 | static long negative_timeout; | ||
53 | +static unsigned symlnk; | ||
54 | static unsigned nobind; | ||
55 | static unsigned ghost; | ||
56 | extern unsigned global_selection_options; | ||
57 | @@ -100,7 +101,7 @@ static int master_fprintf(FILE *, char *, ...); | ||
58 | %token COMMENT | ||
59 | %token MAP | ||
60 | %token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE | ||
61 | -%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT | ||
62 | +%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK | ||
63 | %token COLON COMMA NL DDASH | ||
64 | %type <strtype> map | ||
65 | %type <strtype> options | ||
66 | @@ -186,6 +187,7 @@ line: | ||
67 | | PATH OPT_USE_WEIGHT { master_notify($1); YYABORT; } | ||
68 | | PATH OPT_DEBUG { master_notify($1); YYABORT; } | ||
69 | | PATH OPT_TIMEOUT { master_notify($1); YYABORT; } | ||
70 | + | PATH OPT_SYMLINK { master_notify($1); YYABORT; } | ||
71 | | PATH OPT_NOBIND { master_notify($1); YYABORT; } | ||
72 | | PATH OPT_GHOST { master_notify($1); YYABORT; } | ||
73 | | PATH OPT_NOGHOST { master_notify($1); YYABORT; } | ||
74 | @@ -557,6 +559,7 @@ option: daemon_option | ||
75 | |||
76 | daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; } | ||
77 | | OPT_NTIMEOUT NUMBER { negative_timeout = $2; } | ||
78 | + | OPT_SYMLINK { symlnk = 1; } | ||
79 | | OPT_NOBIND { nobind = 1; } | ||
80 | | OPT_NOGHOST { ghost = 0; } | ||
81 | | OPT_GHOST { ghost = 1; } | ||
82 | @@ -627,6 +630,7 @@ static void local_init_vars(void) | ||
83 | debug = 0; | ||
84 | timeout = -1; | ||
85 | negative_timeout = 0; | ||
86 | + symlnk = 0; | ||
87 | nobind = 0; | ||
88 | ghost = defaults_get_browse_mode(); | ||
89 | random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT; | ||
90 | @@ -811,6 +815,8 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne | ||
91 | entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT; | ||
92 | if (use_weight) | ||
93 | entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY; | ||
94 | + if (symlnk) | ||
95 | + entry->ap->flags |= MOUNT_FLAG_SYMLINK; | ||
96 | if (negative_timeout) | ||
97 | entry->ap->negative_timeout = negative_timeout; | ||
98 | |||
99 | diff --git a/lib/master_tok.l b/lib/master_tok.l | ||
100 | index 30abb15..f9b4e55 100644 | ||
101 | --- a/lib/master_tok.l | ||
102 | +++ b/lib/master_tok.l | ||
103 | @@ -361,6 +361,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo | ||
104 | return(NUMBER); | ||
105 | } | ||
106 | |||
107 | + -?symlink { return(OPT_SYMLINK); } | ||
108 | -?nobind { return(OPT_NOBIND); } | ||
109 | -?nobrowse { return(OPT_NOGHOST); } | ||
110 | -g|--ghost|-?browse { return(OPT_GHOST); } | ||
111 | diff --git a/man/auto.master.5.in b/man/auto.master.5.in | ||
112 | index 8007542..bbea43a 100644 | ||
113 | --- a/man/auto.master.5.in | ||
114 | +++ b/man/auto.master.5.in | ||
115 | @@ -159,6 +159,14 @@ on individual map entries of both types. Bind mounting of NFS file | ||
116 | systems can also be prevented for specific map entrys by adding the | ||
117 | "port=" mount option to the entries. | ||
118 | .TP | ||
119 | +.I "symlink" | ||
120 | +This option makes bind mounting use a symlink instead of an actual bind | ||
121 | +mount. It is an autofs specific option that is a pseudo mount option and | ||
122 | +so is given without a leading dash. It may be used with indirect map | ||
123 | +entries only, either in the master map (so it effects all map entries) | ||
124 | +or with individual map entries. The option is ignored for direct mounts | ||
125 | +and non-root offest mount entries. | ||
126 | +.TP | ||
127 | .I "\-r, \-\-random-multimount-selection" | ||
128 | Enables the use of ramdom selection when choosing a host from a | ||
129 | list of replicated servers. This option is applied to this mount | ||
130 | diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c | ||
131 | index ef16020..8c1e600 100644 | ||
132 | --- a/modules/mount_autofs.c | ||
133 | +++ b/modules/mount_autofs.c | ||
134 | @@ -51,6 +51,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, | ||
135 | int argc, status; | ||
136 | int nobind = ap->flags & MOUNT_FLAG_NOBIND; | ||
137 | int ghost = ap->flags & MOUNT_FLAG_GHOST; | ||
138 | + int symlnk = ap->flags & MOUNT_FLAG_SYMLINK; | ||
139 | time_t timeout = ap->entry->maps->exp_timeout; | ||
140 | unsigned logopt = ap->logopt; | ||
141 | struct map_type_info *info; | ||
142 | @@ -120,6 +121,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, | ||
143 | nobind = 1; | ||
144 | else if (strncmp(cp, "browse", 6) == 0) | ||
145 | ghost = 1; | ||
146 | + else if (strncmp(cp, "symlink", 7) == 0) | ||
147 | + symlnk = 1; | ||
148 | else if (strncmp(cp, "timeout=", 8) == 0) { | ||
149 | char *val = strchr(cp, '='); | ||
150 | unsigned tout; | ||
151 | @@ -158,6 +161,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, | ||
152 | } | ||
153 | nap = entry->ap; | ||
154 | nap->parent = ap; | ||
155 | + if (symlnk) | ||
156 | + nap->flags |= MOUNT_FLAG_SYMLINK; | ||
157 | |||
158 | argc = 1; | ||
159 | |||
160 | diff --git a/modules/mount_bind.c b/modules/mount_bind.c | ||
161 | index 9bce686..4975294 100644 | ||
162 | --- a/modules/mount_bind.c | ||
163 | +++ b/modules/mount_bind.c | ||
164 | @@ -73,10 +73,44 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int | ||
165 | char buf[MAX_ERR_BUF]; | ||
166 | int err; | ||
167 | int i, len; | ||
168 | + int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK)); | ||
169 | |||
170 | if (ap->flags & MOUNT_FLAG_REMOUNT) | ||
171 | return 0; | ||
172 | |||
173 | + /* Extract "symlink" pseudo-option which forces local filesystems | ||
174 | + * to be symlinked instead of bound. | ||
175 | + */ | ||
176 | + if (*name != '/' && !symlnk && options) { | ||
177 | + const char *comma; | ||
178 | + int o_len = strlen(options) + 1; | ||
179 | + | ||
180 | + for (comma = options; *comma != '\0';) { | ||
181 | + const char *cp; | ||
182 | + const char *end; | ||
183 | + | ||
184 | + while (*comma == ',') | ||
185 | + comma++; | ||
186 | + | ||
187 | + /* Skip leading white space */ | ||
188 | + while (*comma == ' ' || *comma == '\t') | ||
189 | + comma++; | ||
190 | + | ||
191 | + cp = comma; | ||
192 | + while (*comma != '\0' && *comma != ',') | ||
193 | + comma++; | ||
194 | + | ||
195 | + /* Skip trailing white space */ | ||
196 | + end = comma - 1; | ||
197 | + while (*comma == ' ' || *comma == '\t') | ||
198 | + end--; | ||
199 | + | ||
200 | + o_len = end - cp + 1; | ||
201 | + if (strncmp("symlink", cp, o_len) == 0) | ||
202 | + symlnk = 1; | ||
203 | + } | ||
204 | + } | ||
205 | + | ||
206 | /* Root offset of multi-mount */ | ||
207 | len = strlen(root); | ||
208 | if (root[len - 1] == '/') { | ||
209 | @@ -100,7 +134,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int | ||
210 | if (options == NULL || *options == '\0') | ||
211 | options = "defaults"; | ||
212 | |||
213 | - if (bind_works) { | ||
214 | + if (!symlnk && bind_works) { | ||
215 | int status, existed = 1; | ||
216 | |||
217 | debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath); | ||