Skip to content

Commit 693a1e4

Browse files
committed
runtime: Only resume uses name_to_dev() function
Signed-off-by: Alexey Gladkov <[email protected]>
1 parent ecfcde3 commit 693a1e4

File tree

7 files changed

+30
-249
lines changed

7 files changed

+30
-249
lines changed

runtime/src/devname.c

Lines changed: 0 additions & 116 deletions
This file was deleted.

runtime/src/do_mounts.h

Lines changed: 0 additions & 53 deletions
This file was deleted.

runtime/src/kinit.h

Lines changed: 0 additions & 66 deletions
This file was deleted.

runtime/src/resume/Makefile.mk

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ resume_SRCS = \
66
$(runtime_srcdir)/resume/resume.c \
77
$(runtime_srcdir)/resume/resumelib.c \
88
$(runtime_srcdir)/resume/getarg.c \
9-
$(runtime_srcdir)/devname.c \
10-
$(runtime_srcdir)/name_to_dev.c \
11-
$(runtime_srcdir)/do_mounts.h \
12-
$(runtime_srcdir)/kinit.h \
9+
$(runtime_srcdir)/resume/name_to_dev.c \
10+
$(runtime_srcdir)/resume/name_to_dev.h \
1311
$(NULL)
1412

1513
resume_CFLAGS = -I$(runtime_srcdir)

runtime/src/name_to_dev.c renamed to runtime/src/resume/name_to_dev.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
#include <alloca.h>
99
#include <inttypes.h>
1010

11-
#include "do_mounts.h"
12-
#include "kinit.h"
11+
#include "name_to_dev.h"
1312

1413
#define BUF_SZ 65536
1514

@@ -63,8 +62,6 @@ static dev_t try_name(char *name, unsigned long int part)
6362

6463
/* if partition is within range - we got it */
6564
if (part < range) {
66-
dprintf("kinit: try_name %s,%d = %s\n", name, part,
67-
bdevname(res + part));
6865
return res + part;
6966
}
7067

@@ -182,8 +179,6 @@ static inline dev_t name_to_dev_t_real(const char *name)
182179
dev_t name_to_dev_t(const char *name)
183180
{
184181
dev_t dev = name_to_dev_t_real(name);
185-
186-
dprintf("kinit: name_to_dev_t(%s) = %s\n", name, bdevname(dev));
187182
return dev;
188183
}
189184

runtime/src/resume/name_to_dev.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef __NAME_TO_DEV_H__
2+
#define __NAME_TO_DEV_H__
3+
4+
#include <sys/sysmacros.h>
5+
6+
#define __makedev(__ma, __mi) \
7+
((((__ma) & 0xfff) << 8)|((__mi) & 0xff)|(((__mi) & 0xfff00) << 12))
8+
9+
#define Root_RAM0 __makedev(1, 0)
10+
11+
/* These device numbers are only used internally */
12+
#define Root_NFS __makedev(0, 255)
13+
#define Root_MTD __makedev(0, 254)
14+
#define Root_MULTI __makedev(0, 253)
15+
16+
dev_t name_to_dev_t(const char *name);
17+
18+
#endif /* __NAME_TO_DEV_H__ */

runtime/src/resume/resumelib.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
#include <sys/stat.h>
1212
#include <sys/sysmacros.h>
1313

14-
#include "kinit.h"
15-
#include "do_mounts.h"
14+
#include "name_to_dev.h"
1615
#include "resume.h"
1716

17+
#ifdef DEBUG
18+
# define dbg_printf printf
19+
#else
20+
# define dbg_printf(...) ((void)0)
21+
#endif
22+
1823
#ifndef CONFIG_PM_STD_PARTITION
1924
# define CONFIG_PM_STD_PARTITION ""
2025
#endif
@@ -68,7 +73,7 @@ int resume(const char *resume_file, unsigned long long resume_offset)
6873
if (len >= (ssize_t) sizeof(device_string))
6974
goto fail_r;
7075

71-
dprintf("kinit: trying to resume from %s\n", resume_file);
76+
dbg_printf("kinit: trying to resume from %s\n", resume_file);
7277

7378
if (write(powerfd, device_string, (size_t) len) != len)
7479
goto fail_r;
@@ -77,7 +82,7 @@ int resume(const char *resume_file, unsigned long long resume_offset)
7782
failure:
7883
if (powerfd >= 0)
7984
close(powerfd);
80-
dprintf("kinit: No resume image, doing normal boot...\n");
85+
dbg_printf("kinit: No resume image, doing normal boot...\n");
8186
return -1;
8287

8388
fail_r:

0 commit comments

Comments
 (0)