udf_vnops.c (108686) | udf_vnops.c (109623) |
---|---|
1/*- 2 * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/fs/udf/udf_vnops.c 108686 2003-01-04 22:10:36Z phk $ | 26 * $FreeBSD: head/sys/fs/udf/udf_vnops.c 109623 2003-01-21 08:56:16Z alfred $ |
27 */ 28 29/* udf_vnops.c */ 30/* Take care of the vnode side of things */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/namei.h> --- 409 unchanged lines hidden (view full) --- 444 */ 445static int 446udf_transname(char *cs0string, char *destname, int len) 447{ 448 unicode_t *transname; 449 int i, unilen = 0; 450 451 /* allocate a buffer big enough to hold an 8->16 bit expansion */ | 27 */ 28 29/* udf_vnops.c */ 30/* Take care of the vnode side of things */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/namei.h> --- 409 unchanged lines hidden (view full) --- 444 */ 445static int 446udf_transname(char *cs0string, char *destname, int len) 447{ 448 unicode_t *transname; 449 int i, unilen = 0; 450 451 /* allocate a buffer big enough to hold an 8->16 bit expansion */ |
452 transname = uma_zalloc(udf_zone_trans, M_WAITOK); | 452 transname = uma_zalloc(udf_zone_trans, 0); |
453 454 if ((unilen = udf_UncompressUnicode(len, cs0string, transname)) == -1) { 455 printf("udf: Unicode translation failed\n"); 456 uma_zfree(udf_zone_trans, transname); 457 return 0; 458 } 459 460 /* At this point, the name is in 16-bit Unicode. Compact it down --- 20 unchanged lines hidden (view full) --- 481 */ 482static int 483udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen) 484{ 485 char *transname; 486 int error = 0; 487 488 /* This is overkill, but not worth creating a new zone */ | 453 454 if ((unilen = udf_UncompressUnicode(len, cs0string, transname)) == -1) { 455 printf("udf: Unicode translation failed\n"); 456 uma_zfree(udf_zone_trans, transname); 457 return 0; 458 } 459 460 /* At this point, the name is in 16-bit Unicode. Compact it down --- 20 unchanged lines hidden (view full) --- 481 */ 482static int 483udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen) 484{ 485 char *transname; 486 int error = 0; 487 488 /* This is overkill, but not worth creating a new zone */ |
489 transname = uma_zalloc(udf_zone_trans, M_WAITOK); | 489 transname = uma_zalloc(udf_zone_trans, 0); |
490 491 cs0len = udf_transname(cs0string, transname, cs0len); 492 493 /* Easy check. If they aren't the same length, they aren't equal */ 494 if ((cs0len == 0) || (cs0len != cmplen)) 495 error = -1; 496 else 497 error = bcmp(transname, cmpname, cmplen); --- 29 unchanged lines hidden (view full) --- 527 return (uiomove((caddr_t)uiodir->dirent, de_size, uio)); 528} 529 530static struct udf_dirstream * 531udf_opendir(struct udf_node *node, int offset, int fsize, struct udf_mnt *udfmp) 532{ 533 struct udf_dirstream *ds; 534 | 490 491 cs0len = udf_transname(cs0string, transname, cs0len); 492 493 /* Easy check. If they aren't the same length, they aren't equal */ 494 if ((cs0len == 0) || (cs0len != cmplen)) 495 error = -1; 496 else 497 error = bcmp(transname, cmpname, cmplen); --- 29 unchanged lines hidden (view full) --- 527 return (uiomove((caddr_t)uiodir->dirent, de_size, uio)); 528} 529 530static struct udf_dirstream * 531udf_opendir(struct udf_node *node, int offset, int fsize, struct udf_mnt *udfmp) 532{ 533 struct udf_dirstream *ds; 534 |
535 ds = uma_zalloc(udf_zone_ds, M_WAITOK | M_ZERO); | 535 ds = uma_zalloc(udf_zone_ds, M_ZERO); |
536 537 ds->node = node; 538 ds->offset = offset; 539 ds->udfmp = udfmp; 540 ds->fsize = fsize; 541 542 return (ds); 543} --- 48 unchanged lines hidden (view full) --- 592 return (NULL); 593 } 594 595 /* 596 * File ID descriptors can only be at most one 597 * logical sector in size. 598 */ 599 MALLOC(ds->buf, uint8_t*, ds->udfmp->bsize, M_UDFFID, | 536 537 ds->node = node; 538 ds->offset = offset; 539 ds->udfmp = udfmp; 540 ds->fsize = fsize; 541 542 return (ds); 543} --- 48 unchanged lines hidden (view full) --- 592 return (NULL); 593 } 594 595 /* 596 * File ID descriptors can only be at most one 597 * logical sector in size. 598 */ 599 MALLOC(ds->buf, uint8_t*, ds->udfmp->bsize, M_UDFFID, |
600 M_WAITOK | M_ZERO); | 600 M_ZERO); |
601 bcopy(fid, ds->buf, frag_size); 602 603 /* Reduce all of the casting magic */ 604 fid = (struct fileid_desc*)ds->buf; 605 606 if (ds->bp != NULL) 607 brelse(ds->bp); 608 --- 83 unchanged lines hidden (view full) --- 692 if (a->a_ncookies != NULL) { 693 /* 694 * Guess how many entries are needed. If we run out, this 695 * function will be called again and thing will pick up were 696 * it left off. 697 */ 698 ncookies = uio->uio_resid / 8; 699 MALLOC(cookies, u_long *, sizeof(u_long) * ncookies, | 601 bcopy(fid, ds->buf, frag_size); 602 603 /* Reduce all of the casting magic */ 604 fid = (struct fileid_desc*)ds->buf; 605 606 if (ds->bp != NULL) 607 brelse(ds->bp); 608 --- 83 unchanged lines hidden (view full) --- 692 if (a->a_ncookies != NULL) { 693 /* 694 * Guess how many entries are needed. If we run out, this 695 * function will be called again and thing will pick up were 696 * it left off. 697 */ 698 ncookies = uio->uio_resid / 8; 699 MALLOC(cookies, u_long *, sizeof(u_long) * ncookies, |
700 M_TEMP, M_WAITOK); | 700 M_TEMP, 0); |
701 if (cookies == NULL) 702 return (ENOMEM); 703 uiodir.ncookies = ncookies; 704 uiodir.cookies = cookies; 705 uiodir.acookies = 0; 706 } else { 707 uiodir.cookies = NULL; 708 } --- 493 unchanged lines hidden --- | 701 if (cookies == NULL) 702 return (ENOMEM); 703 uiodir.ncookies = ncookies; 704 uiodir.cookies = cookies; 705 uiodir.acookies = 0; 706 } else { 707 uiodir.cookies = NULL; 708 } --- 493 unchanged lines hidden --- |