changes to dbootstrap
Hi,
I've hacked dbootstrap to at least compile.
Changes:
do_umount(dev,0) -> umount(dev) /* this should be correct */
fdflush() - I've copyed and trimmed it a bit /* should be also correct */
mkdir_fn() -> mkdir() /* this is NOT correct. I won't create leading
directories. Next on my TODO */
block_device() - this one is _really_ bad :((
and in nfsroot.c the
cp_fn() -> system() /* untested */
swapon_fn() -> swapon() /* IMHO correct */
swapoff_fn() -> swapoff() /* dtto. */
Petr Cech
--
Debian GNU/Linux maintainer - www.debian.{org,cz}
cech@atrey.karlin.mff.cuni.cz
Index: utilities/dbootstrap/Makefile
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- utilities/dbootstrap/Makefile 1999/10/16 09:56:06 1.12
+++ utilities/dbootstrap/Makefile 1999/10/24 23:12:32
@@ -1,7 +1,7 @@
LIBS = -lnewt -lslang -lc -lloadtrm #-lefence
LIBSG = -lc -lloadtrm #-lefence
-CFLAGS = -Os -D_GNU_SOURCE
+CFLAGS = -Os -D_GNU_SOURCE -Werror
-include ../../config
@@ -18,11 +18,8 @@
PROG = dbootstrap
PROGG = dbootstrapg
-BBOXOBJS = ../busybox/descend.o ../busybox/postprocess.o \
- ../busybox/fdflush.o ../busybox/losetup.o ../busybox/mount.o \
- ../busybox/mkdir.o ../busybox/utility.o ../busybox/findmount.o \
- ../busybox/umount.o ../busybox/swapon.o ../busybox/swapoff.o \
- ../busybox/block_device.o ../busybox/cp.o
+BBOXOBJS = ../busybox/mount.o
+
LIBFDISK = ../libfdisk/libfdisk.a
LIBBOGL = ../bogl/libbogl.a
Index: utilities/dbootstrap/bootconfig.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/bootconfig.c,v
retrieving revision 1.7
diff -u -r1.7 bootconfig.c
--- utilities/dbootstrap/bootconfig.c 1999/10/17 23:18:28 1.7
+++ utilities/dbootstrap/bootconfig.c 1999/10/24 23:12:06
@@ -12,6 +12,9 @@
#include "dbootstrap.h"
#include "lang.h"
+extern int mount_one(char *blockDevice, char *directory, char *filesystemType,
+ unsigned long flags, char *string_flags);
+
/* ED: floppy filesystem type is not the same for all architectures */
#if #cpu(sparc) || #cpu(powerpc)
static char *fs_type = "ext2";
@@ -19,10 +22,6 @@
static char *fs_type = "msdos";
#endif
-extern int fdflush(const char *filename);
-extern int mount_one(char *blockDevice, char *directory, char *filesystemType,
- unsigned long flags, char *string_flags, int noMtab, int fake);
-
#if #cpu(sparc)
# define USE_SILO
#elif #cpu(m68k)
@@ -94,8 +93,8 @@
}
#endif
- do_umount(device,0);
- do_umount("/floppy",0);
+ umount(device);
+ umount("/floppy");
#if #cpu (powerpc)
if(strcmp(Arch2,"PReP")==0) {
@@ -111,8 +110,18 @@
#ifdef SCSI_FLOPPY
if (strncmp(device,"/dev/sfd", 8)) /* not scsi floppy */
#endif
+#if 0 /*PETA*/
fdflush(device);
+#else
+ {
+ int fd=open(device, 0);
+ if(fd) {
+ ioctl(fd, FDFLUSH, 0);
+ close(fd);
+ }
+ }
+#endif
/*
* LFG: Given that getfdprm was changed from debian-1.3.1 to debian-2.0
* and that the changes are small, I have decided to include the code in
@@ -175,7 +184,7 @@
boxPopWindow();
if (status) return 1;
- if( mount_one(device,"/floppy",fs_type,0,"\0",0,0) )
+ if( mount_one(device,"/floppy",fs_type,0,"\0") )
return 1;
pleaseWaitBox(_("Copying the operating system kernel..."));
@@ -196,7 +205,7 @@
#if #cpu (m68k)
if(strcmp(Arch2,"Atari")==0) {
if((filep=fopen("/floppy/bootargs","w"))==NULL) {
- do_umount("/floppy",0);
+ umount("/floppy");
boxPopWindow();
return 1;
}
@@ -205,7 +214,7 @@
}
#elif #cpu (i386)
if((filep=fopen("/floppy/syslinux.cfg","w"))==NULL) {
- do_umount("/floppy",0);
+ umount("/floppy");
boxPopWindow();
return 1;
}
@@ -217,7 +226,7 @@
fclose(filep);
#elif #cpu (sparc)
if((filep=fopen("/floppy/etc/silo.conf","w"))==NULL) {
- do_umount("/floppy",0);
+ umount("/floppy");
boxPopWindow();
eject_floppy(device);
return 1;
@@ -245,7 +254,7 @@
status = 1;
boxPopWindow();
- do_umount("/floppy",0);
+ umount("/floppy");
/* eject the floppy disk if avail (see dbootstrap.h) */
eject_floppy(device);
Index: utilities/dbootstrap/choose_medium.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/choose_medium.c,v
retrieving revision 1.11
diff -u -r1.11 choose_medium.c
--- utilities/dbootstrap/choose_medium.c 1999/10/21 06:40:04 1.11
+++ utilities/dbootstrap/choose_medium.c 1999/10/24 23:26:03
@@ -46,7 +46,7 @@
#endif
for (;;) {
- do_umount("/floppy",0);
+ umount("/floppy");
if (!device) {
struct d_choices choices[3];
@@ -148,6 +148,7 @@
}
}
+#if 0
int match_find(const struct FileInfo * i) {
char *name,*source;
struct stat statbuf;
@@ -173,13 +174,38 @@
free(source);
return 0;
}
+#else
+int match_find(const char *fileName, struct stat* statbuf) {
+ char *name,*source;
+
+ source=strdup(fileName);
+ name=strrchr(source,'/');
+ if (name) {
+ name++;
+ } else {
+ name=source;
+ }
+ if (! strcmp(name,pattern) ) {
+ sprintf(prtbuf,"%s/%s",source,drivers_filename);
+ if ( ( disqtype == base ) ||
+ (NAME_ISREG( prtbuf,statbuf)) ) {
+ if ( (dirc) && (!(dirc%5)) )
+ dirv=(char**)realloc(dirv,(dirc+5)*sizeof(char *));
+ dirv[dirc]=strdup(source);
+ dirc++;
+ }
+ }
+ free(source);
+ return 0;
+}
+#endif
+
static int choose_archive_dir (char *text) {
char *mountpoint, *descr, *path=NULL, *def, *inputdir;
static char *preventry=NULL;
/* glob_t globbuf; */
struct stat statbuf;
- struct FileInfo finfo;
#define ARC_default 100
#define ARC_list 101
#define ARC_manually 102
@@ -280,11 +306,14 @@
pleaseWaitBox(prtbuf);
dirc=0;
dirv=(char **)malloc(5*sizeof(char *));
- memset((void *)&finfo, 0, sizeof(struct FileInfo));
+/* memset((void *)&finfo, 0, sizeof(struct FileInfo));
finfo.source=strdup(mountpoint);
stat(finfo.source,&finfo.stat);
- finfo.processDirectoriesAfterTheirContents=1;
- descend(&finfo,match_find);
+ finfo.processDirectoriesAfterTheirContents=1;*/
+/* descend(&finfo,match_find);*/
+#if 0 /*PETA*/
+ FIXME recursiveAction(mountpoint, TRUE, FALSE, FALSE, NULL /*fileAction*/, NULL /* dirAction */);
+#endif
boxPopWindow();
/*
@@ -397,14 +426,14 @@
}
problemBox(_("Please place the Debian CD-ROM in the CD-ROM drive."),_("Please insert the CD-ROM"));
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
if (system("mount -t iso9660 -o nojoliet -r /dev/cdrom " CM_MOUNTPOINT_DIR)) {
/* FIXME write_it_down "The CD-ROM was not mounted successfully." */
problemBox(_("The CD-ROM was not mounted successfully."),_("Mount failed"));
return 1;
}
if ((status=choose_archive_dir(_("Please choose the path inside the CD-ROM where the Debian archive resides.")))) {
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
}
return status;
}
@@ -414,7 +443,7 @@
int status;
char *type;
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
p=select_not_mounted(_("Please select the partition where your Debian Archive resides."),_("Select Partition"),
5,FSTYPE_EXT2,FSTYPE_MINIX,FSTYPE_MSDOS,FSTYPE_AFFS,FSTYPE_HFS);
if (!p) return 1;
@@ -432,7 +461,7 @@
return 1;
}
if ((status=choose_archive_dir(_("Please choose the path inside the harddisk filesystem where the Debian archive resides.")))) {
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
}
return status;
}
@@ -461,7 +490,7 @@
if (! nfsmountpath) return 1;
free(preventry);
preventry=nfsmountpath;
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
sprintf(prtbuf,"mount -t nfs %s " CM_MOUNTPOINT_DIR,nfsmountpath);
if (system(prtbuf)) {
/* FIXME: write_it_down */
@@ -472,7 +501,7 @@
}
}
if ((status =choose_archive_dir(_("Please choose the path inside the mounted NFS filesystem where the Debian archive resides.")))) {
- do_umount(CM_MOUNTPOINT_DIR,0);
+ umount(CM_MOUNTPOINT_DIR);
}
return status;
}
Index: utilities/dbootstrap/dbootstrap.h
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/dbootstrap.h,v
retrieving revision 1.9
diff -u -r1.9 dbootstrap.h
--- utilities/dbootstrap/dbootstrap.h 1999/10/11 21:58:06 1.9
+++ utilities/dbootstrap/dbootstrap.h 1999/10/24 23:16:21
@@ -90,6 +90,10 @@
int configure_network (void);
int configure_pcmcia (void);
+/* PETA: functionns from old busybox */
+char * block_device(char *name);
+inline int fdflush(const char *name);
+
extern char *real_kver;
extern char *kernel_image_filename;
extern char *drivers_filename;
@@ -131,5 +135,4 @@
#else
# define eject_floppy(device) /* nada */
#endif
-
#endif
Index: utilities/dbootstrap/extract_base.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/extract_base.c,v
retrieving revision 1.5
diff -u -r1.5 extract_base.c
--- utilities/dbootstrap/extract_base.c 1999/10/21 09:02:36 1.5
+++ utilities/dbootstrap/extract_base.c 1999/10/24 22:39:56
@@ -1,5 +1,6 @@
#include <string.h>
#include <stdio.h>
+#include <sys/mount.h>
#include "dbootstrap.h"
#include "../busybox/internal.h"
#include "lang.h"
@@ -37,12 +38,12 @@
unlink(file);
}
if (! NAME_ISDIR( tmpdir, &statbuf ) ) {
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = tmpdir;
finfo.orWithMode = 01777;
- finfo.makeParentDirectories = 1;
- if (! mkdir_fn(&finfo)) {
- chown(finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ finfo.makeParentDirectories = 1;*/
+ if (! mkdir(tmpdir, 01777)) {
+ chown(tmpdir, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
status=getFloppies(_("The system is being installed from the %s floppy drive.\n\nPlease insert disk %d."),device,file);
@@ -83,7 +84,7 @@
free(file);
}
}
- do_umount("/instmnt",0);
+ umount("/instmnt");
} else {
status=extract_from_floppy(Archive_Dir,"/target/" BASETGZ,_("Base System"));
}
Index: utilities/dbootstrap/extract_kernel.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/extract_kernel.c,v
retrieving revision 1.9
diff -u -r1.9 extract_kernel.c
--- utilities/dbootstrap/extract_kernel.c 1999/10/21 06:35:50 1.9
+++ utilities/dbootstrap/extract_kernel.c 1999/10/24 23:21:09
@@ -103,7 +103,7 @@
chdir("/floppy");
status=system("./install.sh /target");
chdir("/");
- do_umount("/floppy",0);
+ umount("/floppy");
boxPopWindow();
if (status) {
return 1;
@@ -122,29 +122,29 @@
snprintf (instdir, sizeof instdir - 1, "%s/drivers", tmpdir);
if (!NAME_ISDIR (tmpdir, &statbuf))
{
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = tmpdir;
finfo.orWithMode = 01777;
- finfo.makeParentDirectories = 1;
+ finfo.makeParentDirectories = 1;PETA*/
- if (!mkdir_fn (&finfo))
+ if (!mkdir(tmpdir, 01777))
{
- chown (finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ chown (tmpdir, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
if (!NAME_ISDIR (instdir, &statbuf))
{
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = instdir;
finfo.orWithMode = 01777;
- finfo.makeParentDirectories = 1;
+ finfo.makeParentDirectories = 1;PETA*/
- if (!mkdir_fn (&finfo))
+ if (!mkdir(instdir, 01777))
{
- chown (finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ chown (instdir, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
@@ -210,29 +210,29 @@
if (!NAME_ISDIR (tmpdir, &statbuf))
{
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = tmpdir;
finfo.orWithMode = 01777;
- finfo.makeParentDirectories = 1;
+ finfo.makeParentDirectories = 1;PETA*/
- if (!mkdir_fn (&finfo))
+ if (!mkdir(tmpdir, 01777))
{
- chown (finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ chown(tmpdir, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
if (!NAME_ISDIR (instdir, &statbuf))
{
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = instdir;
finfo.orWithMode = 01777;
- finfo.makeParentDirectories = 1;
+ finfo.makeParentDirectories = 1;PETA*/
- if (!mkdir_fn (&finfo))
+ if (!mkdir(instdir, 01777))
{
- chown (finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ chown (instdir, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
@@ -351,7 +351,7 @@
status = install_from_file (filename, _("Drivers"));
free (filename);
}
- do_umount("/instmnt",0);
+ umount("/instmnt");
}
/* free(Archive_Dir); */
/* Archive_Dir=NULL; */
Index: utilities/dbootstrap/main.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/main.c,v
retrieving revision 1.16
diff -u -r1.16 main.c
--- utilities/dbootstrap/main.c 1999/10/20 14:20:26 1.16
+++ utilities/dbootstrap/main.c 1999/10/24 22:58:39
@@ -334,7 +334,7 @@
notInstalledLILO = 1;
Archive_Dir=NULL;
- InstallationRootDevice=block_device("/",NULL);
+ InstallationRootDevice=block_device("/"/*,NULL PETA*/);
if (!InstallationRootDevice) {
/* net installation with no /dev/root device on nfsroot */
/* leave time to see any error message */
Index: utilities/dbootstrap/main_menu.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/main_menu.c,v
retrieving revision 1.7
diff -u -r1.7 main_menu.c
--- utilities/dbootstrap/main_menu.c 1999/10/21 06:37:54 1.7
+++ utilities/dbootstrap/main_menu.c 1999/10/24 23:03:42
@@ -47,10 +47,10 @@
char * target_device;
struct fdisk_partition * p;
- if ( (root_device=block_device( "/",NULL )) == NULL ) {
+ if ( (root_device=block_device( "/"/*,NULL PETA*/ )) == NULL ) {
return NULL;
}
- if ( (target_device=block_device("/target",NULL )) == NULL ) {
+ if ( (target_device=block_device("/target" /*,NULL PETA*/ )) == NULL ) {
/* Perhaps it's a loop-mounted fs, or NFS */
if ((p = fdisk_find_partition_by_mntpoint("/target")) == NULL) {
free(root_device);
Index: utilities/dbootstrap/nfsroot.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/nfsroot.c,v
retrieving revision 1.2
diff -u -r1.2 nfsroot.c
--- utilities/dbootstrap/nfsroot.c 1999/10/08 06:09:13 1.2
+++ utilities/dbootstrap/nfsroot.c 1999/10/21 14:51:04
@@ -88,6 +88,7 @@
* target system mounted.
* Just move the notarget tree to /target
*/
+#if 0 /*PETA*/
struct FileInfo finfo;
memset( &finfo, 0, sizeof(finfo) );
finfo.source = TARGET_NOPREFIX;
@@ -96,6 +97,9 @@
finfo.dyadic = 1;
finfo.recursive = 1;
return descend( &finfo, cp_fn );
+#else
+ system("cp -pr " TARGET_PREFIX " " TARGET_NOPREFIX);
+#endif
}
return 0;
}
Index: utilities/dbootstrap/partition_config.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/partition_config.c,v
retrieving revision 1.2
diff -u -r1.2 partition_config.c
--- utilities/dbootstrap/partition_config.c 1999/10/21 06:35:50 1.2
+++ utilities/dbootstrap/partition_config.c 1999/10/24 23:04:55
@@ -103,7 +103,7 @@
p = mounted_partitions;
while (p) {
if (strstr(mounts,p->name)) {
- if (do_umount(p->name,0)) {
+ if (umount(p->name)) {
/* XXX should check errno ? */
sprintf(prtbuf, _("Attempting to unmount %s failed. This could mean you have another process running in a directory on %s, or you have another filesystem mounted on a mount point on %s ."),p->name, p->name, p->name);
problemBox(prtbuf,_("Unmount failed"));
@@ -118,9 +118,9 @@
p = swapon_partitions;
while (p) {
if (strstr(swaps,p->name)) {
- struct FileInfo finfo;
- finfo.source = p->name;
- swapoff_fn(&finfo);
+/* struct FileInfo finfo;
+ finfo.source = p->name;PETA*/
+ swapoff(p->name);
}
p=p->next_in_use;
}
@@ -150,7 +150,7 @@
}
static int mount_partition (struct fdisk_partition *partition) {
- char *mount_point,*real_mount_point, *prototype, *mode, *type;
+ char *mount_point,*real_mount_point, *prototype, *type;
struct stat statbuf;
int status;
@@ -167,13 +167,13 @@
real_mount_point=strdup("/target");
} else {
if ( (! NAME_ISDIR( "/target/usr", &statbuf ) ) ||
- (! strcmp(Root->name,block_device("/target/usr",NULL))) ){
+ (! strcmp(Root->name,block_device("/target/usr"/*,NULL PETA*/))) ){
prototype="/usr";
} else if ( (! NAME_ISDIR( "/target/var", &statbuf ) ) ||
- (! strcmp(Root->name,block_device("/target/var",NULL))) ){
+ (! strcmp(Root->name,block_device("/target/var"/*,NULL PETA*/))) ){
prototype="/var";
} else if ( (! NAME_ISDIR( "/target/home", &statbuf ) ) ||
- (! strcmp(Root->name,block_device("/target/home",NULL))) ){
+ (! strcmp(Root->name,block_device("/target/home"/*,NULL PETA*/))) ){
prototype="/home";
} else {
prototype="/";
@@ -189,16 +189,14 @@
}
if (! NAME_ISDIR( real_mount_point, &statbuf ) ) {
- struct FileInfo finfo;
+ int WithMode;
if (! strcmp(real_mount_point,"/target/tmp") ) {
- finfo.orWithMode = 01777;
+ WithMode = 01777;
} else {
- finfo.orWithMode = 0755;
+ WithMode = 0755;
}
- finfo.source = real_mount_point;
- finfo.makeParentDirectories = 1;
- if (! mkdir_fn(&finfo)) {
- chown(finfo.source, 0, 3); /* root_uid= 0 , sys_gid= 3 */
+ if (! mkdir(real_mount_point, WithMode)) {
+ chown(real_mount_point, 0, 3); /* root_uid= 0 , sys_gid= 3 */
}
}
#ifdef NFSROOT
@@ -263,7 +261,6 @@
int init_swap (void) {
struct fdisk_partition *p;
- struct FileInfo finfo;
int cflag,status;
sync();
@@ -284,8 +281,7 @@
problemBox(_("The swap partition could not be initialized."),_("Problem"));
return 1;
}
- finfo.source = p->name;
- if (swapon_fn(&finfo)) {
+ if (swapon(p->name, 0)) {
sprintf(prtbuf,_("The swap partition %s could not be activated"),p->name);
perrorBox(prtbuf);
return 1;
@@ -300,9 +296,7 @@
if (swapon_partitions) {
p = swapon_partitions;
while (p) {
- struct FileInfo finfo;
- finfo.source = p->name;
- swapoff_fn(&finfo);
+ swapoff(p->name);
p=p->next_in_use;
}
}
@@ -327,7 +321,7 @@
static int unmount_partition (struct fdisk_partition *p) {
- if (do_umount(p->mount_point,0)) {
+ if (umount(p->mount_point)) {
/* XXX should check errno ? */
sprintf(prtbuf,_("Attempting to unmount %s failed. This could mean you have another process running in a directory on %s, or you have another filesystem mounted on a mount point on %s ."), p->name, p->name, p->name);
problemBox(prtbuf,_("Unmount failed"));
@@ -383,14 +377,12 @@
int activate_swap (void) {
struct fdisk_partition *p;
- struct FileInfo finfo;
p=select_not_mounted(_("Please select the partition to activate as a swap device.") ,_("Select Swap Partition"),1,FSTYPE_SWAP);
if (!p) return 1;
sprintf(prtbuf,_("You have chosen to activate %s as a swap device. This will permanently erase any data on this partition. Are you sure you want to do this?"),p->name);
if(! yesNoBox(prtbuf,_("Are You Sure?")) ) return 1;
- finfo.source = p->name;
- if (swapon_fn(&finfo)) {
+ if (swapon(p->name,0)) {
sprintf(prtbuf,_("The swap partition %s could not be activated"),p->name);
perrorBox(prtbuf);
return 1;
Index: utilities/dbootstrap/pcmcia.c
===================================================================
RCS file: /home/cech/cvs/debian-boot/boot-floppies/utilities/dbootstrap/pcmcia.c,v
retrieving revision 1.5
diff -u -r1.5 pcmcia.c
--- utilities/dbootstrap/pcmcia.c 1999/10/21 06:35:50 1.5
+++ utilities/dbootstrap/pcmcia.c 1999/10/21 15:35:20
@@ -161,11 +161,11 @@
* Creates the /var/run directory if not there
*/
if(stat(PCMCIA_VAR_RUN,&tmp)!=0) {
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = PCMCIA_VAR_RUN;
finfo.orWithMode = 0755;
- finfo.makeParentDirectories = 1;
- if(mkdir_fn(&finfo))
+ finfo.makeParentDirectories = 1;PETA*/
+ if(mkdir(PCMCIA_VAR_RUN, 0755))
return PCMCIA_MOD_ERROR;
}
@@ -443,11 +443,11 @@
* Creates the /etc directory
*/
if(! NAME_ISDIR(PCMCIA_ETC_DIR,&statbuf) ) {
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = PCMCIA_ETC_DIR;
finfo.orWithMode = 0755;
- finfo.makeParentDirectories = 1;
- if(mkdir_fn(&finfo))
+ finfo.makeParentDirectories = 1;PETA*/
+ if(mkdir(PCMCIA_ETC_DIR, 0755))
return 1;
}
@@ -473,11 +473,11 @@
* Creates /etc/pcmcia
*/
if(! NAME_ISDIR(PCMCIA_CONF_DIR,&statbuf) ) {
- struct FileInfo finfo;
+/* struct FileInfo finfo;
finfo.source = PCMCIA_CONF_DIR;
finfo.orWithMode = 0755;
- finfo.makeParentDirectories = 1;
- if(mkdir_fn(&finfo))
+ finfo.makeParentDirectories = 1;PETA*/
+ if(mkdir(PCMCIA_CONF_DIR, 0755))
return 1;
}
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <unistd.h>
#include "dbootstrap.h"
/*const char block_device_usage[] = "block_device mount-point";
static int stat_error;*/
static dev_t my_device;
static char *my_device_name;
int
match_mount(const char *source, const struct stat *i) {
if ( S_ISBLK(i->st_mode)
&& (i->st_rdev == my_device)) {
my_device_name=strdup(source);
return 1;
} else
return 0;
}
/*char * block_device(const char *name, struct FileInfo *i)*/
#if 0
char *block_device(const char *name)
{
struct stat s;
char *buf;
int dinam=0;
if ( stat(name, &s) ) { return (char *) NULL; }
if (!i) {
i=(struct FileInfo*)malloc(sizeof(struct FileInfo));
dinam = 1;
}
memset((void *)i, 0, sizeof(struct FileInfo));
my_device = s.st_dev;
my_device_name = NULL;
i->source = "/dev";
i->stat = s;
i->processDirectoriesAfterTheirContents=1;
descend(i, match_mount);
if (dinam) free(i);
if ( my_device_name ) {
buf = strdup(my_device_name);
free(my_device_name);
return buf;
} else {
return (char *) NULL;
}
}
#else
char *block_device(char *name)
{
struct stat s;
if(stat(name, &s))
return (char *) NULL;
if(S_ISBLK(s.st_mode))
return name;
return (char *) NULL;
}
#endif
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fd.h>
#include <fcntl.h>
inline int
fdflush(const char *filename)
{
int fd = open(filename, 0);
if ( fd < 0 ) {
return 1;
}
ioctl(fd, FDFLUSH, 0);
close(fd);
return 0;
}
Reply to: