early-lookup.c (017fb83ee0612595ec70c65ddd83472706b02a50) early-lookup.c (648fa60fa7de3ca6f6303e1721591ad73def9cf0)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Code for looking up block devices in the early boot code before mounting the
4 * root file system.
5 */
6#include <linux/blkdev.h>
7#include <linux/ctype.h>
8

--- 161 unchanged lines hidden (view full) ---

170
171 /*
172 * Try non-existent, but valid partition, which may only exist after
173 * opening the device, like partitioned md devices.
174 */
175 while (p > s && isdigit(p[-1]))
176 p--;
177 if (p == s || !*p || *p == '0')
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Code for looking up block devices in the early boot code before mounting the
4 * root file system.
5 */
6#include <linux/blkdev.h>
7#include <linux/ctype.h>
8

--- 161 unchanged lines hidden (view full) ---

170
171 /*
172 * Try non-existent, but valid partition, which may only exist after
173 * opening the device, like partitioned md devices.
174 */
175 while (p > s && isdigit(p[-1]))
176 p--;
177 if (p == s || !*p || *p == '0')
178 return -EINVAL;
178 return -ENODEV;
179
180 /* try disk name without <part number> */
181 part = simple_strtoul(p, NULL, 10);
182 *p = '\0';
183 *devt = blk_lookup_devt(s, part);
184 if (*devt)
185 return 0;
186
187 /* try disk name without p<part number> */
188 if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
179
180 /* try disk name without <part number> */
181 part = simple_strtoul(p, NULL, 10);
182 *p = '\0';
183 *devt = blk_lookup_devt(s, part);
184 if (*devt)
185 return 0;
186
187 /* try disk name without p<part number> */
188 if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
189 return -EINVAL;
189 return -ENODEV;
190 p[-1] = '\0';
191 *devt = blk_lookup_devt(s, part);
192 if (*devt)
193 return 0;
194 return -ENODEV;
195}
196
197static int __init devt_from_devnum(const char *name, dev_t *devt)

--- 119 unchanged lines hidden ---
190 p[-1] = '\0';
191 *devt = blk_lookup_devt(s, part);
192 if (*devt)
193 return 0;
194 return -ENODEV;
195}
196
197static int __init devt_from_devnum(const char *name, dev_t *devt)

--- 119 unchanged lines hidden ---