Commit 500b81a8 authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[PATCH] make the bdevname() API sane

bdevname returns a pointer to a static string.  Change it so that the caller
passes in the buffer.
parent b548867b
......@@ -55,9 +55,8 @@ static inline int dev_to_index(dev_t dev)
/*
* __bdevname may be called from interrupts, and must be atomic
*/
const char *__bdevname(dev_t dev)
const char *__bdevname(dev_t dev, char *buffer)
{
static char buffer[40];
char *name = "unknown-block";
unsigned int major = MAJOR(dev);
unsigned int minor = MINOR(dev);
......@@ -71,7 +70,7 @@ const char *__bdevname(dev_t dev)
break;
if (n)
name = &(n->name[0]);
sprintf(buffer, "%s(%u,%u)", name, major, minor);
snprintf(buffer, BDEVNAME_SIZE, "%s(%u,%u)", name, major, minor);
spin_unlock_irqrestore(&major_names_lock, flags);
return buffer;
......
......@@ -1892,13 +1892,14 @@ void generic_make_request(struct bio *bio)
if (maxsector < nr_sectors ||
maxsector - nr_sectors < sector) {
char b[BDEVNAME_SIZE];
/* This may well happen - the kernel calls
* bread() without checking the size of the
* device, e.g., when mounting a device. */
printk(KERN_INFO
"attempt to access beyond end of device\n");
printk(KERN_INFO "%s: rw=%ld, want=%Lu, limit=%Lu\n",
bdevname(bio->bi_bdev),
bdevname(bio->bi_bdev, b),
bio->bi_rw,
(unsigned long long) sector + nr_sectors,
(long long) maxsector);
......@@ -1917,12 +1918,15 @@ void generic_make_request(struct bio *bio)
* Stacking drivers are expected to know what they are doing.
*/
do {
char b[BDEVNAME_SIZE];
q = bdev_get_queue(bio->bi_bdev);
if (!q) {
printk(KERN_ERR
"generic_make_request: Trying to access nonexistent block-device %s (%Lu)\n",
bdevname(bio->bi_bdev),
(long long) bio->bi_sector);
"generic_make_request: Trying to access "
"nonexistent block-device %s (%Lu)\n",
bdevname(bio->bi_bdev, b),
(long long) bio->bi_sector);
end_io:
bio_endio(bio, bio->bi_size, -EIO);
break;
......@@ -1930,9 +1934,9 @@ void generic_make_request(struct bio *bio)
if (unlikely(bio_sectors(bio) > q->max_sectors)) {
printk("bio too big device %s (%u > %u)\n",
bdevname(bio->bi_bdev),
bio_sectors(bio),
q->max_sectors);
bdevname(bio->bi_bdev, b),
bio_sectors(bio),
q->max_sectors);
goto end_io;
}
......
......@@ -79,6 +79,7 @@ static int linear_status(struct dm_target *ti, status_type_t type,
char *result, int maxlen)
{
struct linear_c *lc = (struct linear_c *) ti->private;
char b[BDEVNAME_SIZE];
switch (type) {
case STATUSTYPE_INFO:
......@@ -87,7 +88,7 @@ static int linear_status(struct dm_target *ti, status_type_t type,
case STATUSTYPE_TABLE:
snprintf(result, maxlen, "%s " SECTOR_FORMAT,
bdevname(lc->dev->bdev), lc->start);
bdevname(lc->dev->bdev, b), lc->start);
break;
}
return 0;
......
......@@ -209,6 +209,7 @@ static int stripe_status(struct dm_target *ti,
struct stripe_c *sc = (struct stripe_c *) ti->private;
int offset;
int i;
char b[BDEVNAME_SIZE];
switch (type) {
case STATUSTYPE_INFO:
......@@ -222,7 +223,7 @@ static int stripe_status(struct dm_target *ti,
offset +=
snprintf(result + offset, maxlen - offset,
" %s " SECTOR_FORMAT,
bdevname(sc->stripe[i].dev->bdev),
bdevname(sc->stripe[i].dev->bdev, b),
sc->stripe[i].physical_start);
}
break;
......
......@@ -197,8 +197,13 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
if (unlikely(block >= (tmp_dev->size + tmp_dev->offset)
|| block < tmp_dev->offset)) {
printk ("linear_make_request: Block %llu out of bounds on dev %s size %ld offset %ld\n",
(unsigned long long)block, bdevname(tmp_dev->rdev->bdev), tmp_dev->size, tmp_dev->offset);
char b[BDEVNAME_SIZE];
printk ("linear_make_request: Block %llu out of bounds on "
"dev %s size %ld offset %ld\n",
(unsigned long long)block,
bdevname(tmp_dev->rdev->bdev, b),
tmp_dev->size, tmp_dev->offset);
bio_io_error(bio, bio->bi_size);
return 0;
}
......
......@@ -166,6 +166,7 @@ static int blkmtd_readpage(mtd_raw_dev_data_t *rawdevice, struct page *page)
int sectornr, sectors, i;
struct kiobuf *iobuf;
sector_t *blocks;
char b[BDEVNAME_SIZE];
if(!rawdevice) {
printk("blkmtd: readpage: PANIC file->private_data == NULL\n");
......@@ -173,7 +174,7 @@ static int blkmtd_readpage(mtd_raw_dev_data_t *rawdevice, struct page *page)
}
DEBUG(2, "blkmtd: readpage called, dev = `%s' page = %p index = %ld\n",
bdevname(rawdevice->binding), page, page->index);
bdevname(rawdevice->binding, b), page, page->index);
if(PageUptodate(page)) {
DEBUG(2, "blkmtd: readpage page %ld is already upto date\n", page->index);
......@@ -523,6 +524,7 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
size_t from;
u_long len;
int err = 0;
char b[BDEVNAME_SIZE];
/* check readonly */
if(rawdevice->readonly) {
......@@ -537,7 +539,7 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
/* check erase region has valid start and length */
DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%x len = 0x%lx\n",
bdevname(rawdevice->binding), from, len);
bdevname(rawdevice->binding, b), from, len);
while(numregions) {
DEBUG(3, "blkmtd: checking erase region = 0x%08X size = 0x%X num = 0x%x\n",
einfo->offset, einfo->erasesize, einfo->numblocks);
......@@ -635,11 +637,12 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
int err = 0;
int offset;
int pagenr, pages;
char b[BDEVNAME_SIZE];
*retlen = 0;
DEBUG(2, "blkmtd: read: dev = `%s' from = %ld len = %d buf = %p\n",
bdevname(rawdevice->binding), (long int)from, len, buf);
bdevname(rawdevice->binding, b), (long int)from, len, buf);
pagenr = from >> PAGE_SHIFT;
offset = from - (pagenr << PAGE_SHIFT);
......@@ -706,10 +709,11 @@ static int blkmtd_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t len1 = 0, len2 = 0, len3 = 0;
struct page **pages;
int pagecnt = 0;
char b[BDEVNAME_SIZE];
21 e3
*retlen = 0;
DEBUG(2, "blkmtd: write: dev = `%s' to = %ld len = %d buf = %p\n",
bdevname(rawdevice->binding), (long int)to, len, buf);
bdevname(rawdevice->binding, b), (long int)to, len, buf);
/* handle readonly and out of range numbers */
......@@ -1060,6 +1064,7 @@ static int __init init_blkmtd(void)
int err;
int mode;
int regions;
char b[BDEVNAME_SIZE];
/* Check args */
if(device == 0) {
......@@ -1128,7 +1133,7 @@ static int __init init_blkmtd(void)
if (err)
return 1;
DEBUG(1, "blkmtd: devname = %s\n", bdevname(bdev));
DEBUG(1, "blkmtd: devname = %s\n", bdevname(bdev, b));
blocksize = BLOCK_SIZE;
blocksize = bs ? bs : block_size(bdev);
......
......@@ -1710,7 +1710,11 @@ static int wd7000_host_reset(Scsi_Cmnd * SCpnt)
static int wd7000_biosparam(struct scsi_device *sdev,
struct block_device *bdev, sector_t capacity, int *ip)
{
dprintk("wd7000_biosparam: dev=%s, size=%d, ", bdevname(bdev), capacity);
char b[BDEVNAME_SIZE];
dprintk("wd7000_biosparam: dev=%s, size=%d, ",
bdevname(bdev, b), capacity);
(void)b; /* unused var warning? */
/*
* try default translation
......
......@@ -155,8 +155,10 @@ __clear_page_buffers(struct page *page)
static void buffer_io_error(struct buffer_head *bh)
{
char b[BDEVNAME_SIZE];
printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n",
bdevname(bh->b_bdev),
bdevname(bh->b_bdev, b),
(unsigned long long)bh->b_blocknr);
}
......
......@@ -82,8 +82,9 @@ EXPORT_SYMBOL(ext2_xattr_set);
printk("\n"); \
} while (0)
# define ea_bdebug(bh, f...) do { \
char b[BDEVNAME_SIZE]; \
printk(KERN_DEBUG "block %s:%ld: ", \
bdevname(bh->b_bdev), bh->b_blocknr); \
bdevname(bh->b_bdev, b), bh->b_blocknr); \
printk(f); \
printk("\n"); \
} while (0)
......
......@@ -60,9 +60,11 @@ int journal_no_write[2];
static void make_rdonly(struct block_device *bdev, int *no_write)
{
char b[BDEVNAME_SIZE];
if (bdev) {
printk(KERN_WARNING "Turning device %s read-only\n",
bdevname(bdev));
bdevname(bdev, b));
*no_write = 0xdead0000 + bdev->bd_dev;
}
}
......@@ -317,6 +319,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
{
struct block_device *bdev;
int err = -ENODEV;
char b[BDEVNAME_SIZE];
bdev = bdget(dev);
if (bdev == NULL)
......@@ -328,7 +331,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
fail:
printk(KERN_ERR "EXT3: failed to open journal device %s: %d\n",
__bdevname(dev), err);
__bdevname(dev, b), err);
return NULL;
}
......@@ -812,8 +815,10 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es,
printk(KERN_INFO "EXT3 FS " EXT3FS_VERSION ", " EXT3FS_DATE " on %s, ",
sb->s_id);
if (EXT3_SB(sb)->s_journal->j_inode == NULL) {
char b[BDEVNAME_SIZE];
printk("external journal on %s\n",
bdevname(EXT3_SB(sb)->s_journal->j_dev));
bdevname(EXT3_SB(sb)->s_journal->j_dev, b));
} else {
printk("internal journal\n");
}
......
......@@ -78,8 +78,9 @@
printk("\n"); \
} while (0)
# define ea_bdebug(bh, f...) do { \
char b[BDEVNAME_SIZE]; \
printk(KERN_DEBUG "block %s:%ld: ", \
bdevname(bh->b_bdev), bh->b_blocknr); \
bdevname(bh->b_bdev, b), bh->b_blocknr); \
printk(f); \
printk("\n"); \
} while (0)
......
......@@ -183,10 +183,11 @@ inline void presto_debug_fail_blkdev(struct presto_file_set *fset,
int minor = presto_f2m(fset);
int errorval = izo_channels[minor].uc_errorval;
struct block_device *bdev = fset->fset_dentry->d_inode->i_sb->s_bdev;
char b[BDEVNAME_SIZE];
if (errorval && errorval == (long)value && !bdev_read_only(bdev)) {
CDEBUG(D_SUPER, "setting device %s read only\n",
bdevname(bdev));
bdevname(bdev, b));
BLKDEV_FAIL(bdev, 1);
izo_channels[minor].uc_errorval = -bdev->bd_dev;
}
......
......@@ -637,11 +637,13 @@ int journal_bmap(journal_t *journal, unsigned long blocknr,
if (ret)
*retp = ret;
else {
char b[BDEVNAME_SIZE];
printk(KERN_ALERT "%s: journal block not found "
"at offset %lu on %s\n",
__FUNCTION__,
blocknr,
bdevname(journal->j_dev));
bdevname(journal->j_dev, b));
err = -EIO;
__journal_abort_soft(journal, err);
}
......@@ -1398,7 +1400,7 @@ int journal_wipe (journal_t *journal, int write)
* device this journal is present.
*/
const char * journal_dev_name(journal_t *journal)
const char *journal_dev_name(journal_t *journal, char *buffer)
{
struct block_device *bdev;
......@@ -1407,7 +1409,7 @@ const char * journal_dev_name(journal_t *journal)
else
bdev = journal->j_dev;
return bdevname(bdev);
return bdevname(bdev, buffer);
}
/*
......@@ -1424,12 +1426,13 @@ const char * journal_dev_name(journal_t *journal)
void __journal_abort_hard (journal_t *journal)
{
transaction_t *transaction;
char b[BDEVNAME_SIZE];
if (journal->j_flags & JFS_ABORT)
return;
printk (KERN_ERR "Aborting journal on device %s.\n",
journal_dev_name(journal));
journal_dev_name(journal, b));
journal->j_flags |= JFS_ABORT;
transaction = journal->j_running_transaction;
......
......@@ -32,6 +32,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
struct PartitionBlock *pb;
int start_sect, nr_sects, blk, part, res = 0;
int slot = 1;
char b[BDEVNAME_SIZE];
for (blk = 0; ; blk++, put_dev_sector(sect)) {
if (blk == RDB_ALLOCATION_LIMIT)
......@@ -40,7 +41,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read RDB block %d\n",
bdevname(bdev), blk);
bdevname(bdev, b), blk);
goto rdb_done;
}
if (*(u32 *)data != cpu_to_be32(IDNAME_RIGIDDISK))
......@@ -61,7 +62,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
}
printk("Dev %s: RDB in block %d has bad checksum\n",
bdevname(bdev),blk);
bdevname(bdev, b), blk);
}
printk(" RDSK");
......@@ -72,7 +73,7 @@ amiga_partition(struct parsed_partitions *state, struct block_device *bdev)
if (!data) {
if (warn_no_part)
printk("Dev %s: unable to read partition block %d\n",
bdevname(bdev),blk);
bdevname(bdev, b), blk);
goto rdb_done;
}
pb = (struct PartitionBlock *)data;
......
......@@ -35,6 +35,7 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
Sector sect;
struct sgi_disklabel *label;
struct sgi_partition *p;
char b[BDEVNAME_SIZE];
label = (struct sgi_disklabel *) read_dev_sector(bdev, 0, &sect);
if (!label)
......@@ -43,7 +44,7 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
magic = label->magic_mushroom;
if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) {
/*printk("Dev %s SGI disklabel: bad magic %08x\n",
bdevname(bdev), magic);*/
bdevname(bdev, b), magic);*/
put_dev_sector(sect);
return 0;
}
......@@ -54,7 +55,7 @@ int sgi_partition(struct parsed_partitions *state, struct block_device *bdev)
}
if(csum) {
printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n",
bdevname(bdev));
bdevname(bdev, b));
put_dev_sector(sect);
return 0;
}
......
......@@ -45,6 +45,7 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
} * label;
struct sun_partition *p;
unsigned long spc;
char b[BDEVNAME_SIZE];
label = (struct sun_disklabel *)read_dev_sector(bdev, 0, &sect);
if (!label)
......@@ -53,7 +54,7 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
p = label->partitions;
if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) {
/* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n",
bdevname(bdev), be16_to_cpu(label->magic)); */
bdevname(bdev, b), be16_to_cpu(label->magic)); */
put_dev_sector(sect);
return 0;
}
......@@ -63,7 +64,7 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
csum ^= *ush--;
if (csum) {
printk("Dev %s Sun disklabel: Csum bad, label corrupted\n",
bdevname(bdev));
bdevname(bdev, b));
put_dev_sector(sect);
return 0;
}
......
......@@ -867,9 +867,11 @@ static int flush_older_journal_lists(struct super_block *p_s_sb, struct reiserfs
}
static void reiserfs_end_buffer_io_sync(struct buffer_head *bh, int uptodate) {
char b[BDEVNAME_SIZE];
if (buffer_journaled(bh)) {
reiserfs_warning("clm-2084: pinned buffer %lu:%s sent to disk\n",
bh->b_blocknr, bdevname(bh->b_bdev)) ;
bh->b_blocknr, bdevname(bh->b_bdev, b)) ;
}
if (uptodate)
set_buffer_uptodate(bh) ;
......@@ -1652,10 +1654,12 @@ static int journal_read(struct super_block *p_s_sb) {
int replay_count = 0 ;
int continue_replay = 1 ;
int ret ;
char b[BDEVNAME_SIZE];
cur_dblock = SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb) ;
printk("reiserfs: checking transaction log (%s) for (%s)\n",
bdevname(SB_JOURNAL(p_s_sb)->j_dev_bd), reiserfs_bdevname(p_s_sb));
bdevname(SB_JOURNAL(p_s_sb)->j_dev_bd, b),
reiserfs_bdevname(p_s_sb));
start = get_seconds() ;
/* step 1, read in the journal header block. Check the transaction it says
......@@ -1893,6 +1897,7 @@ static int journal_init_dev( struct super_block *super,
int result;
dev_t jdev;
int blkdev_mode = FMODE_READ | FMODE_WRITE;
char b[BDEVNAME_SIZE];
result = 0;
......@@ -1915,7 +1920,7 @@ static int journal_init_dev( struct super_block *super,
result = -ENOMEM;
if( result != 0 )
printk( "sh-458: journal_init_dev: cannot init journal device\n '%s': %i",
bdevname(journal->j_dev_bd), result );
bdevname(journal->j_dev_bd, b), result );
else if (jdev != super->s_dev) {
set_blocksize(journal->j_dev_bd, super->s_blocksize);
......@@ -1948,7 +1953,8 @@ static int journal_init_dev( struct super_block *super,
if( result != 0 ) {
release_journal_dev( super, journal );
}
printk( "journal_init_dev: journal device: %s\n", bdevname(journal->j_dev_bd));
printk( "journal_init_dev: journal device: %s\n",
bdevname(journal->j_dev_bd, b));
return result;
}
......@@ -1961,6 +1967,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
struct reiserfs_super_block * rs;
struct reiserfs_journal_header *jh;
struct reiserfs_journal *journal;
char b[BDEVNAME_SIZE];
if (sizeof(struct reiserfs_journal_commit) != 4096 ||
sizeof(struct reiserfs_journal_desc) != 4096) {
......@@ -2007,7 +2014,8 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
if (is_reiserfs_jr(rs) && (jh->jh_journal.jp_journal_magic != sb_jp_journal_magic(rs))) {
printk("sh-460: journal header magic %x (device %s) does not match "
"to magic found in super block %x (device %s)\n",
jh->jh_journal.jp_journal_magic, bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd ),
jh->jh_journal.jp_journal_magic,
bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
sb_jp_journal_magic(rs), reiserfs_bdevname (p_s_sb));
brelse (bhjh);
goto free_and_return;
......@@ -2058,7 +2066,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
printk ("Reiserfs journal params: device %s, size %u, "
"journal first block %u, max trans len %u, max batch %u, "
"max commit age %u, max trans age %u\n",
bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd ),
bdevname( SB_JOURNAL(p_s_sb)->j_dev_bd, b),
SB_ONDISK_JOURNAL_SIZE(p_s_sb),
SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb),
SB_JOURNAL_TRANS_MAX(p_s_sb),
......
......@@ -139,8 +139,11 @@ static void sprintf_block_head (char * buf, struct buffer_head * bh)
static void sprintf_buffer_head (char * buf, struct buffer_head * bh)
{
char b[BDEVNAME_SIZE];
sprintf (buf, "dev %s, size %d, blocknr %llu, count %d, state 0x%lx, page %p, (%s, %s, %s)",
bdevname (bh->b_bdev), bh->b_size, (unsigned long long)bh->b_blocknr,
bdevname (bh->b_bdev, b), bh->b_size,
(unsigned long long)bh->b_blocknr,
atomic_read (&(bh->b_count)),
bh->b_state, bh->b_page,
buffer_uptodate (bh) ? "UPTODATE" : "!UPTODATE",
......@@ -497,7 +500,7 @@ static int print_super_block (struct buffer_head * bh)
struct reiserfs_super_block * rs = (struct reiserfs_super_block *)(bh->b_data);
int skipped, data_blocks;
char *version;
char b[BDEVNAME_SIZE];
if (is_reiserfs_3_5(rs)) {
version = "3.5";
......@@ -510,7 +513,7 @@ static int print_super_block (struct buffer_head * bh)
return 1;
}
printk ("%s\'s super block is in block %llu\n", bdevname (bh->b_bdev),
printk ("%s\'s super block is in block %llu\n", bdevname (bh->b_bdev, b),
(unsigned long long)bh->b_blocknr);
printk ("Reiserfs version %s\n", version );
printk ("Block count %u\n", sb_block_count(rs));
......
......@@ -460,6 +460,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
struct reiserfs_super_block *rs;
struct journal_params *jp;
int len = 0;
char b[BDEVNAME_SIZE];
sb = procinfo_prologue((int)data);
if( sb == NULL )
......@@ -516,7 +517,7 @@ int reiserfs_journal_in_proc( char *buffer, char **start, off_t offset,
"prepare_retry: \t%12lu\n",
DJP( jp_journal_1st_block ),
bdevname(SB_JOURNAL(sb)->j_dev_bd),
bdevname(SB_JOURNAL(sb)->j_dev_bd, b),
DJP( jp_journal_dev ),
DJP( jp_journal_size ),
DJP( jp_journal_trans_max ),
......
......@@ -526,8 +526,10 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
}
goto out;
} else {
char b[BDEVNAME_SIZE];
s->s_flags = flags;
strncpy(s->s_id, bdevname(bdev), sizeof(s->s_id));
strncpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
s->s_old_blocksize = block_size(bdev);
sb_set_blocksize(s, s->s_old_blocksize);
error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
......
......@@ -323,6 +323,7 @@ xfs_showargs(
};
struct proc_xfs_info *xfs_infop;
struct xfs_mount *mp = XFS_BHVTOM(vfsp->vfs_fbhv);
char b[BDEVNAME_SIZE];
for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) {
if (mp->m_flags & xfs_infop->flag)
......@@ -352,12 +353,12 @@ xfs_showargs(
if (mp->m_ddev_targp->pbr_dev != mp->m_logdev_targp->pbr_dev)
seq_printf(m, "," MNTOPT_LOGDEV "=%s",
bdevname(mp->m_logdev_targp->pbr_bdev));
bdevname(mp->m_logdev_targp->pbr_bdev, b));
if (mp->m_rtdev_targp &&
mp->m_ddev_targp->pbr_dev != mp->m_rtdev_targp->pbr_dev)
seq_printf(m, "," MNTOPT_RTDEV "=%s",
bdevname(mp->m_rtdev_targp->pbr_bdev));
bdevname(mp->m_rtdev_targp->pbr_bdev, b));
if (mp->m_dalign > 0)
seq_printf(m, "," MNTOPT_SUNIT "=%d",
......
......@@ -1069,10 +1069,11 @@ extern int unregister_chrdev(unsigned int, const char *);
extern int chrdev_open(struct inode *, struct file *);
/* fs/block_dev.c */
extern const char *__bdevname(dev_t);
extern inline const char *bdevname(struct block_device *bdev)
#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
extern const char *__bdevname(dev_t, char *buffer);
extern inline const char *bdevname(struct block_device *bdev, char *buffer)
{
return __bdevname(bdev->bd_dev);
return __bdevname(bdev->bd_dev, buffer);
}
extern struct block_device *lookup_bdev(const char *);
extern struct block_device *open_bdev_excl(const char *, int, int, void *);
......
......@@ -245,6 +245,7 @@ void __init mount_block_root(char *name, int flags)
{
char *fs_names = __getname();
char *p;
char b[BDEVNAME_SIZE];
get_fs_names(fs_names);
retry:
......@@ -263,12 +264,13 @@ void __init mount_block_root(char *name, int flags)
* Allow the user to distinguish between failed open
* and bad superblock on root device.
*/
__bdevname(ROOT_DEV, b);
printk("VFS: Cannot open root device \"%s\" or %s\n",
root_device_name, __bdevname(ROOT_DEV));
root_device_name, b);
printk("Please append a correct \"root=\" boot option\n");
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV));
panic("VFS: Unable to mount root fs on %s", b);
}
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV));
panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
out:
putname(fs_names);
}
......
......@@ -1152,13 +1152,15 @@ static int read_suspend_image(const char * specialfile, int noresume)
union diskpage *cur;
unsigned long scratch_page = 0;
int error;
char b[BDEVNAME_SIZE];
resume_device = name_to_dev_t(specialfile);
scratch_page = get_zeroed_page(GFP_ATOMIC);
cur = (void *) scratch_page;
if (cur) {
struct block_device *bdev;
printk("Resuming from device %s\n", __bdevname(resume_device));
printk("Resuming from device %s\n",
__bdevname(resume_device, b));
bdev = bdget(resume_device);
if (!bdev) {
printk("No such block device ?!\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment