sys/geom: consistently use _PATH_DEV instead of hardcoding "/dev/".
Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25565
This commit is contained in:
parent
d371ed1c4b
commit
8510f61acd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363034
4
sys/geom/cache/g_cache.c
vendored
4
sys/geom/cache/g_cache.c
vendored
@ -762,8 +762,8 @@ g_cache_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg1' argument");
|
gctl_error(req, "No 'arg1' argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_CACHE_DEBUG(1, "Provider %s is invalid.", name);
|
G_CACHE_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
|
@ -845,8 +845,8 @@ g_concat_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%u' argument.", no);
|
gctl_error(req, "No 'arg%u' argument.", no);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_CONCAT_DEBUG(1, "Disk %s is invalid.", name);
|
G_CONCAT_DEBUG(1, "Disk %s is invalid.", name);
|
||||||
@ -871,8 +871,8 @@ g_concat_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument.", no);
|
gctl_error(req, "No 'arg%d' argument.", no);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
KASSERT(pp != NULL, ("Provider %s disappear?!", name));
|
KASSERT(pp != NULL, ("Provider %s disappear?!", name));
|
||||||
if (g_concat_add_disk(sc, pp, no - 1) != 0) {
|
if (g_concat_add_disk(sc, pp, no - 1) != 0) {
|
||||||
|
@ -120,8 +120,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%u' argument.", 0);
|
gctl_error(req, "No 'arg%u' argument.", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
gctl_error(req, "Provider %s is invalid.", name);
|
gctl_error(req, "Provider %s is invalid.", name);
|
||||||
@ -186,8 +186,8 @@ g_eli_find_device(struct g_class *mp, const char *prov)
|
|||||||
struct g_provider *pp;
|
struct g_provider *pp;
|
||||||
struct g_consumer *cp;
|
struct g_consumer *cp;
|
||||||
|
|
||||||
if (strncmp(prov, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(prov, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
prov += strlen("/dev/");
|
prov += strlen(_PATH_DEV);
|
||||||
LIST_FOREACH(gp, &mp->geom, geom) {
|
LIST_FOREACH(gp, &mp->geom, geom) {
|
||||||
sc = gp->softc;
|
sc = gp->softc;
|
||||||
if (sc == NULL)
|
if (sc == NULL)
|
||||||
@ -373,8 +373,8 @@ g_eli_ctl_onetime(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%u' argument.", 0);
|
gctl_error(req, "No 'arg%u' argument.", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
gctl_error(req, "Provider %s is invalid.", name);
|
gctl_error(req, "Provider %s is invalid.", name);
|
||||||
|
@ -419,6 +419,10 @@ g_free(void *ptr)
|
|||||||
|
|
||||||
int g_is_geom_thread(struct thread *td);
|
int g_is_geom_thread(struct thread *td);
|
||||||
|
|
||||||
|
#ifndef _PATH_DEV
|
||||||
|
#define _PATH_DEV "/dev/"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
/* geom_ctl.c */
|
/* geom_ctl.c */
|
||||||
|
@ -166,7 +166,7 @@ init_dumpdev(struct cdev *dev)
|
|||||||
{
|
{
|
||||||
struct diocskerneldump_arg kda;
|
struct diocskerneldump_arg kda;
|
||||||
struct g_consumer *cp;
|
struct g_consumer *cp;
|
||||||
const char *devprefix = "/dev/", *devname;
|
const char *devprefix = _PATH_DEV, *devname;
|
||||||
int error;
|
int error;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
@ -760,10 +760,6 @@ g_resize_provider(struct g_provider *pp, off_t size)
|
|||||||
g_post_event(g_resize_provider_event, hh, M_WAITOK, NULL);
|
g_post_event(g_resize_provider_event, hh, M_WAITOK, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _PATH_DEV
|
|
||||||
#define _PATH_DEV "/dev/"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct g_provider *
|
struct g_provider *
|
||||||
g_provider_by_name(char const *arg)
|
g_provider_by_name(char const *arg)
|
||||||
{
|
{
|
||||||
|
@ -2511,7 +2511,7 @@ g_journal_find_device(struct g_class *mp, const char *name)
|
|||||||
struct g_geom *gp;
|
struct g_geom *gp;
|
||||||
struct g_provider *pp;
|
struct g_provider *pp;
|
||||||
|
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
LIST_FOREACH(gp, &mp->geom, geom) {
|
LIST_FOREACH(gp, &mp->geom, geom) {
|
||||||
sc = gp->softc;
|
sc = gp->softc;
|
||||||
|
@ -442,8 +442,8 @@ g_label_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", 1);
|
gctl_error(req, "No 'arg%d' argument", 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_LABEL_DEBUG(1, "Provider %s is invalid.", name);
|
G_LABEL_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
@ -467,8 +467,8 @@ g_label_skip_dir(const char *name)
|
|||||||
char path[64];
|
char path[64];
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
if (strncmp(name, G_LABEL_DIR "/", strlen(G_LABEL_DIR "/")) == 0)
|
if (strncmp(name, G_LABEL_DIR "/", strlen(G_LABEL_DIR "/")) == 0)
|
||||||
name += strlen(G_LABEL_DIR "/");
|
name += strlen(G_LABEL_DIR "/");
|
||||||
for (i = 0; g_labels[i] != NULL; i++) {
|
for (i = 0; g_labels[i] != NULL; i++) {
|
||||||
|
@ -131,7 +131,7 @@ g_mirror_find_disk(struct g_mirror_softc *sc, const char *name)
|
|||||||
struct g_mirror_disk *disk;
|
struct g_mirror_disk *disk;
|
||||||
|
|
||||||
sx_assert(&sc->sc_lock, SX_XLOCKED);
|
sx_assert(&sc->sc_lock, SX_XLOCKED);
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
LIST_FOREACH(disk, &sc->sc_disks, d_next) {
|
LIST_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
if (disk->d_consumer == NULL)
|
if (disk->d_consumer == NULL)
|
||||||
@ -450,8 +450,8 @@ g_mirror_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
g_topology_unlock();
|
g_topology_unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_MIRROR_DEBUG(1, "Disk %s is invalid.", name);
|
G_MIRROR_DEBUG(1, "Disk %s is invalid.", name);
|
||||||
@ -501,8 +501,8 @@ g_mirror_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
for (attached = 0, no = 1; no < *nargs; no++) {
|
for (attached = 0, no = 1; no < *nargs; no++) {
|
||||||
snprintf(param, sizeof(param), "arg%u", no);
|
snprintf(param, sizeof(param), "arg%u", no);
|
||||||
name = gctl_get_asciiparam(req, param);
|
name = gctl_get_asciiparam(req, param);
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_MIRROR_DEBUG(1, "Provider %s disappear?!", name);
|
G_MIRROR_DEBUG(1, "Provider %s disappear?!", name);
|
||||||
@ -686,7 +686,7 @@ g_mirror_ctl_insert(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "Provider %s already inserted.", name);
|
gctl_error(req, "Provider %s already inserted.", name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
|
@ -426,8 +426,8 @@ g_mountver_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_MOUNTVER_DEBUG(1, "Provider %s is invalid.", name);
|
G_MOUNTVER_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
@ -483,8 +483,8 @@ g_mountver_ctl_destroy(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
gp = g_mountver_find_geom(mp, name);
|
gp = g_mountver_find_geom(mp, name);
|
||||||
if (gp == NULL) {
|
if (gp == NULL) {
|
||||||
G_MOUNTVER_DEBUG(1, "Device %s is invalid.", name);
|
G_MOUNTVER_DEBUG(1, "Device %s is invalid.", name);
|
||||||
|
@ -944,7 +944,7 @@ g_multipath_ctl_add_name(struct gctl_req *req, struct g_class *mp,
|
|||||||
struct g_consumer *cp;
|
struct g_consumer *cp;
|
||||||
struct g_provider *pp;
|
struct g_provider *pp;
|
||||||
const char *mpname;
|
const char *mpname;
|
||||||
static const char devpf[6] = "/dev/";
|
static const char devpf[6] = _PATH_DEV;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
g_topology_assert();
|
g_topology_assert();
|
||||||
@ -1007,7 +1007,7 @@ g_multipath_ctl_prefer(struct gctl_req *req, struct g_class *mp)
|
|||||||
struct g_multipath_softc *sc;
|
struct g_multipath_softc *sc;
|
||||||
struct g_consumer *cp;
|
struct g_consumer *cp;
|
||||||
const char *name, *mpname;
|
const char *name, *mpname;
|
||||||
static const char devpf[6] = "/dev/";
|
static const char devpf[6] = _PATH_DEV;
|
||||||
int *nargs;
|
int *nargs;
|
||||||
|
|
||||||
g_topology_assert();
|
g_topology_assert();
|
||||||
|
@ -676,8 +676,8 @@ g_nop_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
@ -787,8 +787,8 @@ g_nop_ctl_configure(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL || pp->geom->class != mp) {
|
if (pp == NULL || pp->geom->class != mp) {
|
||||||
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
@ -857,8 +857,8 @@ g_nop_ctl_destroy(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
gp = g_nop_find_geom(mp, name);
|
gp = g_nop_find_geom(mp, name);
|
||||||
if (gp == NULL) {
|
if (gp == NULL) {
|
||||||
G_NOP_DEBUG(1, "Device %s is invalid.", name);
|
G_NOP_DEBUG(1, "Device %s is invalid.", name);
|
||||||
@ -902,8 +902,8 @@ g_nop_ctl_reset(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%d' argument", i);
|
gctl_error(req, "No 'arg%d' argument", i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL || pp->geom->class != mp) {
|
if (pp == NULL || pp->geom->class != mp) {
|
||||||
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
G_NOP_DEBUG(1, "Provider %s is invalid.", name);
|
||||||
|
@ -50,10 +50,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include "g_part_if.h"
|
#include "g_part_if.h"
|
||||||
|
|
||||||
#ifndef _PATH_DEV
|
|
||||||
#define _PATH_DEV "/dev/"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static kobj_method_t g_part_null_methods[] = {
|
static kobj_method_t g_part_null_methods[] = {
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -775,7 +775,7 @@ g_raid_open_consumer(struct g_raid_softc *sc, const char *name)
|
|||||||
|
|
||||||
g_topology_assert();
|
g_topology_assert();
|
||||||
|
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL)
|
if (pp == NULL)
|
||||||
|
@ -2618,7 +2618,7 @@ g_raid_md_ctl_ddf(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -2208,7 +2208,7 @@ g_raid_md_ctl_intel(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -1268,7 +1268,7 @@ g_raid_md_ctl_jmicron(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -1273,7 +1273,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -1609,7 +1609,7 @@ g_raid_md_ctl_promise(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -1355,7 +1355,7 @@ g_raid_md_ctl_sii(struct g_raid_md_object *md,
|
|||||||
error = -2;
|
error = -2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (strncmp(diskname, "/dev/", 5) == 0)
|
if (strncmp(diskname, _PATH_DEV, 5) == 0)
|
||||||
diskname += 5;
|
diskname += 5;
|
||||||
|
|
||||||
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
TAILQ_FOREACH(disk, &sc->sc_disks, d_next) {
|
||||||
|
@ -78,7 +78,7 @@ g_raid3_find_disk(struct g_raid3_softc *sc, const char *name)
|
|||||||
u_int n;
|
u_int n;
|
||||||
|
|
||||||
sx_assert(&sc->sc_lock, SX_XLOCKED);
|
sx_assert(&sc->sc_lock, SX_XLOCKED);
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
for (n = 0; n < sc->sc_ndisks; n++) {
|
for (n = 0; n < sc->sc_ndisks; n++) {
|
||||||
disk = &sc->sc_disks[n];
|
disk = &sc->sc_disks[n];
|
||||||
@ -431,7 +431,7 @@ g_raid3_ctl_insert(struct gctl_req *req, struct g_class *mp)
|
|||||||
no = gctl_get_paraml(req, "number", sizeof(*no));
|
no = gctl_get_paraml(req, "number", sizeof(*no));
|
||||||
else
|
else
|
||||||
no = NULL;
|
no = NULL;
|
||||||
if (strncmp(name, "/dev/", 5) == 0)
|
if (strncmp(name, _PATH_DEV, 5) == 0)
|
||||||
name += 5;
|
name += 5;
|
||||||
g_topology_lock();
|
g_topology_lock();
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
|
@ -1096,8 +1096,8 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%u' argument.", no);
|
gctl_error(req, "No 'arg%u' argument.", no);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
if (pp == NULL) {
|
if (pp == NULL) {
|
||||||
G_STRIPE_DEBUG(1, "Disk %s is invalid.", name);
|
G_STRIPE_DEBUG(1, "Disk %s is invalid.", name);
|
||||||
@ -1122,8 +1122,8 @@ g_stripe_ctl_create(struct gctl_req *req, struct g_class *mp)
|
|||||||
gctl_error(req, "No 'arg%u' argument.", no);
|
gctl_error(req, "No 'arg%u' argument.", no);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (strncmp(name, "/dev/", strlen("/dev/")) == 0)
|
if (strncmp(name, _PATH_DEV, strlen(_PATH_DEV)) == 0)
|
||||||
name += strlen("/dev/");
|
name += strlen(_PATH_DEV);
|
||||||
pp = g_provider_by_name(name);
|
pp = g_provider_by_name(name);
|
||||||
KASSERT(pp != NULL, ("Provider %s disappear?!", name));
|
KASSERT(pp != NULL, ("Provider %s disappear?!", name));
|
||||||
if (g_stripe_add_disk(sc, pp, no - 1) != 0) {
|
if (g_stripe_add_disk(sc, pp, no - 1) != 0) {
|
||||||
|
@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#define iswhite(c) (((c) == ' ') || ((c) == '\t'))
|
#define iswhite(c) (((c) == ' ') || ((c) == '\t'))
|
||||||
#else
|
#else
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -466,7 +467,7 @@ gv_new_drive(int max, char *token[])
|
|||||||
}
|
}
|
||||||
ptr = token[j];
|
ptr = token[j];
|
||||||
|
|
||||||
if (strncmp(ptr, "/dev/", 5) == 0)
|
if (strncmp(ptr, _PATH_DEV, 5) == 0)
|
||||||
ptr += 5;
|
ptr += 5;
|
||||||
strlcpy(d->device, ptr, sizeof(d->device));
|
strlcpy(d->device, ptr, sizeof(d->device));
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,8 +112,4 @@ struct g_virstor_bio_q {
|
|||||||
|
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#ifndef _PATH_DEV
|
|
||||||
#define _PATH_DEV "/dev/"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !_G_VIRSTOR_H_ */
|
#endif /* !_G_VIRSTOR_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user