• Home
  • Raw
  • Download

Lines Matching +full:mtd +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* MTD-based superblock management
4 * Copyright © 2001-2007 Red Hat, Inc. All Rights Reserved.
5 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
11 #include <linux/mtd/super.h>
17 #include <linux/backing-dev.h>
23 * - they are if the underlying MTD device is the same
27 struct mtd_info *mtd = fc->sget_key; in mtd_test_super() local
29 if (sb->s_mtd == fc->sget_key) { in mtd_test_super()
31 mtd->index, mtd->name); in mtd_test_super()
36 sb->s_mtd->index, sb->s_mtd->name, mtd->index, mtd->name); in mtd_test_super()
41 * mark the superblock by the MTD device it is using
42 * - set the device number to be the correct MTD block device for pesuperstence
47 sb->s_mtd = fc->sget_key; in mtd_set_super()
48 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, sb->s_mtd->index); in mtd_set_super()
49 sb->s_bdi = bdi_get(mtd_bdi); in mtd_set_super()
54 * get a superblock on an MTD-backed filesystem
57 struct mtd_info *mtd, in mtd_get_sb() argument
64 fc->sget_key = mtd; in mtd_get_sb()
69 if (sb->s_root) { in mtd_get_sb()
72 mtd->index, mtd->name); in mtd_get_sb()
73 put_mtd_device(mtd); in mtd_get_sb()
77 mtd->index, mtd->name); in mtd_get_sb()
83 sb->s_flags |= SB_ACTIVE; in mtd_get_sb()
86 BUG_ON(fc->root); in mtd_get_sb()
87 fc->root = dget(sb->s_root); in mtd_get_sb()
96 * get a superblock on an MTD-backed filesystem by MTD device number
102 struct mtd_info *mtd; in mtd_get_sb_by_nr() local
104 mtd = get_mtd_device(NULL, mtdnr); in mtd_get_sb_by_nr()
105 if (IS_ERR(mtd)) { in mtd_get_sb_by_nr()
107 return PTR_ERR(mtd); in mtd_get_sb_by_nr()
110 return mtd_get_sb(fc, mtd, fill_super); in mtd_get_sb_by_nr()
114 * get_tree_mtd - Get a superblock based on a single MTD device
128 if (!fc->source) in get_tree_mtd()
131 pr_debug("MTDSB: dev_name \"%s\"\n", fc->source); in get_tree_mtd()
134 * CONFIG_BLOCK=n - we specify the underlying MTD device by number or in get_tree_mtd()
135 * by name, so that we don't require block device support to be present in get_tree_mtd()
138 if (fc->source[0] == 'm' && in get_tree_mtd()
139 fc->source[1] == 't' && in get_tree_mtd()
140 fc->source[2] == 'd') { in get_tree_mtd()
141 if (fc->source[3] == ':') { in get_tree_mtd()
142 struct mtd_info *mtd; in get_tree_mtd() local
144 /* mount by MTD device name */ in get_tree_mtd()
145 pr_debug("MTDSB: mtd:%%s, name \"%s\"\n", in get_tree_mtd()
146 fc->source + 4); in get_tree_mtd()
148 mtd = get_mtd_device_nm(fc->source + 4); in get_tree_mtd()
149 if (!IS_ERR(mtd)) in get_tree_mtd()
150 return mtd_get_sb(fc, mtd, fill_super); in get_tree_mtd()
152 errorf(fc, "MTD: MTD device with name \"%s\" not found", in get_tree_mtd()
153 fc->source + 4); in get_tree_mtd()
155 } else if (isdigit(fc->source[3])) { in get_tree_mtd()
156 /* mount by MTD device number name */ in get_tree_mtd()
159 mtdnr = simple_strtoul(fc->source + 3, &endptr, 0); in get_tree_mtd()
162 pr_debug("MTDSB: mtd%%d, mtdnr %d\n", mtdnr); in get_tree_mtd()
169 /* try the old way - the hack where we allowed users to mount in get_tree_mtd()
172 bdev = lookup_bdev(fc->source); in get_tree_mtd()
175 errorf(fc, "MTD: Couldn't look up '%s': %d", fc->source, ret); in get_tree_mtd()
180 major = MAJOR(bdev->bd_dev); in get_tree_mtd()
181 mtdnr = MINOR(bdev->bd_dev); in get_tree_mtd()
189 if (!(fc->sb_flags & SB_SILENT)) in get_tree_mtd()
190 errorf(fc, "MTD: Attempt to mount non-MTD device \"%s\"", in get_tree_mtd()
191 fc->source); in get_tree_mtd()
192 return -EINVAL; in get_tree_mtd()
197 * destroy an MTD-based superblock
202 put_mtd_device(sb->s_mtd); in kill_mtd_super()
203 sb->s_mtd = NULL; in kill_mtd_super()