Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 725
b: refs/heads/master
c: 40be0c2
h: refs/heads/master
i:
  723: 8b9c0f7
v: v3
  • Loading branch information
Lars Marowsky-Bree authored and Linus Torvalds committed May 1, 2005
1 parent 9b63735 commit 3ddb52a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4750e2c0c59e0c84c6c036b3d96ebd88365ae7ee
refs/heads/master: 40be0c28b33ff0821594a3fa7126354dfe6eccd1
16 changes: 13 additions & 3 deletions trunk/drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#define DBG_RX 0x0200
#define DBG_TX 0x0400
static unsigned int debugflags;
static unsigned int nbds_max = 16;
#endif /* NDEBUG */

static struct nbd_device nbd_dev[MAX_NBD];
Expand Down Expand Up @@ -647,7 +648,13 @@ static int __init nbd_init(void)
return -EIO;
}

for (i = 0; i < MAX_NBD; i++) {
if (nbds_max > MAX_NBD) {
printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,
nbds_max);
return -EINVAL;
}

for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = alloc_disk(1);
if (!disk)
goto out;
Expand All @@ -673,7 +680,7 @@ static int __init nbd_init(void)
dprintk(DBG_INIT, "nbd: debugflags=0x%x\n", debugflags);

devfs_mk_dir("nbd");
for (i = 0; i < MAX_NBD; i++) {
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = nbd_dev[i].disk;
nbd_dev[i].file = NULL;
nbd_dev[i].magic = LO_MAGIC;
Expand Down Expand Up @@ -706,8 +713,9 @@ static int __init nbd_init(void)
static void __exit nbd_cleanup(void)
{
int i;
for (i = 0; i < MAX_NBD; i++) {
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = nbd_dev[i].disk;
nbd_dev[i].magic = 0;
if (disk) {
del_gendisk(disk);
blk_cleanup_queue(disk->queue);
Expand All @@ -725,6 +733,8 @@ module_exit(nbd_cleanup);
MODULE_DESCRIPTION("Network Block Device");
MODULE_LICENSE("GPL");

module_param(nbds_max, int, 0444);
MODULE_PARM_DESC(nbds_max, "How many network block devices to initialize.");
#ifndef NDEBUG
module_param(debugflags, int, 0644);
MODULE_PARM_DESC(debugflags, "flags for controlling debug output");
Expand Down

0 comments on commit 3ddb52a

Please sign in to comment.