16MALLOC_DEFINE(M_MOUNTPOINT,
"mountpoint",
"mount point structure");
35 if (!strcmp(entry->name, type)) {
62 char *path =
kmalloc(1024, &M_BUFFER, 0);
65 err = path ? -ENAMETOOLONG : -ENOMEM;
80 const char *
dev = (args && args->dev) ? strdup(args->dev) :
"none";
81 const char *t = strdup(type), *p = strdup(path);
84 mp->
type = t ? t :
"?";
85 mp->
path = p ? p :
"?";
102 if (strncmp(name,
"/dev/hd", 7) || name[7] <
'a' || name[7] >
'd' ||
103 name[8] <
'1' || name[8] >
'4' || name[9])
106 *
dev =
DEV(3, (name[7] -
'a') * 64 + name[8] -
'0');
133 if (!strcmp(entry->name, type)) {
143 if (!
dev)
return -ENOMEM;
157 printk(
"kernel: root is %s (%s)\n", name, type);
int vfs_close(struct vnode *vnode)
Drops a reference to a vnode.
#define DEV(major, minor)
#define MALLOC_DEFINE(type, _name, _desc)
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
void kfree(void *)
Frees an object that kmalloc() gave.
int vfs_lookup(const char *path, struct uio *uio, struct vnode **ref)
Finds the vnode a path names.
int vfs_vnode_path(struct vnode *vnode, struct vnode *root, char *buf, size_t size)
Computes a vnode's path, for getcwd() and /proc/mounts: it goes up through .., and finds each directo...
int vfs_mount_root_dev(const char *name, const char *type)
Mounts the root filesystem from a disk partition (the root=/dev/hda2 kernel argument).
static int root_dev(const char *name, dev_t *dev)
Gets the device number of an ATA disk partition, by its name (/dev/hda1 to /dev/hdd4).
int vfs_mount(const char *type, const char *dir, int flags, void *data, struct uio *uio)
Mounts a filesystem of a type on a directory, for mount().
int printk(const char *fmt,...)
Writes a kernel message, to the message buffer and the consoles.
A device driver: its operations, any of which may be NULL.
The list of registered filesystem types.
struct fs_list * next
the next entry of the list
int(*) mount(struct vnode *dir, int flags, void *data)
int(*) load(struct vnode *dev, struct vnode **super)
A mount's description, as /proc/mounts shows it.
Who does a filesystem operation: where its paths start, and its credentials and umask.
A file in memory (a vnode): what its inode says, and the kernel's own state.
struct vnode * mounted
for a directory that a filesystem is mounted on, that filesystem's root; for a mounted filesystem's r...
int vfs_mount_root(struct vnode *vnode)
Makes a vnode the root of the filesystem tree.
struct fs_list * registered_fs
The installed filesystems.