ufsops.c (3df2e8b2fd61f45437285750d2880d6416a9200c) ufsops.c (dd03b475cb030673a110ddade24162f09801d116)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright (c) 2016 by Delphix. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 * Copyright (c) 2016 by Delphix. All rights reserved.
26 * Copyright 2022 Oxide Computer Company
26 */
27
28#include <sys/types.h>
29#include <sys/param.h>
30#include <sys/vnode.h>
31#include <sys/fs/ufs_fsdir.h>
32#include <sys/fs/ufs_fs.h>
33#include <sys/fs/ufs_inode.h>
34#include <sys/sysmacros.h>
35#include <sys/bootvfs.h>
36#include <sys/filep.h>
27 */
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/vnode.h>
32#include <sys/fs/ufs_fsdir.h>
33#include <sys/fs/ufs_fs.h>
34#include <sys/fs/ufs_inode.h>
35#include <sys/sysmacros.h>
36#include <sys/bootvfs.h>
37#include <sys/filep.h>
38#include <sys/kmem.h>
37
38#ifdef _BOOT
39#include "../common/util.h"
40#else
41#include <sys/sunddi.h>
42#endif
43
44extern void *bkmem_alloc(size_t);

--- 711 unchanged lines hidden (view full) ---

756 filep->fi_taken = 0;
757
758 /* unlink and deallocate node */
759 filep->fi_forw->fi_back = filep->fi_back;
760 filep->fi_back->fi_forw = filep->fi_forw;
761 cf_close(filep);
762 bkmem_free((char *)filep, sizeof (fileid_t));
763
39
40#ifdef _BOOT
41#include "../common/util.h"
42#else
43#include <sys/sunddi.h>
44#endif
45
46extern void *bkmem_alloc(size_t);

--- 711 unchanged lines hidden (view full) ---

758 filep->fi_taken = 0;
759
760 /* unlink and deallocate node */
761 filep->fi_forw->fi_back = filep->fi_back;
762 filep->fi_back->fi_forw = filep->fi_forw;
763 cf_close(filep);
764 bkmem_free((char *)filep, sizeof (fileid_t));
765
766 /*
767 * Some files are opened and closed in early boot, for example
768 * when doing a microcode update on the boot CPU. In that case
769 * the inode cache will contain memory allocated from boot
770 * pages, which will be invalid once kmem is initialised.
771 * Until kmem is ready, clear the inode cache when closing a
772 * file.
773 */
774 if (kmem_ready == 0)
775 free_cache();
776
764 return (0);
765 } else {
766 /* Big problem */
767 printf("\nFile descrip %d not allocated!", fd);
768 return (-1);
769 }
770}
771

--- 78 unchanged lines hidden ---
777 return (0);
778 } else {
779 /* Big problem */
780 printf("\nFile descrip %d not allocated!", fd);
781 return (-1);
782 }
783}
784

--- 78 unchanged lines hidden ---