• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/busybox


コミットメタ情報

リビジョンbbfc3392b8e61dd4c63b1926bab20445ac245bd3 (tree)
日時2015-02-25 06:21:41
作者Dan Pasanen <dan.pasanen@gmai...>
コミッターGerrit Code Review

ログメッセージ

mount: respect a user-specified fstype

* Don't attempt to auto-detect the filesystem type using blkid

if the user has specifically specified a type

Change-Id: Icebbc3189fc59af9fe52e12b693f3b7ae516e2c7

変更サマリ

差分

--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -341,6 +341,7 @@ struct globals {
341341 unsigned verbose;
342342 #endif
343343 llist_t *fslist;
344+ int user_fstype;
344345 char getmntent_buf[1];
345346 } FIX_ALIASING;
346347 enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_buf) };
@@ -352,6 +353,7 @@ enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_b
352353 #define verbose 0
353354 #endif
354355 #define fslist (G.fslist )
356+#define user_fstype (G.user_fstype )
355357 #define getmntent_buf (G.getmntent_buf )
356358 #define INIT_G() do { } while (0)
357359
@@ -1784,13 +1786,20 @@ static int singlemount(struct mntent *mp, int ignore_busy)
17841786
17851787 vfsflags = parse_mount_options(mp->mnt_opts, &filteropts);
17861788
1787- detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
1789+ if (user_fstype) {
1790+ // Treat fstype "auto" as unspecified
1791+ if (mp->mnt_type && !strcmp(mp->mnt_type, "auto"))
1792+ mp->mnt_type = NULL;
1793+ } else {
1794+ // If user didn't specify an fstype and blkid disagrees or the
1795+ // fstype is "auto", trust blkid's determination of the fstype.
1796+
1797+ detected_fstype = get_fstype_from_devname(mp->mnt_fsname);
17881798
1789- // If fstype is auto or disagrees with blkid, trust blkid's
1790- // determination of the filesystem type
1791- if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
1792- (detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
1793- mp->mnt_type = detected_fstype;
1799+ if ((mp->mnt_type && !strcmp(mp->mnt_type, "auto")) ||
1800+ (detected_fstype && strcmp(detected_fstype, mp->mnt_type)))
1801+ mp->mnt_type = detected_fstype;
1802+ }
17941803
17951804 // Might this be a virtual filesystem?
17961805 if (ENABLE_FEATURE_MOUNT_HELPERS && strchr(mp->mnt_fsname, '#')) {
@@ -2067,6 +2076,8 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
20672076 opt_complementary = "?2o::" IF_FEATURE_MOUNT_VERBOSE("vv");
20682077 opt = getopt32(argv, OPTION_STR, &lst_o, &fstype, &O_optmatch
20692078 IF_FEATURE_MOUNT_VERBOSE(, &verbose));
2079+
2080+ if (opt & OPT_t) user_fstype = 1;
20702081 while (lst_o) append_mount_options(&cmdopts, llist_pop(&lst_o)); // -o
20712082 if (opt & OPT_r) append_mount_options(&cmdopts, "ro"); // -r
20722083 if (opt & OPT_w) append_mount_options(&cmdopts, "rw"); // -w
@@ -2280,6 +2291,8 @@ int mount_main(int argc UNUSED_PARAM, char **argv)
22802291 mtcur->mnt_opts = xstrdup(mtcur->mnt_opts);
22812292 append_mount_options(&(mtcur->mnt_opts), cmdopts);
22822293 resolve_mount_spec(&mtpair->mnt_fsname);
2294+ if (user_fstype)
2295+ mtcur->mnt_type = fstype;
22832296 rc = singlemount(mtcur, /*ignore_busy:*/ 0);
22842297 if (ENABLE_FEATURE_CLEAN_UP)
22852298 free(mtcur->mnt_opts);