It's more readable than rather than 'make_'.
Signed-off-by: Karel Zak <kzak@redhat.com>
return true;
}
-struct file *make_bdev(const struct file_class *class,
+struct file *new_bdev(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd)
{
- return make_file(class? class: &bdev_class,
+ return new_file(class? class: &bdev_class,
sb, name, map_file_data, fd);
}
-static struct partition *make_partition(dev_t dev, const char *name)
+static struct partition *new_partition(dev_t dev, const char *name)
{
struct partition *partition = xcalloc(1, sizeof(*partition));
if (sscanf(line, "%u %u %*u %s", &major, &minor, name) != 3)
continue;
- partition = make_partition(makedev(major, minor), name);
+ partition = new_partition(makedev(major, minor), name);
list_add_tail(&partition->partitions, partitions_list);
}
}
return true;
}
-struct file *make_cdev(const struct file_class *class,
+struct file *new_cdev(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd)
{
- return make_file(class? class: &cdev_class,
+ return new_file(class? class: &cdev_class,
sb, name, map_file_data, fd);
}
-static struct chrdrv *make_chrdrv(unsigned long major, const char *name)
+static struct chrdrv *new_chrdrv(unsigned long major, const char *name)
{
struct chrdrv *chrdrv = xcalloc(1, sizeof(*chrdrv));
if (sscanf(line, "%lu %s", &major, name) != 2)
continue;
- chrdrv = make_chrdrv(major, name);
+ chrdrv = new_chrdrv(major, name);
list_add_tail(&chrdrv->chrdrvs, chrdrvs_list);
}
}
-static struct miscdev *make_miscdev(unsigned long minor, const char *name)
+static struct miscdev *new_miscdev(unsigned long minor, const char *name)
{
struct miscdev *miscdev = xcalloc(1, sizeof(*miscdev));
if (sscanf(line, "%lu %s", &minor, name) != 2)
continue;
- miscdev = make_miscdev(minor, name);
+ miscdev = new_miscdev(minor, name);
list_add_tail(&miscdev->miscdevs, miscdevs_list);
}
}
return true;
}
-struct file *make_fifo(const struct file_class *class,
+struct file *new_fifo(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd)
{
- return make_file(class? class: &fifo_class,
+ return new_file(class? class: &fifo_class,
sb, name, map_file_data, fd);
}
free(file->name);
}
-struct file *make_file(const struct file_class *class,
+struct file *new_file(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int association)
return true;
}
-struct file *make_sock(const struct file_class *class,
+struct file *new_sock(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd,
struct proc *proc)
{
- struct file *file = make_file(class? class: &sock_class,
+ struct file *file = new_file(class? class: &sock_class,
sb, name, map_file_data, fd);
if (fd >= 0 || fd == -ASSOC_MEM || fd == -ASSOC_SHM) {
struct sock *sock = (struct sock *)file;
return true;
}
-struct file *make_unkn(const struct file_class *class,
+struct file *new_unkn(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd)
{
- return make_file(class? class: &unkn_class,
+ return new_file(class? class: &unkn_class,
sb, name, map_file_data, fd);
}
return &infos[ get_column_id(num) ];
}
-static struct proc *make_proc(pid_t pid, struct proc * leader)
+static struct proc *new_prococess(pid_t pid, struct proc * leader)
{
struct proc *proc = xcalloc(1, sizeof(*proc));
free(file);
}
-static struct nodev* make_nodev(unsigned long minor, const char *filesystem)
+static struct nodev* new_nodev(unsigned long minor, const char *filesystem)
{
struct nodev *nodev = xcalloc(1, sizeof(*nodev));
continue;
}
- proc = make_proc((pid_t)num, leader);
+ proc = new_prococess((pid_t)num, leader);
enqueue_proc(procs, proc);
}
}
if (!(num = strtol(dp->d_name, NULL, 10)))
continue;
- proc = make_proc((pid_t)num, NULL);
+ proc = new_prococess((pid_t)num, NULL);
enqueue_proc(procs, proc);
if (ctl->threads) {
{
switch (sb->st_mode & S_IFMT) {
case S_IFCHR:
- return make_cdev(NULL, sb, name, map_file_data, assoc);
+ return new_cdev(NULL, sb, name, map_file_data, assoc);
case S_IFBLK:
- return make_bdev(NULL, sb, name, map_file_data, assoc);
+ return new_bdev(NULL, sb, name, map_file_data, assoc);
case S_IFSOCK:
- return make_sock(NULL, sb, name, map_file_data, assoc, proc);
+ return new_sock(NULL, sb, name, map_file_data, assoc, proc);
case S_IFIFO:
- return make_fifo(NULL, sb, name, map_file_data, assoc);
+ return new_fifo(NULL, sb, name, map_file_data, assoc);
case S_IFLNK:
case S_IFREG:
case S_IFDIR:
- return make_file(NULL, sb, name, map_file_data, assoc);
+ return new_file(NULL, sb, name, map_file_data, assoc);
default:
- return make_unkn(NULL, sb, name, map_file_data, assoc);
+ return new_unkn(NULL, sb, name, map_file_data, assoc);
}
}
closedir(dirp);
}
-static struct map* make_map(unsigned long mem_addr_start, unsigned long long file_offset,
+static struct map* new_map(unsigned long mem_addr_start, unsigned long long file_offset,
int r, int w, int x, int s)
{
struct map *map = xcalloc(1, sizeof(*map));
&start, &end, &r, &w, &x, &s, &file_offset,
&major, &minor, &inode) != 10)
continue;
- map = make_map(start, file_offset, r == 'r', w == 'w', x == 'x', s == 's');
+ map = new_map(start, file_offset, r == 'r', w == 'w', x == 'x', s == 's');
list_add_tail(&map->maps, maps_list);
}
}
static void add_nodev(unsigned long minor, const char *filesystem)
{
+ struct nodev *nodev;
+ int slot;
+
if (get_nodev_filesystem(minor))
return;
- struct nodev *nodev = make_nodev(minor, filesystem);
- int slot = minor % NODEV_TABLE_SIZE;
+ nodev = new_nodev(minor, filesystem);
+ slot = minor % NODEV_TABLE_SIZE;
+
list_add_tail(&nodev->nodevs, &nodev_table.tables[slot]);
}
{
struct list_head *n;
int slot = minor % NODEV_TABLE_SIZE;
+
list_for_each (n, &nodev_table.tables[slot]) {
struct nodev *nodev = list_entry(n, struct nodev, nodevs);
if (nodev->minor == minor)
extern const struct file_class file_class, cdev_class, bdev_class, sock_class, unkn_class, fifo_class;
-struct file *make_file(const struct file_class *class,
+struct file *new_file(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int association);
-struct file *make_cdev(const struct file_class *class,
+struct file *new_cdev(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd);
-struct file *make_bdev(const struct file_class *class,
+struct file *new_bdev(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd);
-struct file *make_sock(const struct file_class *class,
+struct file *new_sock(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd,
struct proc *proc);
-struct file *make_unkn(const struct file_class *class,
+struct file *new_unkn(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd);
-struct file *make_fifo(const struct file_class *class,
+struct file *new_fifo(const struct file_class *class,
struct stat *sb, const char *name,
struct map_file_data *map_file_data,
int fd);