]> www.infradead.org Git - users/willy/linux.git/commitdiff
printf: Convert bdev_name() to printf_state
authorMatthew Wilcox <willy@infradead.org>
Wed, 12 Dec 2018 18:52:06 +0000 (13:52 -0500)
committerMatthew Wilcox <willy@infradead.org>
Wed, 12 Dec 2018 18:52:06 +0000 (13:52 -0500)
Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/vsprintf.c

index 7d61376ae6ee9856cbc96b9e51024c61de2c66dc..fa7c7ae9216b74845bfabd8984c37bd1e0d3a18e 100644 (file)
@@ -762,21 +762,20 @@ char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_sp
 
 #ifdef CONFIG_BLOCK
 static noinline_for_stack
-char *bdev_name(char *buf, char *end, struct block_device *bdev,
-               struct printf_spec spec, const char *fmt)
+char *bdev_name(struct printf_state *ps, struct block_device *bdev)
 {
        struct gendisk *hd = bdev->bd_disk;
        
-       buf = string(buf, end, hd->disk_name, spec);
+       printf_string(ps, hd->disk_name);
        if (bdev->bd_part->partno) {
                if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) {
-                       if (buf < end)
-                               *buf = 'p';
-                       buf++;
+                       if (ps->buf < ps->end)
+                               *ps->buf = 'p';
+                       ps->buf++;
                }
-               buf = number(buf, end, bdev->bd_part->partno, spec);
+               printf_number(ps, bdev->bd_part->partno);
        }
-       return buf;
+       return ps->buf;
 }
 #endif
 
@@ -1965,7 +1964,7 @@ char *pointer(struct printf_state *ps, void *ptr)
                                   spec, fmt);
 #ifdef CONFIG_BLOCK
        case 'g':
-               return bdev_name(buf, end, ptr, spec, fmt);
+               return bdev_name(ps, ptr);
 #endif
 
        case 'G':