Parcourir la source

Updated to use buffer rather than processor

tags/v0.9.3
Michael Brown il y a 19 ans
Parent
révision
5ae60bd95d
1 fichiers modifiés avec 7 ajouts et 16 suppressions
  1. 7
    16
      src/proto/nfs.c

+ 7
- 16
src/proto/nfs.c Voir le fichier

@@ -484,19 +484,14 @@ static int nfs_read(struct sockaddr_in *server, char *fh, int offset, int len,
484 484
 /**************************************************************************
485 485
 NFS - Download extended BOOTP data, or kernel image from NFS server
486 486
 **************************************************************************/
487
-static int nfs ( char *url __unused,
488
-		 struct sockaddr_in *server,
489
-		 char *name,
490
-		 int ( * process ) ( unsigned char *data,
491
-				     unsigned int blocknum,
492
-				     unsigned int len, int eof ) ) {
487
+static int nfs ( char *url __unused, struct sockaddr_in *server,
488
+		 char *name, struct buffer *buffer ) {
493 489
 	static int recursion = 0;
494 490
 	int sport;
495 491
 	int err, namelen = strlen(name);
496 492
 	char dirname[300], *fname;
497 493
 	char dirfh[NFS_FHSIZE];		/* file handle of directory */
498 494
 	char filefh[NFS_FHSIZE];	/* file handle of kernel image */
499
-	unsigned int block;
500 495
 	int rlen, size, offs, len;
501 496
 	struct rpc_t *rpc;
502 497
 
@@ -562,7 +557,6 @@ nfssymlink:
562 557
 	}
563 558
 
564 559
 	offs = 0;
565
-	block = 1;	/* blocks are numbered starting from 1 */
566 560
 	size = -1;	/* will be set properly with the first reply */
567 561
 	len = NFS_READ_SIZE;	/* first request is always full size */
568 562
 	do {
@@ -571,9 +565,8 @@ nfssymlink:
571 565
 			// An error occured. NFS servers tend to sending
572 566
 			// errors 21 / 22 when symlink instead of real file
573 567
 			// is requested. So check if it's a symlink!
574
-			block = nfs_readlink(&nfs_server, dirfh, dirname,
575
-			                filefh, sport);
576
-			if ( 0 == block ) {
568
+			if ( nfs_readlink(&nfs_server, dirfh, dirname,
569
+					  filefh, sport) == 0 ) {
577 570
 				printf("\nLoading symlink:%s ..",dirname);
578 571
 				goto nfssymlink;
579 572
 			}
@@ -599,14 +592,12 @@ nfssymlink:
599 592
 			rlen = len;	/* shouldn't happen...  */
600 593
 		}
601 594
 
602
-		err = process((char *)&rpc->u.reply.data[19], block, rlen,
603
-			(offs+rlen == size));
604
-		if (err <= 0) {
595
+		if ( ! fill_buffer ( buffer, &rpc->u.reply.data[19],
596
+				     offs, rlen ) ) {
605 597
 			nfs_reset();
606
-			return err;
598
+			return 0;
607 599
 		}
608 600
 
609
-		block++;
610 601
 		offs += rlen;
611 602
 		/* last request is done with matching requested read size */
612 603
 		if (size-offs < NFS_READ_SIZE) {

Chargement…
Annuler
Enregistrer