]> git.saurik.com Git - apple/xnu.git/blame - bsd/hfs/hfs_notification.c
xnu-517.7.7.tar.gz
[apple/xnu.git] / bsd / hfs / hfs_notification.c
CommitLineData
55e303ae
A
1/*
2 * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
55e303ae 11 *
e5568f75
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
55e303ae
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
55e303ae
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#include <sys/systm.h>
24#include <sys/kernel.h>
25#include <sys/file.h>
26#include <sys/dirent.h>
27#include <sys/stat.h>
28#include <sys/buf.h>
29#include <sys/mount.h>
30#include <sys/vnode.h>
31#include <sys/malloc.h>
32#include <sys/namei.h>
33#include <sys/ubc.h>
34#include <sys/quota.h>
35
36#include <sys/kdebug.h>
37
38#include "hfs.h"
39#include "hfs_catalog.h"
40#include "hfs_cnode.h"
41#include "hfs_lockf.h"
42#include "hfs_dbg.h"
43#include "hfs_mount.h"
44#include "hfs_quota.h"
45#include "hfs_endian.h"
46
47#include "hfscommon/headers/BTreesInternal.h"
48#include "hfscommon/headers/FileMgrInternal.h"
49
50
51
52void hfs_generate_volume_notifications(struct hfsmount *hfsmp) {
53 ExtendedVCB *vcb = HFSTOVCB(hfsmp);
54
55 if (hfsmp->hfs_notification_conditions & VQ_LOWDISK) {
56 /* Check to see whether the free space is back above the minimal level: */
57 if (hfs_freeblks(hfsmp, 1) > hfsmp->hfs_freespace_notify_desiredlevel) {
58 hfsmp->hfs_notification_conditions &= ~VQ_LOWDISK;
59 vfs_event_signal(&HFSTOVFS(hfsmp)->mnt_stat.f_fsid, hfsmp->hfs_notification_conditions, NULL);
60 }
61 } else {
62 /* Check to see whether the free space fell below the requested limit: */
63 if (hfs_freeblks(hfsmp, 1) < hfsmp->hfs_freespace_notify_warninglimit) {
64 hfsmp->hfs_notification_conditions |= VQ_LOWDISK;
65 vfs_event_signal(&HFSTOVFS(hfsmp)->mnt_stat.f_fsid, hfsmp->hfs_notification_conditions, NULL);
66 }
67 };
68}