[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [BusyBox] mount -a, using sysfs()
From:       Glenn McGrath <bug1 () optushome ! com ! au>
Date:       2000-12-31 5:28:25
[Download RAW message or body]

Erik Andersen wrote:
> 
> On Sun Dec 31, 2000 at 02:52:17PM +1100, Glenn McGrath wrote:
> > I just ran across the sysfs call, it can be used instead of
> > /proc/filesystems.
> >
> > /proc/partitions or the equivalent thing with the devps patch are used
> > by bb mount to get a list of all possible filesystem to mount if the fs
> > type isnt specified.
> >
> > Seems to me it would be better to use sysfs() than parsing
> > /proc/filesystems or doing the equivalent thing with the devps patch,
> > maybe im overlooking something though.
> >
> > If this is a good idea i will implement it.
> 
> Hmm.  Never noticed that syscall before (thats the trouble with syscalls -- the
> interfaces are usually hidden).  Could you write up a silly little test app
> first as a proof of concept?  Something that essentially duplicates what
> running 'cat /proc/filesystems' shows?
> 
>  -Erik
> 
> --
> Erik B. Andersen   email:  andersen@lineo.com
> --This message was written using 73% post-consumer electrons--

The file attached produces the following output on my system, the
difference between it and /proc/filesystems is that some entries in
/rpoc/filesystems have nodev proceeding them

shm
sockfs
pipefs
proc
ext2
ramfs
msdos
vfat
iso9660
autofs
nfs
devpts


Glenn
["proc_filesystems.c" (text/x-csrc)]

#include <linux/unistd.h>
#include <stdio.h>

int num_of_filesystems()
{
	_syscall1(int, sysfs, int, option);
	return sysfs(3);
}


int main()
{
	char *line;
	unsigned int i=0;
	const int max = num_of_filesystems();
	
	_syscall3(int, sysfs, int, option, unsigned int, fs_index, char *, buf);	
	line = (char *) malloc(80);
	
	for(i = 0; i < max; i++) {
		sysfs(2, i, line);
		printf("%s\n", line);
	}
	return 0;
}

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic