Backports and a fix for the 3.1.3 branch.

. backports of various fixes already on the trunk
  . pass label of driver as argv[0], allowing the pci
    driver to free pci resources for it (solved differently
    on the trunk code), allowing pci drivers to be restarted
This commit is contained in:
Ben Gras 2007-05-01 13:29:50 +00:00
parent b015dae3e7
commit ccd02a6028
14 changed files with 56 additions and 55 deletions

View File

@ -63,9 +63,6 @@ int min_region_mb = 500;
#define MIN_REGION_SECTORS (1024*1024*min_region_mb/SECTOR_SIZE) #define MIN_REGION_SECTORS (1024*1024*min_region_mb/SECTOR_SIZE)
#define MAX_REGION_MB 4095
#define MAX_REGION_SECTORS (1024*(1024/SECTOR_SIZE)*MAX_REGION_MB)
#define arraysize(a) (sizeof(a) / sizeof((a)[0])) #define arraysize(a) (sizeof(a) / sizeof((a)[0]))
#define arraylimit(a) ((a) + arraysize(a)) #define arraylimit(a) ((a) + arraysize(a))
@ -339,7 +336,7 @@ void newdevice(char *name, int scanning, int disk_only)
if (curdev->rdev != DEV_C0D0) curdev= firstdev; if (curdev->rdev != DEV_C0D0) curdev= firstdev;
} }
void getdevices() void getdevices(void)
/* Get all block devices from /dev that look interesting. */ /* Get all block devices from /dev that look interesting. */
{ {
DIR *d; DIR *d;
@ -2154,18 +2151,8 @@ scribble_region(region_t *reg, struct part_entry **pe, int *made_new)
{ {
int ex, changed = 0, i; int ex, changed = 0, i;
struct part_entry *newpart; struct part_entry *newpart;
if(reg->is_used_part && reg->used_part.size > MAX_REGION_SECTORS) {
reg->used_part.size = MAX_REGION_SECTORS;
changed = 1;
cylinderalign(reg);
}
if(!reg->is_used_part) { if(!reg->is_used_part) {
ex = reg->free_sec_last - reg->free_sec_start + 1; ex = reg->free_sec_last - reg->free_sec_start + 1;
if(ex > MAX_REGION_SECTORS) {
reg->free_sec_last -= ex - MAX_REGION_SECTORS;
changed = 1;
cylinderalign(reg);
}
if(made_new) *made_new = 1; if(made_new) *made_new = 1;
} else if(made_new) *made_new = 0; } else if(made_new) *made_new = 0;
if(!reg->is_used_part) { if(!reg->is_used_part) {

View File

@ -246,7 +246,6 @@ do
echo -n " echo -n "
MINIX needs one primary partition of $TOTALMB MB for a full install, MINIX needs one primary partition of $TOTALMB MB for a full install,
plus what you want for /home. plus what you want for /home.
The maximum file system currently supported is 4 GB.
If there is no free space on your disk then you have to choose an option: If there is no free space on your disk then you have to choose an option:
(1) Delete one or more partitions (1) Delete one or more partitions

View File

@ -233,8 +233,7 @@ char *argv[];
* reporting a 0-sized device (displays usage). * reporting a 0-sized device (displays usage).
*/ */
if(blocks < 1) { if(blocks < 1) {
fprintf(stderr, "%s: this device can't hold a filesystem.\n", fprintf(stderr, "%s: zero size device.\n", progname);
progname);
return 1; return 1;
} }
} }

View File

@ -124,8 +124,8 @@ char *argv[];
/* Read the entire file. Try it in large chunks, but if an error /* Read the entire file. Try it in large chunks, but if an error
* occurs, go to single reads for a while. */ * occurs, go to single reads for a while. */
while (1) { while (1) {
if(lseek(fd, BLOCK_SIZE * b, SEEK_SET) < 0) { if(lseek64(fd, mul64u(BLOCK_SIZE, b), SEEK_SET, NULL) < 0) {
perror("lseek"); perror("lseek64");
return 1; return 1;
} }
s = read(fd, a, BLOCK_SIZE * chunk); s = read(fd, a, BLOCK_SIZE * chunk);

View File

@ -37,10 +37,12 @@ PRIVATE struct pcitab
}; };
_PROTOTYPE( static void rtl_init, (struct dpeth *dep) ); _PROTOTYPE( static void rtl_init, (struct dpeth *dep) );
#if 0
_PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) ); _PROTOTYPE( static u16_t get_ee_word, (dpeth_t *dep, int a) );
_PROTOTYPE( static void ee_wen, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wen, (dpeth_t *dep) );
_PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, U16_t w) ); _PROTOTYPE( static void set_ee_word, (dpeth_t *dep, int a, U16_t w) );
_PROTOTYPE( static void ee_wds, (dpeth_t *dep) ); _PROTOTYPE( static void ee_wds, (dpeth_t *dep) );
#endif
_PROTOTYPE( static void micro_delay, (unsigned long usecs) ); _PROTOTYPE( static void micro_delay, (unsigned long usecs) );
PUBLIC int rtl_probe(dep) PUBLIC int rtl_probe(dep)
@ -79,7 +81,7 @@ struct dpeth *dep;
for(;;) for(;;)
{ {
for (i= 0; pcitab[i].vid != 0; i++) for (i= 0; pcitab[i].vid != 0 || pcitab[i].did != 0; i++)
{ {
if (pcitab[i].vid != vid) if (pcitab[i].vid != vid)
continue; continue;
@ -93,7 +95,7 @@ struct dpeth *dep;
} }
break; break;
} }
if (pcitab[i].vid != 0) if (pcitab[i].vid != 0 || pcitab[i].did != 0)
break; break;
if (just_one) if (just_one)
@ -116,7 +118,8 @@ struct dpeth *dep;
dname= "unknown device"; dname= "unknown device";
printf("%s: %s (%04X/%04X) at %s\n", printf("%s: %s (%04X/%04X) at %s\n",
dep->de_name, dname, vid, did, pci_slot_name(devind)); dep->de_name, dname, vid, did, pci_slot_name(devind));
pci_reserve(devind); if(pci_reserve_ok(devind) != OK)
return 0;
/* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */ /* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */
bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0;
@ -199,6 +202,7 @@ dpeth_t *dep;
printf("\n"); printf("\n");
#endif #endif
#if 0
if (getenv("RTL8029MN")) if (getenv("RTL8029MN"))
{ {
ee_wen(dep); ee_wen(dep);
@ -226,8 +230,10 @@ dpeth_t *dep;
assert(get_ee_word(dep, 0x76/2) == 0x8029); assert(get_ee_word(dep, 0x76/2) == 0x8029);
} }
#endif
} }
#if 0
static u16_t get_ee_word(dep, a) static u16_t get_ee_word(dep, a)
dpeth_t *dep; dpeth_t *dep;
int a; int a;
@ -365,6 +371,7 @@ dpeth_t *dep;
outb_reg3(dep, 1, 0x00); /* back to normal */ outb_reg3(dep, 1, 0x00); /* back to normal */
outb_reg0(dep, DP_CR, CR_PS_P0); /* back to bank 0 */ outb_reg0(dep, DP_CR, CR_PS_P0); /* back to bank 0 */
} }
#endif
static void micro_delay(unsigned long usecs) static void micro_delay(unsigned long usecs)
{ {

View File

@ -148,7 +148,8 @@ int safe; /* safe copies */
return EPERM; return EPERM;
} }
if (ex64hi(pos64) != 0) /* ZERO_DEV and NULL_DEV are infinite in size. */
if (m_device != ZERO_DEV && m_device != NULL_DEV && ex64hi(pos64) != 0)
return OK; /* Beyond EOF */ return OK; /* Beyond EOF */
position= cv64ul(pos64); position= cv64ul(pos64);

View File

@ -140,10 +140,8 @@ message *mp;
{ {
/* Ignore all init calls for a process after the first one */ /* Ignore all init calls for a process after the first one */
} }
#if 0
else else
pci_release(names[i].name); pci_release(names[i].name);
#endif
names[i].tasknr= mp->m_source; names[i].tasknr= mp->m_source;
mp->m_type= 0; mp->m_type= 0;

View File

@ -387,7 +387,6 @@ char *name;
return OK; return OK;
} }
#if 0
/*===========================================================================* /*===========================================================================*
* pci_release * * pci_release *
*===========================================================================*/ *===========================================================================*/
@ -405,7 +404,6 @@ char *name;
pcidev[i].pd_inuse= 0; pcidev[i].pd_inuse= 0;
} }
} }
#endif
/*===========================================================================* /*===========================================================================*
* pci_ids * * pci_ids *

View File

@ -5,5 +5,5 @@
/usr/lib/em_opt 208000 /usr/lib/em_opt 208000
/usr/lib/i386/as 55000 /usr/lib/i386/as 55000
/usr/lib/i386/cg 50655 /usr/lib/i386/cg 50655
/bin/sh 102400 /bin/sh 142400
/usr/bin/make 337920 /usr/bin/make 380000

View File

@ -20,7 +20,7 @@ PUBLIC struct mproc mproc[NR_PROCS];
*===========================================================================*/ *===========================================================================*/
PRIVATE char *flags_str(int flags) PRIVATE char *flags_str(int flags)
{ {
static char str[10]; static char str[13];
str[0] = (flags & WAITING) ? 'W' : '-'; str[0] = (flags & WAITING) ? 'W' : '-';
str[1] = (flags & ZOMBIE) ? 'Z' : '-'; str[1] = (flags & ZOMBIE) ? 'Z' : '-';
str[2] = (flags & PAUSED) ? 'P' : '-'; str[2] = (flags & PAUSED) ? 'P' : '-';

View File

@ -82,7 +82,7 @@ int flags; /* extra flags, if any */
* arguments vector is: path, arguments, NULL. * arguments vector is: path, arguments, NULL.
*/ */
arg_count = 0; /* initialize arg count */ arg_count = 0; /* initialize arg count */
rp->r_argv[arg_count++] = rp->r_cmd; /* start with path */ rp->r_file = rp->r_argv[arg_count++] = rp->r_cmd; /* start with path */
cmd_ptr = rp->r_cmd; /* do some parsing */ cmd_ptr = rp->r_cmd; /* do some parsing */
while(*cmd_ptr != '\0') { /* stop at end of string */ while(*cmd_ptr != '\0') { /* stop at end of string */
if (*cmd_ptr == ' ') { /* next argument */ if (*cmd_ptr == ' ') { /* next argument */
@ -184,7 +184,7 @@ message *m_ptr; /* request message pointer */
* arguments vector is: path, arguments, NULL. * arguments vector is: path, arguments, NULL.
*/ */
arg_count = 0; /* initialize arg count */ arg_count = 0; /* initialize arg count */
rp->r_argv[arg_count++] = rp->r_cmd; /* start with path */ rp->r_file = rp->r_argv[arg_count++] = rp->r_cmd; /* start with path */
cmd_ptr = rp->r_cmd; /* do some parsing */ cmd_ptr = rp->r_cmd; /* do some parsing */
while(*cmd_ptr != '\0') { /* stop at end of string */ while(*cmd_ptr != '\0') { /* stop at end of string */
if (*cmd_ptr == ' ') { /* next argument */ if (*cmd_ptr == ' ') { /* next argument */
@ -720,8 +720,9 @@ endpoint_t *endpoint;
setuid(rp->r_uid); setuid(rp->r_uid);
if (!use_copy) if (!use_copy)
{ {
execve(rp->r_argv[0], rp->r_argv, NULL); /* POSIX execute */ rp->r_argv[0] = rp->r_label;
file_only = strrchr(rp->r_argv[0], '/') + 1; execve(rp->r_file, rp->r_argv, NULL); /* POSIX execute */
file_only = strrchr(rp->r_file, '/') + 1;
execve(file_only, rp->r_argv, NULL); /* POSIX execute */ execve(file_only, rp->r_argv, NULL); /* POSIX execute */
} }
printf("RS: exec failed for %s: %d\n", rp->r_argv[0], errno); printf("RS: exec failed for %s: %d\n", rp->r_argv[0], errno);

View File

@ -42,6 +42,7 @@ extern struct rproc {
char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */ char r_cmd[MAX_COMMAND_LEN]; /* raw command plus arguments */
char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */ char r_script[MAX_SCRIPT_LEN]; /* name of the restart script executable */
char *r_argv[MAX_NR_ARGS+2]; /* parsed arguments vector */ char *r_argv[MAX_NR_ARGS+2]; /* parsed arguments vector */
char *r_file; /* path to binary to exec */
int r_argc; /* number of arguments */ int r_argc; /* number of arguments */
/* Resources */ /* Resources */

View File

@ -37,7 +37,7 @@
FORWARD _PROTOTYPE( int safe_io_conversion, (endpoint_t, FORWARD _PROTOTYPE( int safe_io_conversion, (endpoint_t,
cp_grant_id_t *, int *, cp_grant_id_t *, int, endpoint_t *, cp_grant_id_t *, int *, cp_grant_id_t *, int, endpoint_t *,
void **, int *, vir_bytes, off_t *)); void **, int *, vir_bytes, u32_t *));
FORWARD _PROTOTYPE( void safe_io_cleanup, (cp_grant_id_t, cp_grant_id_t *, FORWARD _PROTOTYPE( void safe_io_cleanup, (cp_grant_id_t, cp_grant_id_t *,
int)); int));
@ -170,7 +170,7 @@ PUBLIC void dev_status(message *m)
* safe_io_conversion * * safe_io_conversion *
*===========================================================================*/ *===========================================================================*/
PRIVATE int safe_io_conversion(driver, gid, op, gids, gids_size, PRIVATE int safe_io_conversion(driver, gid, op, gids, gids_size,
io_ept, buf, vec_grants, bytes, pos) io_ept, buf, vec_grants, bytes, pos_lo)
endpoint_t driver; endpoint_t driver;
cp_grant_id_t *gid; cp_grant_id_t *gid;
int *op; int *op;
@ -180,7 +180,7 @@ endpoint_t *io_ept;
void **buf; void **buf;
int *vec_grants; int *vec_grants;
vir_bytes bytes; vir_bytes bytes;
off_t *pos; u32_t *pos_lo;
{ {
int access = 0, size; int access = 0, size;
int j; int j;
@ -242,7 +242,7 @@ off_t *pos;
*buf = new_iovec; *buf = new_iovec;
break; break;
case VFS_DEV_IOCTL: case VFS_DEV_IOCTL:
*pos = *io_ept; /* Old endpoint in POSITION field. */ *pos_lo = *io_ept; /* Old endpoint in POSITION field. */
*op = DEV_IOCTL_S; *op = DEV_IOCTL_S;
if(_MINIX_IOCTL_IOR(m_in.REQUEST)) access |= CPF_WRITE; if(_MINIX_IOCTL_IOR(m_in.REQUEST)) access |= CPF_WRITE;
if(_MINIX_IOCTL_IOW(m_in.REQUEST)) access |= CPF_READ; if(_MINIX_IOCTL_IOW(m_in.REQUEST)) access |= CPF_READ;
@ -303,6 +303,7 @@ int gids_size;
return; return;
} }
#if 0
/*===========================================================================* /*===========================================================================*
* dev_bio * * dev_bio *
*===========================================================================*/ *===========================================================================*/
@ -420,22 +421,23 @@ int bytes; /* how many bytes to transfer */
return(m.REP_STATUS); return(m.REP_STATUS);
} }
} }
#endif
/*===========================================================================* /*===========================================================================*
* dev_io * * dev_io *
*===========================================================================*/ *===========================================================================*/
PUBLIC int dev_io(op, dev, proc_e, buf, posX, bytes, flags) PUBLIC int dev_io(op, dev, proc_e, buf, pos, bytes, flags)
int op; /* DEV_READ, DEV_WRITE, DEV_IOCTL, etc. */ int op; /* DEV_READ, DEV_WRITE, DEV_IOCTL, etc. */
dev_t dev; /* major-minor device number */ dev_t dev; /* major-minor device number */
int proc_e; /* in whose address space is buf? */ int proc_e; /* in whose address space is buf? */
void *buf; /* virtual address of the buffer */ void *buf; /* virtual address of the buffer */
u64_t posX; /* byte position */ u64_t pos; /* byte position */
int bytes; /* how many bytes to transfer */ int bytes; /* how many bytes to transfer */
int flags; /* special flags, like O_NONBLOCK */ int flags; /* special flags, like O_NONBLOCK */
{ {
/* Read or write from a device. The parameter 'dev' tells which one. */ /* Read or write from a device. The parameter 'dev' tells which one. */
struct dmap *dp; struct dmap *dp;
off_t pos; u32_t pos_lo, pos_high;
message dev_mess; message dev_mess;
cp_grant_id_t gid = GRANT_INVALID; cp_grant_id_t gid = GRANT_INVALID;
static cp_grant_id_t gids[NR_IOREQS]; static cp_grant_id_t gids[NR_IOREQS];
@ -443,9 +445,8 @@ int flags; /* special flags, like O_NONBLOCK */
void *buf_used; void *buf_used;
endpoint_t ioproc; endpoint_t ioproc;
if (ex64hi(posX) != 0) pos_lo= ex64lo(pos);
panic(__FILE__, "dev_io: postition too high", NO_NUM); pos_high= ex64hi(pos);
pos= ex64lo(posX);
/* Determine task dmap. */ /* Determine task dmap. */
dp = &dmap[(dev >> MAJOR) & BYTE]; dp = &dmap[(dev >> MAJOR) & BYTE];
@ -471,7 +472,7 @@ int flags; /* special flags, like O_NONBLOCK */
buf_used = buf; buf_used = buf;
safe = safe_io_conversion(dp->dmap_driver, &gid, safe = safe_io_conversion(dp->dmap_driver, &gid,
&op, gids, NR_IOREQS, &dev_mess.IO_ENDPT, &buf_used, &op, gids, NR_IOREQS, &dev_mess.IO_ENDPT, &buf_used,
&vec_grants, bytes, &pos); &vec_grants, bytes, &pos_lo);
if(buf != buf_used) if(buf != buf_used)
panic(__FILE__,"dev_io: safe_io_conversion changed buffer", NO_NUM); panic(__FILE__,"dev_io: safe_io_conversion changed buffer", NO_NUM);
@ -484,9 +485,9 @@ int flags; /* special flags, like O_NONBLOCK */
/* Set up the rest of the message passed to task. */ /* Set up the rest of the message passed to task. */
dev_mess.m_type = op; dev_mess.m_type = op;
dev_mess.DEVICE = (dev >> MINOR) & BYTE; dev_mess.DEVICE = (dev >> MINOR) & BYTE;
dev_mess.POSITION = pos; dev_mess.POSITION = pos_lo;
dev_mess.COUNT = bytes; dev_mess.COUNT = bytes;
dev_mess.HIGHPOS = 0; dev_mess.HIGHPOS = pos_high;
/* This will be used if the i/o is suspended. */ /* This will be used if the i/o is suspended. */
ioproc = dev_mess.IO_ENDPT; ioproc = dev_mess.IO_ENDPT;

View File

@ -95,11 +95,13 @@ SVNREV=""
REVTAG="" REVTAG=""
PACKAGES=1 PACKAGES=1
while getopts "pchu?r:" c FILENAMEOUT=""
while getopts "s:pchu?r:f:" c
do do
case "$c" in case "$c" in
\?) \?)
echo "Usage: $0 [-p] [-c] [-h] [-r <tag>] [-u]" >&2 echo "Usage: $0 [-p] [-c] [-h] [-r <tag>] [-u] [-f <filename>] [-s <username>]" >&2
exit 1 exit 1
;; ;;
h) h)
@ -123,6 +125,11 @@ do
HDEMU=1 HDEMU=1
USB=1 USB=1
;; ;;
f)
FILENAMEOUT="$OPTARG"
;;
s) USERNAME="--username=$OPTARG"
;;
esac esac
done done
@ -214,7 +221,7 @@ then
fi fi
echo " * Cleanup old files" echo " * Cleanup old files"
rm -rf $RELEASEDIR $IMG $IMAGE $ROOTIMAGE $IMGBZ $CDFILES image* rm -rf $RELEASEDIR $IMG $IMAGE $ROOTIMAGE $CDFILES image*
mkdir -p $CDFILES || exit mkdir -p $CDFILES || exit
mkdir -p $RELEASEDIR mkdir -p $RELEASEDIR
mkfs -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit mkfs -B $BS -b $ROOTBLOCKS $TMPDISK3 || exit
@ -280,9 +287,9 @@ if [ "$COPY" -ne 1 ]
then then
echo " * Doing new svn export" echo " * Doing new svn export"
REPO=https://gforge.cs.vu.nl/svn/minix/trunk/$SRC REPO=https://gforge.cs.vu.nl/svn/minix/trunk/$SRC
REVISION="`svn info $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`" REVISION="`svn info $USERNAME $SVNREV $REPO | grep '^Revision: ' | awk '{ print $2 }'`"
echo "Doing export of revision $REVISION from $REPO." echo "Doing export of revision $REVISION from $REPO."
( cd $RELEASEDIR/usr && svn export -r$REVISION $REPO ) ( cd $RELEASEDIR/usr && svn $USERNAME export -r$REVISION $REPO )
REVTAG=r$REVISION REVTAG=r$REVISION
echo " echo "
@ -303,8 +310,6 @@ if [ "$USB" -ne 0 ]; then
else else
IMG=${IMG_BASE}_${REVTAG}.iso IMG=${IMG_BASE}_${REVTAG}.iso
fi fi
IMGBZ=${IMG}.bz2
echo "Making $IMGBZ"
echo " * Fixups for owners and modes of dirs and files" echo " * Fixups for owners and modes of dirs and files"
chown -R bin $RELEASEDIR/usr/$SRC chown -R bin $RELEASEDIR/usr/$SRC
@ -337,7 +342,7 @@ then
hdemu_root_changes hdemu_root_changes
fi fi
echo $version_pretty >$RELEASEDIR/etc/version echo $version_pretty, SVN revision $SVNREV, generated `date` >$RELEASEDIR/etc/version
echo " * Counting files" echo " * Counting files"
extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'` extrakb=`du -s $RELEASEDIR/usr/install | awk '{ print $1 }'`
expr `df $TMPDISK | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEDIR/.usrkb expr `df $TMPDISK | tail -1 | awk '{ print $4 }'` - $extrakb >$RELEASEDIR/.usrkb
@ -403,3 +408,7 @@ else
partition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS partition -m $IMG 0 81:$isosects 81:$ROOTSECTS 81:$USRSECTS
fi fi
fi fi
if [ "$FILENAMEOUT" ]
then echo "$IMG" >$FILENAMEOUT
fi