[BusyBox] My mount rewrite.
Tito
farmatito at tiscali.it
Wed Feb 9 09:27:53 UTC 2005
On Wednesday 09 February 2005 05:43, you wrote:
> Thanks for the bug report, dunno how I missed that. (It worked at some point,
> before I broke it.) I'll try to whip up a new (somewhat cleaned up) patch
> tomorrow.
>
> Rob
>
>
Hi, Rob,
BTW, I stumbled across this bug while trying to implement the usage of bb_getopt_ulflags
in your new mount. At the moment I have only an untested example code that i will
clean up and fix later when you've fixed the current issues and if you are interested about it.
It seeems to save some space.
Example is:
-------------------------------------------------------------------------------------------------------------------------------------
#define M_OPTIONS 1
#define M_TYPE 2
#define M_READONLY 4
#define M_READWRITE 8
#define M_ALL 16
#define M_FAKE 32
#define M_NOMTAB 64
#define M_VERBOSE 128
extern int mount_main(int argc, char **argv)
{
char *string_flags=0,*fsType=0,*blockDevice=0,*directory=0,*loop_file=0,
*buf=0,*files[]={"/etc/filesystems","/proc/filesystems",0};
int i,flags=0,all=0,fakeIt=0,useMtab=use_mtab/* FIXME */,allowWrite=0,
rc=EXIT_FAILURE;
unsigned long opt;
char * m_options=NULL;
FILE *file=0,*f=0;
struct mntent *m=0;
/* parse --options, like --bind and --move */
for(i=0; i<argc; i++) {
if(argv[i][0]=='-' && argv[i][1]=='-') {
parse_mount_options(argv[i]+2,&flags,&string_flags);
/* remove long options from commandline as they raise an
unrecognized option error by bb_getopt_ulflags */
argv[i]=" ";
}
}
/* Parse remaining options */
opt = bb_getopt_ulflags(argc, argv, "o:t:rwafnv", &m_options, &fsType);
if( opt & M_OPTIONS) parse_mount_options(m_options, &flags, &string_flags);
if( opt & M_READONLY) flags |= MS_RDONLY;
/* The values are set to 0 or 1 so don't test for TRUE or FALSE later
as they could differ */
allowWrite=(opt & M_READWRITE);
all=(opt & M_ALL);
fakeIt=(opt & M_FAKE);
useMtab=!(opt & M_NOMTAB);
/* ignore -v */
---------------------------------------------------------------------------------------------------------------------------------------------------
Let me know what you think about it.
Ciao,
Tito.
More information about the busybox
mailing list